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