[clang] [clang] Diagnose config_macros before building modules (PR #83641)

Michael Spencer via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 13:36:48 PST 2024


================
@@ -22,7 +58,10 @@
 #define WANT_BAR 1 // expected-note{{macro was defined here}}
 @import config; // expected-warning{{definition of configuration macro 'WANT_BAR' has no effect on the import of 'config'; pass '-DWANT_BAR=...' on the command line to configure the module}}
 
-// RUN: rm -rf %t
-// RUN: %clang_cc1 -std=c99 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.modulemap
-// RUN: %clang_cc1 -std=c99 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -DWANT_FOO=1 %s -verify
+//--- config_error.m
 
+#ifdef TEST_ERROR
+#define SOME_VALUE 5 // expected-note{{macro was defined here}}
+ at import config_error; // expected-error{{could not build module}} \
+                      // expected-warning{{definition of configuration macro 'SOME_VALUE' has no effect on the import of 'config_error';}}
----------------
Bigcheese wrote:

There were already other tests that check the exact wording, intent here was just to make it easier to reword if ever needed, as this specific test doesn't care about the exact wording.

https://github.com/llvm/llvm-project/pull/83641


More information about the cfe-commits mailing list