[PATCH] D147194: [clang-tidy] fix concat-nest-namespace fix hint remove the macro

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 2 09:03:55 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp:69
+  }
+  SourceRange{ND->getBeginLoc(), Tok->getEndLoc()}.dump(SM);
+  return SourceRange{ND->getBeginLoc(), Tok->getEndLoc()};
----------------
Remove this debug.


================
Comment at: clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp:88
+  StringRef TokText = getRawStringRef(TokRange, SM, LangOpts);
+  if (TokText != "// namespace " + ND->getNameAsString())
+    return DefaultSourceRange;
----------------
what if it is //namespace ? or /* namespace XYZ */


================
Comment at: clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp:125
+
+  for (size_t Index = 0; Index < Namespaces.size(); Index++) {
+    if (Namespaces[Index]->isNested()) {
----------------
remove redundant {} from this function, they not needed for single line statements. 


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/concat-nested-namespaces.cpp:172
+// CHECK-FIXES: #undef N43_INNER
+
 int main() {
----------------
add same test but without spaces and move //CHECK-MESSAGES outside namespace. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147194



More information about the cfe-commits mailing list