[PATCH] D139716: [include-cleaner] Use expansion locations for macros.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 19 06:08:01 PST 2022


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

Thanks!



================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:176
+    llvm::StringRef DeclareHeader;
+    llvm::StringRef MacroHeader;
+  } TestCases[] = {{
----------------
nit: it feels more natural to declare `MacroHeader` first then `DeclareHeader`, as the `DeclareHeader` already includes the macro.h


================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:177
+    llvm::StringRef MacroHeader;
+  } TestCases[] = {{
+                       R"cpp(
----------------
The clang-format's indentation seems odd to me, I think if you put a trailing `,` on the last element `}, };`, its format is better.




================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:178
+  } TestCases[] = {{
+                       R"cpp(
+    #include "macro.h"
----------------
nit: I'd add `/*DeclareHeader=*/`, `/*MacroHeader=*/`, which improves the code readability.


================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:212
+    llvm::SmallVector<Header> Headers = clang::include_cleaner::findHeaders(
+        Visitor.Out->getLocation(), AST->sourceManager(), nullptr);
+    EXPECT_THAT(Headers, UnorderedElementsAre(physicalHeader("declare.h")));
----------------
nit: /*PragmaIncludes=*/nullptr


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139716



More information about the cfe-commits mailing list