summaryrefslogtreecommitdiff
path: root/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-07 03:40:27 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-07 03:40:27 +0000
commit8b86ef0b71900c64c0c2cfca54cac08a203a16a4 (patch)
tree00a59a871d38948d6b6e26785e9e29b56bb50e93 /lib/Basic/SourceManager.cpp
parentd410e741e8085e109c1dc5886c0acea88a4ca0f4 (diff)
downloadclang-8b86ef0b71900c64c0c2cfca54cac08a203a16a4.tar.gz
Fix bug in SourceManager::getDecomposedInstantiationLocSlowCase.
It would add up relative (decomposed) offsets like in getDecomposedSpellingLocSlowCase, but while it makes sense to preserve the offset among lexed spelling locations, it doesn't make sense to add anything to the offset of the instantiation location. The instantiation location will be the same regardless of the relative offset in the tokens that were instantiated. This bug didn't actually affect anything because, currently, in practice we never create macro locations with relative offset greater than 0. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134586 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r--lib/Basic/SourceManager.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 9b8d1b4bb0..d6c4c16cec 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -749,18 +749,19 @@ SourceLocation SourceManager::getSpellingLocSlowCase(SourceLocation Loc) const {
std::pair<FileID, unsigned>
-SourceManager::getDecomposedInstantiationLocSlowCase(const SrcMgr::SLocEntry *E,
- unsigned Offset) const {
+SourceManager::getDecomposedInstantiationLocSlowCase(
+ const SrcMgr::SLocEntry *E) const {
// If this is an instantiation record, walk through all the instantiation
// points.
FileID FID;
SourceLocation Loc;
+ unsigned Offset;
do {
Loc = E->getInstantiation().getInstantiationLocStart();
FID = getFileID(Loc);
E = &getSLocEntry(FID);
- Offset += Loc.getOffset()-E->getOffset();
+ Offset = Loc.getOffset()-E->getOffset();
} while (!Loc.isFileID());
return std::make_pair(FID, Offset);