[PATCH] D138797: [include-cleaner] Implement IWYU begin_keep/end_keep pragma support.
Viktoriia Bakalova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 28 08:38:36 PST 2022
VitaNuo marked an inline comment as done.
VitaNuo added inline comments.
================
Comment at: clang-tools-extra/include-cleaner/unittests/RecordTest.cpp:349
EXPECT_TRUE(PI.shouldKeep(3));
+ EXPECT_FALSE(PI.shouldKeep(13));
+ EXPECT_TRUE(PI.shouldKeep(14));
----------------
hokein wrote:
> with more tests being added, these line-number-inlined tests now are hard to follow, even with the line comment in the example.
>
> I think we can polish these tests by using the annotation point `^`, something like.
> ```
> llvm::Annotation Code = R"cpp(
> $keep1^#include "keep1.h" // IWYU pragma: keep
>
> $normal^%include "normal.h"
> )cpp";
>
> EXPECT_TRUE(PI.shouldKeep(offsetToLine(Code.point("keep1"))));
> EXPECT_FALSE(PI.shouldKeep(offsetToLine(Code.point("normal"))));
> ```
>
> We need to implement an `offsetToLine` function, it should be trivial to add (basically calculate the number of `\n`s to the offset point).
Ok, thanks. Have a look now please.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138797/new/
https://reviews.llvm.org/D138797
More information about the cfe-commits
mailing list