aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-06-24 17:28:26 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-06-24 17:28:26 +0000
commited37ab82c7790569bcd39f4ba421b17433ef530a (patch)
treed4d8ce54625bea51427675758a8fc8140ac08870 /lib/Basic/SourceManager.cpp
parent8e27eb7ebf00dc24ca135698459c68ceb30c3963 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r--lib/Basic/SourceManager.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 23ebb4fd5c..92557a421f 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/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);