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

Douglas Gregor dgregor at apple.com
Fri Dec 16 21:47:53 PST 2011



Sent from my iPhone

On Dec 16, 2011, at 8:13 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:

> 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.

Nice catch. Sorry this slipped by my refactor. 

> 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
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list