diff options
author | Chris Lattner <sabre@nondot.org> | 2011-06-14 18:12:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-06-14 18:12:03 +0000 |
commit | 0e0b6931598be8a50ac5c6e0be595b35da276df9 (patch) | |
tree | 9cf56b781bb885d368178a2cd1ff6c74de119b01 /lib/Lex/TokenLexer.cpp | |
parent | 1abd35950bcb0761887dca0995c68b8a9dc8916f (diff) |
Fix a crash on the testcase in PR9981 / rdar://9486765.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133003 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/TokenLexer.cpp')
-rw-r--r-- | lib/Lex/TokenLexer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp index 65aff0d1d0..751fd0133e 100644 --- a/lib/Lex/TokenLexer.cpp +++ b/lib/Lex/TokenLexer.cpp @@ -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. |