diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-05-06 00:22:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-05-06 00:22:25 +0000 |
commit | 672c003286c6493121ea1c9aca31f5504de737d2 (patch) | |
tree | 2269b1d8b2df061e1c54ed289962a243f011157f /lib/Basic/SourceManager.cpp | |
parent | bc397cf90355f17c974b0bdf3960e8fb38caf5d6 (diff) |
Workaround a really serious caching bug in SourceManager::isBeforeInTranslationUnit() where the
method will sometimes return different results for the same input SourceLocations. I haven't
unraveled this method completely yet, so this truly is a workaround until a better fix comes
along.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103143 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r-- | lib/Basic/SourceManager.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 3ecab1d8c1..3fb52a100b 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -1170,15 +1170,20 @@ bool SourceManager::isBeforeInTranslationUnit(SourceLocation LHS, if (LOffs.first == ROffs.first) return LOffs.second < ROffs.second; +#if 0 // If we are comparing a source location with multiple locations in the same // file, we get a big win by caching the result. + // FIXME: This caching is wrong, but I don't know enough about this code + // to immediately fix it. There are cases where passing the same input + // values to this method causes it to return different results. if (LastLFIDForBeforeTUCheck == LOffs.first && LastRFIDForBeforeTUCheck == ROffs.first) return LastResForBeforeTUCheck; LastLFIDForBeforeTUCheck = LOffs.first; LastRFIDForBeforeTUCheck = ROffs.first; +#endif // "Traverse" the include/instantiation stacks of both locations and try to // find a common "ancestor". |