[clang] [clang-repl] Fix duplicate definition error for symbols in C mode (PR #164597)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 22 03:47:12 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Anutosh Bhat (anutosh491)
<details>
<summary>Changes</summary>
Fixes #<!-- -->164596
---
Full diff: https://github.com/llvm/llvm-project/pull/164597.diff
1 Files Affected:
- (modified) clang/lib/Sema/Sema.cpp (+4)
``````````diff
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 215ac184a5337..15c5815398094 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1447,6 +1447,10 @@ void Sema::ActOnEndOfTranslationUnit() {
if (!VD || VD->isInvalidDecl() || !Seen.insert(VD).second)
continue;
+ if (PP.isIncrementalProcessingEnabled() &&
+ VD->getTranslationUnitDecl() != Context.getTranslationUnitDecl())
+ continue;
+
if (const IncompleteArrayType *ArrayT
= Context.getAsIncompleteArrayType(VD->getType())) {
// Set the length of the array to 1 (C99 6.9.2p5).
``````````
</details>
https://github.com/llvm/llvm-project/pull/164597
More information about the cfe-commits
mailing list