llvm-capstone/clang/test/Modules/implementation-of-module.m
Volodymyr Sapsai 381fcaa136 [modules] Replace -Wauto-import with -Rmodule-include-translation.
Diagnostic for `-Wauto-import` shouldn't be a warning because it doesn't
represent a potential problem in code that should be fixed. And the
emitted fix-it is likely to trigger `-Watimport-in-framework-header`
which makes it challenging to have a warning-free codebase. But it is
still useful to see how include directives are translated into modular
imports and which module a header belongs to, that's why keep it as a remark.

Keep `-Wauto-import` for now to allow a gradual migration for codebases
using `-Wno-auto-import`, e.g., `-Weverything -Wno-auto-import`.

rdar://79594287

Differential Revision: https://reviews.llvm.org/D130138
2022-07-21 17:42:04 -07:00

26 lines
1.5 KiB
Objective-C

// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -fsyntax-only
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -dM -E -o - 2>&1 | FileCheck %s
// CHECK-NOT: __building_module
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_left -verify
// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -emit-pch -o %t.pch
// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -DWITH_PREFIX -fmodules-ignore-macro=WITH_PREFIX -include-pch %t.pch -fmodule-implementation-of category_right
#ifndef WITH_PREFIX
@import category_left; // expected-error{{@import of module 'category_left' in implementation of 'category_left'; use #import}}
@import category_left.sub; // expected-error{{@import of module 'category_left.sub' in implementation of 'category_left'; use #import}}
#import "category_right.h" // expected-remark{{treating}}
#import "category_right_sub.h" // expected-remark{{treating}}
#endif