summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/TokenLexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-06-14 18:12:03 +0000
committerChris Lattner <sabre@nondot.org>2011-06-14 18:12:03 +0000
commit07efdfdafa58ca3f2c9c7f628bb1d43ee3d9b176 (patch)
tree0d03049f12a515505f23899e9d89ad4f7186d643 /clang/lib/Lex/TokenLexer.cpp
parent965ed2e79008ea6d5175b153df7fe343b0345040 (diff)
downloadbcm5719-llvm-07efdfdafa58ca3f2c9c7f628bb1d43ee3d9b176.tar.gz
bcm5719-llvm-07efdfdafa58ca3f2c9c7f628bb1d43ee3d9b176.zip
Fix a crash on the testcase in PR9981 / rdar://9486765.
llvm-svn: 133003
Diffstat (limited to 'clang/lib/Lex/TokenLexer.cpp')
-rw-r--r--clang/lib/Lex/TokenLexer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp
index 65aff0d1d03..751fd0133ea 100644
--- a/clang/lib/Lex/TokenLexer.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud