diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-24 17:28:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-24 17:28:26 +0000 |
commit | f096a6e754d56f90653c7ffad2b003b60a221286 (patch) | |
tree | 424eb2b2369d1281030147a61a126ec31c3117a0 /clang/lib/Basic/SourceManager.cpp | |
parent | 7d65756aba4fe70cec15336953661e1e5449ec8e (diff) | |
download | llvm-f096a6e754d56f90653c7ffad2b003b60a221286.zip llvm-f096a6e754d56f90653c7ffad2b003b60a221286.tar.gz llvm-f096a6e754d56f90653c7ffad2b003b60a221286.tar.bz2 |
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.
llvm-svn: 133800
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 23ebb4f..92557a4 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -1218,7 +1218,11 @@ PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc) const { 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); |