[clang] b1a25ce - [Sema] Remove unnecessary casts (NFC) (#148762)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 14 22:18:40 PDT 2025


Author: Kazu Hirata
Date: 2025-07-14T22:18:37-07:00
New Revision: b1a25ce73c6a4fd123b92682e465215d39154244

URL: https://github.com/llvm/llvm-project/commit/b1a25ce73c6a4fd123b92682e465215d39154244
DIFF: https://github.com/llvm/llvm-project/commit/b1a25ce73c6a4fd123b92682e465215d39154244.diff

LOG: [Sema] Remove unnecessary casts (NFC) (#148762)

getAsmLabel() already returns Expr *.

Added: 
    

Modified: 
    clang/lib/Sema/SemaDecl.cpp

Removed: 
    


################################################################################
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(),


        


More information about the cfe-commits mailing list