Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@kazutakahirata kazutakahirata requested a review from nikic March 20, 2025 03:39
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 20, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/132141.diff

1 Files Affected:

  • (modified) clang/lib/AST/ByteCode/Program.cpp (+2-2)
diff --git a/clang/lib/AST/ByteCode/Program.cpp b/clang/lib/AST/ByteCode/Program.cpp
index c33d7fd7a2dc5..665e87bb5d2c8 100644
--- a/clang/lib/AST/ByteCode/Program.cpp
+++ b/clang/lib/AST/ByteCode/Program.cpp
@@ -213,12 +213,12 @@ std::optional<unsigned> Program::createGlobal(const ValueDecl *VD,
   if (auto Idx =
           createGlobal(VD, VD->getType(), IsStatic, IsExtern, IsWeak, Init)) {
     for (const Decl *P = VD; P; P = P->getPreviousDecl()) {
+      unsigned &PIdx = GlobalIndices[P];
       if (P != VD) {
-        unsigned PIdx = GlobalIndices[P];
         if (Globals[PIdx]->block()->isExtern())
           Globals[PIdx] = Globals[*Idx];
       }
-      GlobalIndices[P] = *Idx;
+      PIdx = *Idx;
     }
     return *Idx;
   }

@kazutakahirata kazutakahirata merged commit c38ef58 into llvm:main Mar 20, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_clang_ByteCode branch March 20, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants