[cfe-commits] r133800 - /cfe/trunk/lib/Basic/SourceManager.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Jun 24 10:28:26 PDT 2011


Author: akirtzidis
Date: Fri Jun 24 12:28:26 2011
New Revision: 133800

URL: http://llvm.org/viewvc/llvm-project?rev=133800&view=rev
Log:
SourceManager::isAtStartOfMacroInstantiation should check not only if the location
is at the first token but that the location's offset is not inside the token as well.

Modified:
    cfe/trunk/lib/Basic/SourceManager.cpp

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=133800&r1=133799&r2=133800&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Fri Jun 24 12:28:26 2011
@@ -1218,7 +1218,11 @@
 bool SourceManager::isAtStartOfMacroInstantiation(SourceLocation loc) const {
   assert(loc.isValid() && loc.isMacroID() && "Expected a valid macro loc");
 
-  unsigned FID = getFileID(loc).ID;
+  std::pair<FileID, unsigned> infoLoc = getDecomposedLoc(loc);
+  if (infoLoc.second > 0)
+    return false; // Does not point at the start of token.
+
+  unsigned FID = infoLoc.first.ID;
   assert(FID > 1);
   std::pair<SourceLocation, SourceLocation>
     instRange = getImmediateInstantiationRange(loc);





More information about the cfe-commits mailing list