https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/148762
getAsmLabel() already returns Expr *. >From d39e906124798e0cc790f5ef1aed131247341b4f Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Sun, 13 Jul 2025 13:26:35 -0700 Subject: [PATCH] [Sema] Remove unnecessary casts (NFC) getAsmLabel() already returns Expr *. --- clang/lib/Sema/SemaDecl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(), _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits