aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorYury Gribov <y.gribov@samsung.com>2016-01-28 09:28:18 +0000
committerYury Gribov <y.gribov@samsung.com>2016-01-28 09:28:18 +0000
commit154e57f83207692a55158ef483fce82916bad742 (patch)
tree9a1f3912cdcd0bc82a65e4bd4c2e9842512de7e3 /clang/lib/Basic/SourceManager.cpp
parent976892fefcd538f8671de85b620c2abda7aecb32 (diff)
downloadllvm-154e57f83207692a55158ef483fce82916bad742.zip
llvm-154e57f83207692a55158ef483fce82916bad742.tar.gz
llvm-154e57f83207692a55158ef483fce82916bad742.tar.bz2
Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.
Differential Revision: http://reviews.llvm.org/D15804 llvm-svn: 259031
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 959d4d4..416031d 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -2110,6 +2110,14 @@ bool SourceManager::isBeforeInTranslationUnit(SourceLocation LHS,
assert(LOffs.first == ROffs.first);
return false;
}
+ bool LIsScratch = strcmp("<scratch space>", LB) == 0;
+ bool RIsScratch = strcmp("<scratch space>", RB) == 0;
+ // Sort scratch after inline asm, but before the rest.
+ if (LIsScratch || RIsScratch) {
+ if (LIsScratch != RIsScratch)
+ return LIsScratch;
+ return LOffs.second < ROffs.second;
+ }
llvm_unreachable("Unsortable locations found");
}