[cfe-commits] r146818 - in /cfe/trunk: lib/Lex/PPMacroExpansion.cpp test/PCH/single-token-macro.c

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Dec 16 20:13:31 PST 2011


Author: akirtzidis
Date: Fri Dec 16 22:13:31 2011
New Revision: 146818

URL: http://llvm.org/viewvc/llvm-project?rev=146818&view=rev
Log:
[PCH] Fix bug where we failed to update an identifier for a single token
macro expansion.

rdar://10588825

Added:
    cfe/trunk/test/PCH/single-token-macro.c
Modified:
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=146818&r1=146817&r2=146818&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Fri Dec 16 22:13:31 2011
@@ -116,6 +116,11 @@
   // 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() &&

Added: cfe/trunk/test/PCH/single-token-macro.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/single-token-macro.c?rev=146818&view=auto
==============================================================================
--- cfe/trunk/test/PCH/single-token-macro.c (added)
+++ cfe/trunk/test/PCH/single-token-macro.c Fri Dec 16 22:13:31 2011
@@ -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





More information about the cfe-commits mailing list