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

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;

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shafik shafik merged commit a6f4a54 into llvm:main Apr 28, 2025
13 checks passed
@shafik shafik deleted the parsetemplateparameterlist_const_correctness_minor_fix branch April 28, 2025 23:57
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
)

Static analysis flagged that we did not make const a item declaration
b/c we did not modify it all during the loop.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
)

Static analysis flagged that we did not make const a item declaration
b/c we did not modify it all during the loop.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
)

Static analysis flagged that we did not make const a item declaration
b/c we did not modify it all during the loop.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
)

Static analysis flagged that we did not make const a item declaration
b/c we did not modify it all during the loop.
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
)

Static analysis flagged that we did not make const a item declaration
b/c we did not modify it all during the loop.
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.

3 participants