[PATCH] D123574: [clang] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 01:28:11 PDT 2022


jansvoboda11 marked 3 inline comments as done.
jansvoboda11 added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/ParsedASTTests.cpp:564-565
   IncludeStructure Includes = ExpectedAST.getIncludeStructure();
-  auto MainFE = FM.getFile(testPath("foo.cpp"));
+  auto MainFE = FM.getOptionalFileRef(testPath("foo.cpp"));
   ASSERT_TRUE(MainFE);
   auto MainID = Includes.getOrCreateID(*MainFE);
----------------
dexonsmith wrote:
> It might be nice to see the errors here on failures. You could do that with:
> ```
> lang=c++
> Optional<FileEntryRef> MainFE;
> ASSERT_THAT_ERROR(FM.getFileRef(testPath("foo.cpp")).moveInto(MainFE), Succeeded());
> ```
> The `{EXPECT,ASSERT}_THAT_ERROR` live in `llvm/Testing/Support/Error.h`.
That's pretty sweet, thanks for the suggestion!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123574



More information about the cfe-commits mailing list