[clang] d779356 - [SourceManager] Fix the incorrect counting stats in getFileIDLoaded.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 05:24:48 PDT 2022


Author: Haojian Wu
Date: 2022-10-07T14:24:31+02:00
New Revision: d779356043a895280d0880551ef33d663fe36c7e

URL: https://github.com/llvm/llvm-project/commit/d779356043a895280d0880551ef33d663fe36c7e
DIFF: https://github.com/llvm/llvm-project/commit/d779356043a895280d0880551ef33d663fe36c7e.diff

LOG: [SourceManager] Fix the incorrect counting stats in getFileIDLoaded.

We were double-counting the number of binary search FileID scans.

Added: 
    

Modified: 
    clang/lib/Basic/SourceManager.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index f82df598ffc3..7229561394e3 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -906,8 +906,6 @@ FileID SourceManager::getFileIDLoaded(SourceLocation::UIntTy SLocOffset) const {
     if (Invalid)
       return FileID(); // invalid entry.
 
-    ++NumProbes;
-
     if (E.getOffset() > SLocOffset) {
       if (GreaterIndex == MiddleIndex) {
         assert(0 && "binary search missed the entry");


        


More information about the cfe-commits mailing list