Debian Codegraph @

clang/test/Modules/macro-identifier-hiding.c

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache \
4 // RUN: -fsyntax-only %t/test.c -verify
5 // Test again with the populated module cache.
6 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache \
7 // RUN: -fsyntax-only %t/test.c -verify
8
9 // Test that an identifier with the same name as a macro doesn't hide this
10 // macro from the includers.
11
12 //--- macro-definition.h
13 #define __P(protos) ()
14 #define __Q(protos) ()
15
16 //--- macro-transitive.h
17 #include "macro-definition.h"
18 void test(int __P) {} // not "interesting" identifier
19 struct __Q {}; // "interesting" identifier
20
21 //--- module.modulemap
22 module MacroDefinition { header "macro-definition.h" export * }
23 module MacroTransitive { header "macro-transitive.h" export * }
24
25 //--- test.c
26 // expected-no-diagnostics
27 #include "macro-transitive.h"
28 void foo __P(());
29 void bar __Q(());