Skip to content

[Clang][NFC] Const correctness fix for range based for loop #137431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shafik
Copy link
Collaborator

@shafik shafik commented Apr 26, 2025

Static analysis flagged that we did not make const a item declaration b/c we did not modify it all during the loop.

Static analysis flagged that we did not make const a item declaration b/c we did
not modify it all during the loop.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Apr 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 26, 2025

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

Changes

Static analysis flagged that we did not make const a item declaration b/c we did not modify it all during the loop.


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

1 Files Affected:

  • (modified) clang/utils/TableGen/ClangBuiltinTemplatesEmitter.cpp (+1-1)
diff --git a/clang/utils/TableGen/ClangBuiltinTemplatesEmitter.cpp b/clang/utils/TableGen/ClangBuiltinTemplatesEmitter.cpp
index 34bc782e007d5..de79743a06e1f 100644
--- a/clang/utils/TableGen/ClangBuiltinTemplatesEmitter.cpp
+++ b/clang/utils/TableGen/ClangBuiltinTemplatesEmitter.cpp
@@ -107,7 +107,7 @@ ParseTemplateParameterList(ParserState &PS,
   }
 
   bool First = true;
-  for (auto e : Params) {
+  for (const auto &e : Params) {
     if (First) {
       First = false;
       Code << e;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants