Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

We don't need to cast twice to the same type.

We don't need to cast twice to the same type.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 3, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

We don't need to cast twice to the same type.


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

1 Files Affected:

  • (modified) clang/lib/Index/IndexBody.cpp (+1-1)
diff --git a/clang/lib/Index/IndexBody.cpp b/clang/lib/Index/IndexBody.cpp
index 98ce6f73ec849..1979117d4695c 100644
--- a/clang/lib/Index/IndexBody.cpp
+++ b/clang/lib/Index/IndexBody.cpp
@@ -69,7 +69,7 @@ class BodyIndexer : public RecursiveASTVisitor<BodyIndexer> {
     while (isa<CastExpr>(*It) || isa<ParenExpr>(*It)) {
       if (auto ICE = dyn_cast<ImplicitCastExpr>(*It)) {
         if (ICE->getCastKind() == CK_LValueToRValue)
-          Roles |= (unsigned)(unsigned)SymbolRole::Read;
+          Roles |= (unsigned)SymbolRole::Read;
       }
       if (It == StmtStack.begin())
         break;

@kazutakahirata kazutakahirata merged commit add2c58 into llvm:main Jul 5, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250703_cast_clang_Index branch July 5, 2025 01:39
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