[clang] Fix clang reject valid C++ code after d999ce0302f06d250f6d496b56a5a5f (PR #94471)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 5 06:49:51 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Haojian Wu (hokein)
<details>
<summary>Changes</summary>
The incremental processing mode doesn't seem to work well for C++.
---
Full diff: https://github.com/llvm/llvm-project/pull/94471.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaDecl.cpp (+2-1)
``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index a6734ef8c30aa..4b9b735f1cfb4 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2288,7 +2288,8 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
// Partial translation units that are created in incremental processing must
// not clean up the IdResolver because PTUs should take into account the
// declarations that came from previous PTUs.
- if (!PP.isIncrementalProcessingEnabled() || getLangOpts().ObjC)
+ if (!PP.isIncrementalProcessingEnabled() || getLangOpts().ObjC ||
+ getLangOpts().CPlusPlus)
IdResolver.RemoveDecl(D);
// Warn on it if we are shadowing a declaration.
``````````
</details>
https://github.com/llvm/llvm-project/pull/94471
More information about the cfe-commits
mailing list