diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-17 04:13:31 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-17 04:13:31 +0000 |
commit | 373cb7832090dd5a380be73fdff79881721eed00 (patch) | |
tree | 6d1bfc64deb21db81d9314fcd6ee789e469f0476 | |
parent | 71168330e25fdce4c1a3bf46484a2d81e2e21011 (diff) |
[PCH] Fix bug where we failed to update an identifier for a single token
macro expansion.
rdar://10588825
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146818 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 5 | ||||
-rw-r--r-- | test/PCH/single-token-macro.c | 26 |
2 files changed, 31 insertions, 0 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 20ebb40f53..5cd656527b 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -116,6 +116,11 @@ static bool isTrivialSingleTokenExpansion(const MacroInfo *MI, // If the token isn't an identifier, it's always literally expanded. if (II == 0) return true; + // If the information about this identifier is out of date, update it from + // the external source. + if (II->isOutOfDate()) + PP.getExternalSource()->updateOutOfDateIdentifier(*II); + // If the identifier is a macro, and if that macro is enabled, it may be // expanded so it's not a trivial expansion. if (II->hasMacroDefinition() && PP.getMacroInfo(II)->isEnabled() && diff --git a/test/PCH/single-token-macro.c b/test/PCH/single-token-macro.c new file mode 100644 index 0000000000..104dc130f6 --- /dev/null +++ b/test/PCH/single-token-macro.c @@ -0,0 +1,26 @@ +// rdar://10588825 + +// Test this without pch. +// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only + +// Test with pch. +// RUN: %clang_cc1 %s -emit-pch -o %t +// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only + +#ifndef HEADER +#define HEADER + +#define SKATA + +#define __stdcall +#define STDCALL __stdcall + +void STDCALL Foo(void); + +#else + +void STDCALL Foo(void) +{ +} + +#endif |