[PATCH] D143095: [clangd] Respect preamble-patch when handling diags

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 8 01:07:25 PST 2023


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:102
+  auto PatchedRange = [&M](CharSourceRange &R) {
+    // FIXME: Should we handle all presumed locations?
+    R.setBegin(translatePreamblePatchLocation(R.getBegin(), M));
----------------
I think we answered this in the negative?


================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:715
 
-    D.InsideMainFile = isInsideMainFile(Info);
+    auto PLoc = translatePreamblePatchLocation(Info.getLocation(), SM);
+    D.InsideMainFile = isInsideMainFile(PLoc, SM);
----------------
PLoc is a confusing name for something that interacts with but is not a PresumedLoc

I'd prefer avoiding auto here, too


================
Comment at: clang-tools-extra/clangd/SourceCode.cpp:1225
+  // Checks whether \p FileName is a valid spelling of main file.
+  auto IsMainFile = [](llvm::StringRef FileName, const SourceManager &SM) {
+    auto FE = SM.getFileManager().getFile(FileName);
----------------
just make it a function? it captures nothing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143095



More information about the cfe-commits mailing list