| 1 | //===-- HeadersTests.cpp - Include headers unit tests -----------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "Headers.h" |
| 10 | |
| 11 | #include "Compiler.h" |
| 12 | #include "Matchers.h" |
| 13 | #include "TestFS.h" |
| 14 | #include "TestTU.h" |
| 15 | #include "clang/Basic/TokenKinds.h" |
| 16 | #include "clang/Frontend/CompilerInstance.h" |
| 17 | #include "clang/Frontend/CompilerInvocation.h" |
| 18 | #include "clang/Frontend/FrontendActions.h" |
| 19 | #include "clang/Tooling/Inclusions/HeaderIncludes.h" |
| 20 | #include "llvm/ADT/StringRef.h" |
| 21 | #include "llvm/Support/Error.h" |
| 22 | #include "llvm/Support/FormatVariadic.h" |
| 23 | #include "llvm/Support/Path.h" |
| 24 | #include "llvm/Testing/Support/Error.h" |
| 25 | #include "gmock/gmock.h" |
| 26 | #include "gtest/gtest.h" |
| 27 | #include <optional> |
| 28 | |
| 29 | namespace clang { |
| 30 | namespace clangd { |
| 31 | namespace { |
| 32 | |
| 33 | using ::testing::AllOf; |
| 34 | using ::testing::Contains; |
| 35 | using ::testing::ElementsAre; |
| 36 | using ::testing::Eq; |
| 37 | using ::testing::IsEmpty; |
| 38 | using ::testing::Not; |
| 39 | using ::testing::UnorderedElementsAre; |
| 40 | |
| 41 | class HeadersTest : public ::testing::Test { |
| 42 | public: |
| 43 | HeadersTest() { |
| 44 | CDB.ExtraClangFlags = {SearchDirArg.c_str()}; |
| 45 | FS.Files[MainFile] = ""; |
| 46 | // Make sure directory sub/ exists. |
| 47 | FS.Files[testPath("sub/EMPTY")] = ""; |
| 48 | } |
| 49 | |
| 50 | private: |
| 51 | std::unique_ptr<CompilerInstance> setupClang() { |
| 52 | auto Cmd = CDB.getCompileCommand(MainFile); |
| 53 | assert(static_cast<bool>(Cmd)); |
| 54 | |
| 55 | ParseInputs PI; |
| 56 | PI.CompileCommand = *Cmd; |
| 57 | PI.TFS = &FS; |
| 58 | auto CI = buildCompilerInvocation(PI, IgnoreDiags); |
| 59 | EXPECT_TRUE(static_cast<bool>(CI)); |
| 60 | // The diagnostic options must be set before creating a CompilerInstance. |
| 61 | CI->getDiagnosticOpts().IgnoreWarnings = true; |
| 62 | auto VFS = PI.TFS->view(Cmd->Directory); |
| 63 | auto Clang = prepareCompilerInstance( |
| 64 | std::move(CI), /*Preamble=*/nullptr, |
| 65 | llvm::MemoryBuffer::getMemBuffer(FS.Files[MainFile], MainFile), |
| 66 | std::move(VFS), IgnoreDiags); |
| 67 | |
| 68 | EXPECT_FALSE(Clang->getFrontendOpts().Inputs.empty()); |
| 69 | return Clang; |
| 70 | } |
| 71 | |
| 72 | protected: |
| 73 | IncludeStructure::HeaderID getID(StringRef Filename, |
| 74 | IncludeStructure &Includes) { |
| 75 | auto &SM = Clang->getSourceManager(); |
| 76 | auto Entry = SM.getFileManager().getFileRef(Filename); |
| 77 | EXPECT_THAT_EXPECTED(Entry, llvm::Succeeded()); |
| 78 | return Includes.getOrCreateID(*Entry); |
| 79 | } |
| 80 | |
| 81 | IncludeStructure collectIncludes() { |
| 82 | Clang = setupClang(); |
| 83 | PreprocessOnlyAction Action; |
| 84 | EXPECT_TRUE( |
| 85 | Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])); |
| 86 | IncludeStructure Includes; |
| 87 | Includes.collect(*Clang); |
| 88 | EXPECT_FALSE(Action.Execute()); |
| 89 | Action.EndSourceFile(); |
| 90 | return Includes; |
| 91 | } |
| 92 | |
| 93 | // Calculates the include path, or returns "" on error or header should not be |
| 94 | // inserted. |
| 95 | std::string calculate(PathRef Original, PathRef Preferred = "", |
| 96 | const std::vector<Inclusion> &Inclusions = {}) { |
| 97 | Clang = setupClang(); |
| 98 | PreprocessOnlyAction Action; |
| 99 | EXPECT_TRUE( |
| 100 | Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])); |
| 101 | |
| 102 | if (Preferred.empty()) |
| 103 | Preferred = Original; |
| 104 | auto ToHeaderFile = [](llvm::StringRef Header) { |
| 105 | return HeaderFile{std::string(Header), |
| 106 | /*Verbatim=*/!llvm::sys::path::is_absolute(Header)}; |
| 107 | }; |
| 108 | |
| 109 | IncludeInserter Inserter(MainFile, /*Code=*/"", format::getLLVMStyle(), |
| 110 | CDB.getCompileCommand(MainFile)->Directory, |
| 111 | &Clang->getPreprocessor().getHeaderSearchInfo()); |
| 112 | for (const auto &Inc : Inclusions) |
| 113 | Inserter.addExisting(Inc); |
| 114 | auto Inserted = ToHeaderFile(Preferred); |
| 115 | if (!Inserter.shouldInsertInclude(Original, Inserted)) |
| 116 | return ""; |
| 117 | auto Path = Inserter.calculateIncludePath(Inserted, MainFile); |
| 118 | Action.EndSourceFile(); |
| 119 | return Path.value_or(""); |
| 120 | } |
| 121 | |
| 122 | std::optional<TextEdit> insert(llvm::StringRef VerbatimHeader, |
| 123 | tooling::IncludeDirective Directive) { |
| 124 | Clang = setupClang(); |
| 125 | PreprocessOnlyAction Action; |
| 126 | EXPECT_TRUE( |
| 127 | Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])); |
| 128 | |
| 129 | IncludeInserter Inserter(MainFile, /*Code=*/"", format::getLLVMStyle(), |
| 130 | CDB.getCompileCommand(MainFile)->Directory, |
| 131 | &Clang->getPreprocessor().getHeaderSearchInfo()); |
| 132 | auto Edit = Inserter.insert(VerbatimHeader, Directive); |
| 133 | Action.EndSourceFile(); |
| 134 | return Edit; |
| 135 | } |
| 136 | |
| 137 | MockFS FS; |
| 138 | MockCompilationDatabase CDB; |
| 139 | std::string MainFile = testPath("main.cpp"); |
| 140 | std::string Subdir = testPath("sub"); |
| 141 | std::string SearchDirArg = (llvm::Twine("-I") + Subdir).str(); |
| 142 | IgnoringDiagConsumer IgnoreDiags; |
| 143 | std::unique_ptr<CompilerInstance> Clang; |
| 144 | }; |
| 145 | |
| 146 | MATCHER_P(written, Name, "") { return arg.Written == Name; } |
| 147 | MATCHER_P(resolved, Name, "") { return arg.Resolved == Name; } |
| 148 | MATCHER_P(includeLine, N, "") { return arg.HashLine == N; } |
| 149 | MATCHER_P(directive, D, "") { return arg.Directive == D; } |
| 150 | MATCHER_P(hasPragmaKeep, H, "") { return arg.BehindPragmaKeep == H; } |
| 151 | |
| 152 | MATCHER_P2(Distance, File, D, "") { |
| 153 | if (arg.getFirst() != File) |
| 154 | *result_listener << "file =" << static_cast<unsigned>(arg.getFirst()); |
| 155 | if (arg.getSecond() != D) |
| 156 | *result_listener << "distance =" << arg.getSecond(); |
| 157 | return arg.getFirst() == File && arg.getSecond() == D; |
| 158 | } |
| 159 | |
| 160 | TEST_F(HeadersTest, CollectRewrittenAndResolved) { |
| 161 | FS.Files[MainFile] = R"cpp( |
| 162 | #include "sub/bar.h" // not shortest |
| 163 | )cpp"; |
| 164 | std::string BarHeader = testPath("sub/bar.h"); |
| 165 | FS.Files[BarHeader] = ""; |
| 166 | |
| 167 | auto Includes = collectIncludes(); |
| 168 | EXPECT_THAT(Includes.MainFileIncludes, |
| 169 | UnorderedElementsAre( |
| 170 | AllOf(written("\"sub/bar.h\""), resolved(BarHeader)))); |
| 171 | EXPECT_THAT(Includes.includeDepth(getID(MainFile, Includes)), |
| 172 | UnorderedElementsAre(Distance(getID(MainFile, Includes), 0u), |
| 173 | Distance(getID(BarHeader, Includes), 1u))); |
| 174 | } |
| 175 | |
| 176 | TEST_F(HeadersTest, OnlyCollectInclusionsInMain) { |
| 177 | std::string BazHeader = testPath("sub/baz.h"); |
| 178 | FS.Files[BazHeader] = ""; |
| 179 | std::string BarHeader = testPath("sub/bar.h"); |
| 180 | FS.Files[BarHeader] = R"cpp( |
| 181 | #include "baz.h" |
| 182 | )cpp"; |
| 183 | FS.Files[MainFile] = R"cpp( |
| 184 | #include "bar.h" |
| 185 | )cpp"; |
| 186 | auto Includes = collectIncludes(); |
| 187 | EXPECT_THAT( |
| 188 | Includes.MainFileIncludes, |
| 189 | UnorderedElementsAre(AllOf(written("\"bar.h\""), resolved(BarHeader)))); |
| 190 | EXPECT_THAT(Includes.includeDepth(getID(MainFile, Includes)), |
| 191 | UnorderedElementsAre(Distance(getID(MainFile, Includes), 0u), |
| 192 | Distance(getID(BarHeader, Includes), 1u), |
| 193 | Distance(getID(BazHeader, Includes), 2u))); |
| 194 | // includeDepth() also works for non-main files. |
| 195 | EXPECT_THAT(Includes.includeDepth(getID(BarHeader, Includes)), |
| 196 | UnorderedElementsAre(Distance(getID(BarHeader, Includes), 0u), |
| 197 | Distance(getID(BazHeader, Includes), 1u))); |
| 198 | } |
| 199 | |
| 200 | TEST_F(HeadersTest, PreambleIncludesPresentOnce) { |
| 201 | // We use TestTU here, to ensure we use the preamble replay logic. |
| 202 | // We're testing that the logic doesn't crash, and doesn't result in duplicate |
| 203 | // includes. (We'd test more directly, but it's pretty well encapsulated!) |
| 204 | auto TU = TestTU::withCode(R"cpp( |
| 205 | #include "a.h" |
| 206 | |
| 207 | #include "a.h" |
| 208 | void foo(); |
| 209 | #include "a.h" |
| 210 | )cpp"); |
| 211 | TU.HeaderFilename = "a.h"; // suppress "not found". |
| 212 | EXPECT_THAT(TU.build().getIncludeStructure().MainFileIncludes, |
| 213 | ElementsAre(includeLine(1), includeLine(3), includeLine(5))); |
| 214 | } |
| 215 | |
| 216 | TEST_F(HeadersTest, UnResolvedInclusion) { |
| 217 | FS.Files[MainFile] = R"cpp( |
| 218 | #include "foo.h" |
| 219 | )cpp"; |
| 220 | |
| 221 | EXPECT_THAT(collectIncludes().MainFileIncludes, |
| 222 | UnorderedElementsAre(AllOf(written("\"foo.h\""), resolved("")))); |
| 223 | EXPECT_THAT(collectIncludes().IncludeChildren, IsEmpty()); |
| 224 | } |
| 225 | |
| 226 | TEST_F(HeadersTest, IncludedFilesGraph) { |
| 227 | FS.Files[MainFile] = R"cpp( |
| 228 | #include "bar.h" |
| 229 | #include "foo.h" |
| 230 | )cpp"; |
| 231 | std::string BarHeader = testPath("bar.h"); |
| 232 | FS.Files[BarHeader] = ""; |
| 233 | std::string FooHeader = testPath("foo.h"); |
| 234 | FS.Files[FooHeader] = R"cpp( |
| 235 | #include "bar.h" |
| 236 | #include "baz.h" |
| 237 | )cpp"; |
| 238 | std::string BazHeader = testPath("baz.h"); |
| 239 | FS.Files[BazHeader] = ""; |
| 240 | |
| 241 | auto Includes = collectIncludes(); |
| 242 | llvm::DenseMap<IncludeStructure::HeaderID, |
| 243 | SmallVector<IncludeStructure::HeaderID>> |
| 244 | Expected = {{getID(MainFile, Includes), |
| 245 | {getID(BarHeader, Includes), getID(FooHeader, Includes)}}, |
| 246 | {getID(FooHeader, Includes), |
| 247 | {getID(BarHeader, Includes), getID(BazHeader, Includes)}}}; |
| 248 | EXPECT_EQ(Includes.IncludeChildren, Expected); |
| 249 | } |
| 250 | |
| 251 | TEST_F(HeadersTest, IncludeDirective) { |
| 252 | FS.Files[MainFile] = R"cpp( |
| 253 | #include "foo.h" |
| 254 | #import "foo.h" |
| 255 | #include_next "foo.h" |
| 256 | )cpp"; |
| 257 | |
| 258 | // ms-compatibility changes meaning of #import, make sure it is turned off. |
| 259 | CDB.ExtraClangFlags.push_back("-fno-ms-compatibility"); |
| 260 | EXPECT_THAT(collectIncludes().MainFileIncludes, |
| 261 | UnorderedElementsAre(directive(tok::pp_include), |
| 262 | directive(tok::pp_import), |
| 263 | directive(tok::pp_include_next))); |
| 264 | } |
| 265 | |
| 266 | TEST_F(HeadersTest, IWYUPragmaKeep) { |
| 267 | FS.Files[MainFile] = R"cpp( |
| 268 | #include "bar.h" // IWYU pragma: keep |
| 269 | #include "foo.h" |
| 270 | )cpp"; |
| 271 | |
| 272 | EXPECT_THAT( |
| 273 | collectIncludes().MainFileIncludes, |
| 274 | UnorderedElementsAre(AllOf(written("\"foo.h\""), hasPragmaKeep(false)), |
| 275 | AllOf(written("\"bar.h\""), hasPragmaKeep(true)))); |
| 276 | } |
| 277 | |
| 278 | TEST_F(HeadersTest, InsertInclude) { |
| 279 | std::string Path = testPath("sub/bar.h"); |
| 280 | FS.Files[Path] = ""; |
| 281 | EXPECT_EQ(calculate(Path), "\"bar.h\""); |
| 282 | } |
| 283 | |
| 284 | TEST_F(HeadersTest, DoNotInsertIfInSameFile) { |
| 285 | MainFile = testPath("main.h"); |
| 286 | EXPECT_EQ(calculate(MainFile), ""); |
| 287 | } |
| 288 | |
| 289 | TEST_F(HeadersTest, DoNotInsertOffIncludePath) { |
| 290 | MainFile = testPath("sub/main.cpp"); |
| 291 | EXPECT_EQ(calculate(testPath("sub2/main.cpp")), ""); |
| 292 | } |
| 293 | |
| 294 | TEST_F(HeadersTest, ShortenIncludesInSearchPath) { |
| 295 | std::string BarHeader = testPath("sub/bar.h"); |
| 296 | EXPECT_EQ(calculate(BarHeader), "\"bar.h\""); |
| 297 | |
| 298 | SearchDirArg = (llvm::Twine("-I") + Subdir + "/..").str(); |
| 299 | CDB.ExtraClangFlags = {SearchDirArg.c_str()}; |
| 300 | BarHeader = testPath("sub/bar.h"); |
| 301 | EXPECT_EQ(calculate(BarHeader), "\"sub/bar.h\""); |
| 302 | } |
| 303 | |
| 304 | TEST_F(HeadersTest, ShortenedIncludeNotInSearchPath) { |
| 305 | std::string BarHeader = |
| 306 | llvm::sys::path::convert_to_slash(testPath("sub-2/bar.h")); |
| 307 | EXPECT_EQ(calculate(BarHeader, ""), "\"sub-2/bar.h\""); |
| 308 | } |
| 309 | |
| 310 | TEST_F(HeadersTest, PreferredHeader) { |
| 311 | std::string BarHeader = testPath("sub/bar.h"); |
| 312 | EXPECT_EQ(calculate(BarHeader, "<bar>"), "<bar>"); |
| 313 | |
| 314 | std::string BazHeader = testPath("sub/baz.h"); |
| 315 | EXPECT_EQ(calculate(BarHeader, BazHeader), "\"baz.h\""); |
| 316 | } |
| 317 | |
| 318 | TEST_F(HeadersTest, DontInsertDuplicatePreferred) { |
| 319 | Inclusion Inc; |
| 320 | Inc.Written = "\"bar.h\""; |
| 321 | Inc.Resolved = ""; |
| 322 | EXPECT_EQ(calculate(testPath("sub/bar.h"), "\"bar.h\"", {Inc}), ""); |
| 323 | EXPECT_EQ(calculate("\"x.h\"", "\"bar.h\"", {Inc}), ""); |
| 324 | } |
| 325 | |
| 326 | TEST_F(HeadersTest, DontInsertDuplicateResolved) { |
| 327 | Inclusion Inc; |
| 328 | Inc.Written = "fake-bar.h"; |
| 329 | Inc.Resolved = testPath("sub/bar.h"); |
| 330 | EXPECT_EQ(calculate(Inc.Resolved, "", {Inc}), ""); |
| 331 | // Do not insert preferred. |
| 332 | EXPECT_EQ(calculate(Inc.Resolved, "\"BAR.h\"", {Inc}), ""); |
| 333 | } |
| 334 | |
| 335 | TEST_F(HeadersTest, PreferInserted) { |
| 336 | auto Edit = insert("<y>", tooling::IncludeDirective::Include); |
| 337 | ASSERT_TRUE(Edit); |
| 338 | EXPECT_EQ(Edit->newText, "#include <y>\n"); |
| 339 | |
| 340 | Edit = insert("\"header.h\"", tooling::IncludeDirective::Import); |
| 341 | ASSERT_TRUE(Edit); |
| 342 | EXPECT_EQ(Edit->newText, "#import \"header.h\"\n"); |
| 343 | } |
| 344 | |
| 345 | TEST(Headers, NoHeaderSearchInfo) { |
| 346 | std::string MainFile = testPath("main.cpp"); |
| 347 | IncludeInserter Inserter(MainFile, /*Code=*/"", format::getLLVMStyle(), |
| 348 | /*BuildDir=*/"", /*HeaderSearchInfo=*/nullptr); |
| 349 | |
| 350 | auto HeaderPath = testPath("sub/bar.h"); |
| 351 | auto Inserting = HeaderFile{HeaderPath, /*Verbatim=*/false}; |
| 352 | auto Verbatim = HeaderFile{"<x>", /*Verbatim=*/true}; |
| 353 | |
| 354 | EXPECT_EQ(Inserter.calculateIncludePath(Inserting, MainFile), |
| 355 | std::string("\"sub/bar.h\"")); |
| 356 | EXPECT_EQ(Inserter.shouldInsertInclude(HeaderPath, Inserting), false); |
| 357 | |
| 358 | EXPECT_EQ(Inserter.calculateIncludePath(Verbatim, MainFile), |
| 359 | std::string("<x>")); |
| 360 | EXPECT_EQ(Inserter.shouldInsertInclude(HeaderPath, Verbatim), true); |
| 361 | |
| 362 | EXPECT_EQ(Inserter.calculateIncludePath(Inserting, "sub2/main2.cpp"), |
| 363 | std::nullopt); |
| 364 | } |
| 365 | |
| 366 | TEST_F(HeadersTest, PresumedLocations) { |
| 367 | std::string HeaderFile = "__preamble_patch__.h"; |
| 368 | |
| 369 | // Line map inclusion back to main file. |
| 370 | std::string HeaderContents = |
| 371 | llvm::formatv("#line 0 \"{0}\"", llvm::sys::path::filename(MainFile)); |
| 372 | HeaderContents += R"cpp( |
| 373 | #line 3 |
| 374 | #include <a.h>)cpp"; |
| 375 | FS.Files[HeaderFile] = HeaderContents; |
| 376 | |
| 377 | // Including through non-builtin file has no effects. |
| 378 | FS.Files[MainFile] = "#include \"__preamble_patch__.h\"\n\n"; |
| 379 | EXPECT_THAT(collectIncludes().MainFileIncludes, |
| 380 | Not(Contains(written("<a.h>")))); |
| 381 | |
| 382 | // Now include through built-in file. |
| 383 | CDB.ExtraClangFlags = {"-include", testPath(HeaderFile)}; |
| 384 | EXPECT_THAT(collectIncludes().MainFileIncludes, |
| 385 | Contains(AllOf(includeLine(2), written("<a.h>")))); |
| 386 | } |
| 387 | |
| 388 | TEST_F(HeadersTest, SelfContainedHeaders) { |
| 389 | // Including through non-builtin file has no effects. |
| 390 | FS.Files[MainFile] = R"cpp( |
| 391 | #include "includeguarded.h" |
| 392 | #include "nonguarded.h" |
| 393 | #include "pp_depend.h" |
| 394 | #include "pragmaguarded.h" |
| 395 | #include "recursive.h" |
| 396 | )cpp"; |
| 397 | FS.Files["pragmaguarded.h"] = R"cpp( |
| 398 | #pragma once |
| 399 | )cpp"; |
| 400 | FS.Files["includeguarded.h"] = R"cpp( |
| 401 | #ifndef INCLUDE_GUARDED_H |
| 402 | #define INCLUDE_GUARDED_H |
| 403 | void foo(); |
| 404 | #endif // INCLUDE_GUARDED_H |
| 405 | )cpp"; |
| 406 | FS.Files["nonguarded.h"] = R"cpp( |
| 407 | )cpp"; |
| 408 | FS.Files["pp_depend.h"] = R"cpp( |
| 409 | #ifndef REQUIRED_PP_DIRECTIVE |
| 410 | # error You have to have PP directive set to include this one! |
| 411 | #endif |
| 412 | )cpp"; |
| 413 | FS.Files["recursive.h"] = R"cpp( |
| 414 | #ifndef RECURSIVE_H |
| 415 | #define RECURSIVE_H |
| 416 | |
| 417 | #include "recursive.h" |
| 418 | |
| 419 | #endif // RECURSIVE_H |
| 420 | )cpp"; |
| 421 | |
| 422 | auto Includes = collectIncludes(); |
| 423 | EXPECT_TRUE(Includes.isSelfContained(getID("pragmaguarded.h", Includes))); |
| 424 | EXPECT_TRUE(Includes.isSelfContained(getID("includeguarded.h", Includes))); |
| 425 | EXPECT_TRUE(Includes.isSelfContained(getID("recursive.h", Includes))); |
| 426 | EXPECT_FALSE(Includes.isSelfContained(getID("nonguarded.h", Includes))); |
| 427 | EXPECT_FALSE(Includes.isSelfContained(getID("pp_depend.h", Includes))); |
| 428 | } |
| 429 | |
| 430 | TEST_F(HeadersTest, HasIWYUPragmas) { |
| 431 | FS.Files[MainFile] = R"cpp( |
| 432 | #include "export.h" |
| 433 | #include "begin_exports.h" |
| 434 | #include "none.h" |
| 435 | )cpp"; |
| 436 | FS.Files["export.h"] = R"cpp( |
| 437 | #pragma once |
| 438 | #include "none.h" // IWYU pragma: export |
| 439 | )cpp"; |
| 440 | FS.Files["begin_exports.h"] = R"cpp( |
| 441 | #pragma once |
| 442 | // IWYU pragma: begin_exports |
| 443 | #include "none.h" |
| 444 | // IWYU pragma: end_exports |
| 445 | )cpp"; |
| 446 | FS.Files["none.h"] = R"cpp( |
| 447 | #pragma once |
| 448 | // Not a pragma. |
| 449 | )cpp"; |
| 450 | |
| 451 | auto Includes = collectIncludes(); |
| 452 | EXPECT_TRUE(Includes.hasIWYUExport(getID("export.h", Includes))); |
| 453 | EXPECT_TRUE(Includes.hasIWYUExport(getID("begin_exports.h", Includes))); |
| 454 | EXPECT_FALSE(Includes.hasIWYUExport(getID("none.h", Includes))); |
| 455 | } |
| 456 | |
| 457 | } // namespace |
| 458 | } // namespace clangd |
| 459 | } // namespace clang |