aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/macro-identifier-hiding.c
blob: 4cd7cf0500322ec9195095f1ad3133f79c0ab8f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache \
// RUN:            -fsyntax-only %t/test.c -verify
// Test again with the populated module cache.
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache \
// RUN:            -fsyntax-only %t/test.c -verify

// Test that an identifier with the same name as a macro doesn't hide this
// macro from the includers.

//--- macro-definition.h
#define __P(protos) ()
#define __Q(protos) ()

//--- macro-transitive.h
#include "macro-definition.h"
void test(int __P) {} // not "interesting" identifier
struct __Q {};        // "interesting" identifier

//--- module.modulemap
module MacroDefinition { header "macro-definition.h" export * }
module MacroTransitive { header "macro-transitive.h" export * }

//--- test.c
// expected-no-diagnostics
#include "macro-transitive.h"
void foo __P(());
void bar __Q(());