Commit Graph

2 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis 4a1049c8a2 [preprocessor] In Preprocessor::CachingLex() check whether there were more tokens
cached during the non-cached lex, otherwise we are going to drop them.

Fixes a bogus "_Pragma takes a parenthesized string literal" error when
expanding consecutive _Pragmas in a macro argument.

Part of rdar://11168596

llvm-svn: 153994
2012-04-04 02:57:01 +00:00
Argyrios Kyrtzidis f1b64c6198 Correct handling of _Pragma macro inside a macro argument.
If we are pre-expanding a macro argument don't actually "activate"
the pragma at that point, activate the pragma whenever we encounter
it again in the token stream.
This ensures that we will activate it in the correct location
or that we will ignore it if it never enters the token stream, e.g:

     \#define EMPTY(x)
     \#define INACTIVE(x) EMPTY(x)
     INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\""))

This also fixes the crash in rdar://11168596.

llvm-svn: 153959
2012-04-03 16:47:40 +00:00