[clang] [Sema] Remove unnecessary casts (NFC) (PR #148762)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 14 19:47:45 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
getAsmLabel() already returns Expr *.
---
Full diff: https://github.com/llvm/llvm-project/pull/148762.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaDecl.cpp (+2-2)
``````````diff
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d7234e269f645..14403e65e8f42 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -8059,7 +8059,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
NewVD->setInvalidDecl();
// Handle GNU asm-label extension (encoded as an attribute).
- if (Expr *E = (Expr*)D.getAsmLabel()) {
+ if (Expr *E = D.getAsmLabel()) {
// The parser guarantees this is a string.
StringLiteral *SE = cast<StringLiteral>(E);
StringRef Label = SE->getString();
@@ -10333,7 +10333,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
isFunctionTemplateSpecialization);
// Handle GNU asm-label extension (encoded as an attribute).
- if (Expr *E = (Expr*) D.getAsmLabel()) {
+ if (Expr *E = D.getAsmLabel()) {
// The parser guarantees this is a string.
StringLiteral *SE = cast<StringLiteral>(E);
NewFD->addAttr(AsmLabelAttr::Create(Context, SE->getString(),
``````````
</details>
https://github.com/llvm/llvm-project/pull/148762
More information about the cfe-commits
mailing list