[clang] e6bd983 - [clang][CodeGen] Fix gcc warning about unused variable [NFC]
Mikael Holmen via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 17 04:23:30 PST 2024
Author: Mikael Holmen
Date: 2024-01-17T13:23:08+01:00
New Revision: e6bd9835d90c8c30ceeb05338e80d75cf41a3b84
URL: https://github.com/llvm/llvm-project/commit/e6bd9835d90c8c30ceeb05338e80d75cf41a3b84
DIFF: https://github.com/llvm/llvm-project/commit/e6bd9835d90c8c30ceeb05338e80d75cf41a3b84.diff
LOG: [clang][CodeGen] Fix gcc warning about unused variable [NFC]
Without the fix gcc warned with
../../clang/lib/CodeGen/CGBuiltin.cpp:1022:19: warning: unused variable 'DRE' [-Wunused-variable]
1022 | if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
| ^~~
Fix the warning by removing the unused variable and change the "dyn_cast"
to "isa".
Added:
Modified:
clang/lib/CodeGen/CGBuiltin.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index de48b15645b1ab..f4246c5e8f68e8 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1019,7 +1019,7 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
FAMSize = Builder.CreateIntCast(FAMSize, ResType, IsSigned);
Value *Res = FAMSize;
- if (const auto *DRE = dyn_cast<DeclRefExpr>(Base)) {
+ if (isa<DeclRefExpr>(Base)) {
// The whole struct is specificed in the __bdos.
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(OuterRD);
More information about the cfe-commits
mailing list