[PATCH] D15804: Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.
Yury Gribov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 28 01:31:49 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL259030: Small refactor in isBeforeInTranslationUnit. (authored by ygribov).
Changed prior to commit:
http://reviews.llvm.org/D15804?vs=43724&id=46247#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15804
Files:
cfe/trunk/lib/Basic/SourceManager.cpp
Index: cfe/trunk/lib/Basic/SourceManager.cpp
===================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp
+++ cfe/trunk/lib/Basic/SourceManager.cpp
@@ -2089,20 +2089,20 @@
// Clear the lookup cache, it depends on a common location.
IsBeforeInTUCache.clear();
- llvm::MemoryBuffer *LBuf = getBuffer(LOffs.first);
- llvm::MemoryBuffer *RBuf = getBuffer(ROffs.first);
- bool LIsBuiltins = strcmp("<built-in>", LBuf->getBufferIdentifier()) == 0;
- bool RIsBuiltins = strcmp("<built-in>", RBuf->getBufferIdentifier()) == 0;
+ const char *LB = getBuffer(LOffs.first)->getBufferIdentifier();
+ const char *RB = getBuffer(ROffs.first)->getBufferIdentifier();
+ bool LIsBuiltins = strcmp("<built-in>", LB) == 0;
+ bool RIsBuiltins = strcmp("<built-in>", RB) == 0;
// Sort built-in before non-built-in.
if (LIsBuiltins || RIsBuiltins) {
if (LIsBuiltins != RIsBuiltins)
return LIsBuiltins;
// Both are in built-in buffers, but from different files. We just claim that
// lower IDs come first.
return LOffs.first < ROffs.first;
}
- bool LIsAsm = strcmp("<inline asm>", LBuf->getBufferIdentifier()) == 0;
- bool RIsAsm = strcmp("<inline asm>", RBuf->getBufferIdentifier()) == 0;
+ bool LIsAsm = strcmp("<inline asm>", LB) == 0;
+ bool RIsAsm = strcmp("<inline asm>", RB) == 0;
// Sort assembler after built-ins, but before the rest.
if (LIsAsm || RIsAsm) {
if (LIsAsm != RIsAsm)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15804.46247.patch
Type: text/x-patch
Size: 1482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160128/334aca04/attachment.bin>
More information about the llvm-commits
mailing list