This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG68fe0674187d: [clangd] Disable backend-releated filelist 
compiler options. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140960

Files:
  clang-tools-extra/clangd/Compiler.cpp
  clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp


Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -824,6 +824,19 @@
   EXPECT_THAT(*TU.build().getDiagnostics(), IsEmpty());
 }
 
+TEST(DiagnosticTest, IgnoreBEFilelistOptions) {
+  auto TU = TestTU::withCode("");
+  TU.ExtraArgs.push_back("-Xclang");
+  for (const auto *DisableOption :
+       {"-fsanitize-ignorelist=null", "-fprofile-list=null",
+        "-fxray-always-instrument=null", "-fxray-never-instrument=null",
+        "-fxray-attr-list=null"}) {
+    TU.ExtraArgs.push_back(DisableOption);
+    EXPECT_THAT(*TU.build().getDiagnostics(), IsEmpty());
+    TU.ExtraArgs.pop_back();
+  }
+}
+
 // Recursive main-file include is diagnosed, and doesn't crash.
 TEST(DiagnosticsTest, RecursivePreamble) {
   auto TU = TestTU::withCode(R"cpp(
Index: clang-tools-extra/clangd/Compiler.cpp
===================================================================
--- clang-tools-extra/clangd/Compiler.cpp
+++ clang-tools-extra/clangd/Compiler.cpp
@@ -80,6 +80,15 @@
   CI.getFrontendOpts().PluginArgs.clear();
   CI.getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
   CI.getFrontendOpts().ActionName.clear();
+
+  // These options mostly affect codegen, and aren't relevant to clangd. And
+  // clang will die immediately when these files are not existed.
+  // Disable these uninteresting options to make clangd more robust.
+  CI.getLangOpts()->NoSanitizeFiles.clear();
+  CI.getLangOpts()->XRayAttrListFiles.clear();
+  CI.getLangOpts()->ProfileListFiles.clear();
+  CI.getLangOpts()->XRayAlwaysInstrumentFiles.clear();
+  CI.getLangOpts()->XRayNeverInstrumentFiles.clear();
 }
 
 std::unique_ptr<CompilerInvocation>


Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -824,6 +824,19 @@
   EXPECT_THAT(*TU.build().getDiagnostics(), IsEmpty());
 }
 
+TEST(DiagnosticTest, IgnoreBEFilelistOptions) {
+  auto TU = TestTU::withCode("");
+  TU.ExtraArgs.push_back("-Xclang");
+  for (const auto *DisableOption :
+       {"-fsanitize-ignorelist=null", "-fprofile-list=null",
+        "-fxray-always-instrument=null", "-fxray-never-instrument=null",
+        "-fxray-attr-list=null"}) {
+    TU.ExtraArgs.push_back(DisableOption);
+    EXPECT_THAT(*TU.build().getDiagnostics(), IsEmpty());
+    TU.ExtraArgs.pop_back();
+  }
+}
+
 // Recursive main-file include is diagnosed, and doesn't crash.
 TEST(DiagnosticsTest, RecursivePreamble) {
   auto TU = TestTU::withCode(R"cpp(
Index: clang-tools-extra/clangd/Compiler.cpp
===================================================================
--- clang-tools-extra/clangd/Compiler.cpp
+++ clang-tools-extra/clangd/Compiler.cpp
@@ -80,6 +80,15 @@
   CI.getFrontendOpts().PluginArgs.clear();
   CI.getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly;
   CI.getFrontendOpts().ActionName.clear();
+
+  // These options mostly affect codegen, and aren't relevant to clangd. And
+  // clang will die immediately when these files are not existed.
+  // Disable these uninteresting options to make clangd more robust.
+  CI.getLangOpts()->NoSanitizeFiles.clear();
+  CI.getLangOpts()->XRayAttrListFiles.clear();
+  CI.getLangOpts()->ProfileListFiles.clear();
+  CI.getLangOpts()->XRayAlwaysInstrumentFiles.clear();
+  CI.getLangOpts()->XRayNeverInstrumentFiles.clear();
 }
 
 std::unique_ptr<CompilerInvocation>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to