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

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 8 03:34:30 PDT 2023


carlosgalvezp added a comment.

Looks good, thanks for the fix! Do we think it's worth documenting in the Release Notes?



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

```
if (const auto *Extern = ... && !Extern->hasBraces())
```


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp:126
+extern "C" int externX;
+int dumyBegin;extern "C" int externX;int dummyEnd;
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: redundant 'externX' declaration [readability-redundant-declaration]
----------------
Typo: dummy

I don't quite see why these are needed to test the example in PR42068?


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