Skip to content

Commit

Permalink
[clang] Fix two gcc warnings about unused variables [NFC]
Browse files Browse the repository at this point in the history
Without the fix gcc warns like
 ../../clang/lib/Sema/SemaDecl.cpp:2963:24: warning: unused variable 'SupA' [-Wunused-variable]
  2963 |   else if (const auto *SupA = dyn_cast<SuppressAttr>(Attr))
       |                        ^~~~
and
 ../../clang/lib/Driver/Driver.cpp:4192:17: warning: unused variable 'IAA' [-Wunused-variable]
  4192 |       if (auto *IAA = dyn_cast<InstallAPIJobAction>(Current)) {
       |                 ^~~

Remove the unused variables and change the "dyn_cast"s into "isa"s.
  • Loading branch information
mikaelholmen committed Feb 15, 2024
1 parent cd55e23 commit 4a32a41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4189,7 +4189,7 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
break;
}

if (auto *IAA = dyn_cast<InstallAPIJobAction>(Current)) {
if (isa<InstallAPIJobAction>(Current)) {
Current = nullptr;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2960,7 +2960,7 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D,
S.mergeHLSLNumThreadsAttr(D, *NT, NT->getX(), NT->getY(), NT->getZ());
else if (const auto *SA = dyn_cast<HLSLShaderAttr>(Attr))
NewAttr = S.mergeHLSLShaderAttr(D, *SA, SA->getType());
else if (const auto *SupA = dyn_cast<SuppressAttr>(Attr))
else if (isa<SuppressAttr>(Attr))
// Do nothing. Each redeclaration should be suppressed separately.
NewAttr = nullptr;
else if (Attr->shouldInheritEvenIfAlreadyPresent() || !DeclHasAttr(D, Attr))
Expand Down

0 comments on commit 4a32a41

Please sign in to comment.