[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / macro-redef.c
blob389aaa4628d4033b952bd11bcda3bcb1b33701c2
1 // RUN: %clang_cc1 %s -emit-pch -o %t1.pch -verify
2 // RUN: %clang_cc1 %s -emit-pch -o %t2.pch -include-pch %t1.pch -verify
3 // RUN: %clang_cc1 -fsyntax-only %s -include-pch %t2.pch -verify
5 // Test that a redefinition inside the PCH won't manifest as an ambiguous macro.
7 #ifndef HEADER1
8 #define HEADER1
10 #define M1 0 // expected-note {{previous}}
11 #define M1 1 // expected-warning {{redefined}}
13 #define M2 3
15 #elif !defined(HEADER2)
16 #define HEADER2
18 #define M2 4 // expected-warning {{redefined}}
19 // expected-note@-6 {{previous}}
21 #else
23 // Use the error to verify it was parsed.
24 int x = M1; // expected-note {{previous}}
25 int x = M2; // expected-error {{redefinition}}
27 #endif