[PATCH] D137698: [include-cleaner] Add self-contained file support for PragmaIncludes.
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 18 04:23:32 PST 2022
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.
thanks, lgtm!
================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:47
+ }
+ void buildAST() { AST = std::make_unique<TestAST>(Inputs); }
+
----------------
nit: i'd actually rename this to `astWithIncludes` and take in a set of filenames, then set up `Inputs.Code` here, eg:
```
astWithIncludes({"foo.h", "bar.h"}); -> Inputs.Code = `#include "foo.h"\n#include "bar.h"`; AST = TestAST(Inputs);
```
================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:100
+ UnorderedElementsAre(physicalHeader("normal.h")));
+}
+
----------------
also we should assert that there's nothing funky going on with `exporter.h` itself
================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:128
+ buildAST();
+ // There is a IWYU priviate mapping in the non self-contained header, verify
+ // that we don't emit its includer.
----------------
s/priviate/private
================
Comment at: clang-tools-extra/include-cleaner/unittests/RecordTest.cpp:400
+ Inputs.ExtraFiles["guarded.h"] = R"cpp(
+ #ifndef HEADER_H
+ #define HEADER_H
----------------
nit: might be easier to just have `#pragma once`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137698/new/
https://reviews.llvm.org/D137698
More information about the cfe-commits
mailing list