File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -515,9 +515,19 @@ void Preprocessor::HandleIdentifier(Token &Identifier) {
515
515
516
516
// If the information about this identifier is out of date, update it from
517
517
// the external source.
518
+ // We have to treat __VA_ARGS__ in a special way, since it gets
519
+ // serialized with isPoisoned = true, but our preprocessor may have
520
+ // unpoisoned it if we're defining a C99 macro.
518
521
if (II.isOutOfDate ()) {
522
+ bool CurrentIsPoisoned = false ;
523
+ if (&II == Ident__VA_ARGS__)
524
+ CurrentIsPoisoned = Ident__VA_ARGS__->isPoisoned ();
525
+
519
526
ExternalSource->updateOutOfDateIdentifier (II);
520
527
Identifier.setKind (II.getTokenID ());
528
+
529
+ if (&II == Ident__VA_ARGS__)
530
+ II.setIsPoisoned (CurrentIsPoisoned);
521
531
}
522
532
523
533
// If this identifier was poisoned, and if it was not produced from a macro
Original file line number Diff line number Diff line change
1
+ // Test with pch.
2
+ // RUN: %clang_cc1 -emit-pch -o %t %S/pch__VA_ARGS__.h
3
+ // RUN: %clang_cc1 -include-pch %t -fsyntax-only -Weverything %s 2>&1 | FileCheck %s
4
+
5
+ #define mylog (...) printf(__VA_ARGS__)
6
+ // CHECK-NOT: warning: __VA_ARGS__ can only appear in the expansion of a C99 variadic macro
Original file line number Diff line number Diff line change
1
+ // Header for PCH test fuzzy-pch.c
2
+ void f (int X );
You can’t perform that action at this time.
0 commit comments