From 5b0773e20149485862fbe1520b08940c30f4cb6e Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 6 May 2010 00:22:25 +0000 Subject: 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. llvm-svn: 103143 --- clang/lib/Basic/SourceManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/Basic/SourceManager.cpp') diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 3ecab1d8c16..3fb52a100b9 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/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". -- cgit v1.2.3