[clang] [clang] Cleanup IncludeLocMap (PR #106241)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 09:00:09 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: kadir çetinkaya (kadircet)
<details>
<summary>Changes</summary>
CompilerInstance can re-use same SourceManager across multiple
frontendactions. During this process it calls
`SourceManager::clearIDTables` to reset any caches based on FileIDs.
It didn't reset IncludeLocMap, resulting in wrong include locations for
workflows that triggered multiple frontend-actions through same
CompilerInstance.
---
Full diff: https://github.com/llvm/llvm-project/pull/106241.diff
1 Files Affected:
- (modified) clang/lib/Basic/SourceManager.cpp (+1)
``````````diff
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index b0256a8ce9ed04..d6ec26af80aadd 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -350,6 +350,7 @@ void SourceManager::clearIDTables() {
LastLineNoContentCache = nullptr;
LastFileIDLookup = FileID();
+ IncludedLocMap.clear();
if (LineTable)
LineTable->clear();
``````````
</details>
https://github.com/llvm/llvm-project/pull/106241
More information about the cfe-commits
mailing list