Fix a crash on the testcase in PR9981 / rdar://9486765.

llvm-svn: 133003
This commit is contained in:
Chris Lattner 2011-06-14 18:12:03 +00:00
parent 965ed2e790
commit 07efdfdafa
2 changed files with 10 additions and 3 deletions

View File

@ -487,9 +487,10 @@ bool TokenLexer::PasteTokens(Token &Tok) {
// Explicitly convert the token location to have proper instantiation
// information so that the user knows where it came from.
SourceManager &SM = PP.getSourceManager();
SourceLocation Loc =
SM.createInstantiationLoc(PasteOpLoc, InstantiateLocStart,
InstantiateLocEnd, 2);
SourceLocation Loc = PasteOpLoc;
if (InstantiateLocStart.isValid())
Loc = SM.createInstantiationLoc(Loc, InstantiateLocStart,
InstantiateLocEnd, 2);
// If we're in microsoft extensions mode, downgrade this from a hard
// error to a warning that defaults to an error. This allows
// disabling it.

View File

@ -33,3 +33,9 @@ XX // expected-error {{attempt to use a poisoned identifier}}
int VA; // expected-warning {{__VA_ARGS__ can only appear in the expansion of a C99 variadic macro}}
// PR9981
#define M1(A) A
#define M2(X)
M1(M2(##)) // expected-error {{pasting formed '()', an invalid preprocessing token}}