[PATCH] D146904: [clang-tidy] Fix extern fixes in readability-redundant-declaration

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 8 09:22:21 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantDeclarationCheck.cpp:86
+              Result.Nodes.getNodeAs<LinkageSpecDecl>("extern");
+          Extern && !Extern->hasBraces())
+        BeginLoc = Extern->getExternLoc();
----------------
carlosgalvezp wrote:
> This can be removed, leaving it as:
> 
> ```
> if (const auto *Extern = ... && !Extern->hasBraces())
> ```
If you mean:
```
 if (const auto *Extern =
              Result.Nodes.getNodeAs<LinkageSpecDecl>("extern");
          !Extern->hasBraces())
````

then no, it cannot be like this because Extern can be null.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146904/new/

https://reviews.llvm.org/D146904



More information about the cfe-commits mailing list