[clang] [Index] Remove an unnecessary cast (NFC) (PR #146944)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 3 12:30:11 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

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
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;

``````````

</details>


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


More information about the cfe-commits mailing list