[clang-tools-extra] c3682a2 - [clangd] Enable relative configs in check mode

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 30 05:29:32 PDT 2021


Author: Kadir Cetinkaya
Date: 2021-07-30T14:23:48+02:00
New Revision: c3682a22c227652558764c67a2529399c59e58e6

URL: https://github.com/llvm/llvm-project/commit/c3682a22c227652558764c67a2529399c59e58e6
DIFF: https://github.com/llvm/llvm-project/commit/c3682a22c227652558764c67a2529399c59e58e6.diff

LOG: [clangd] Enable relative configs in check mode

See https://github.com/clangd/clangd/issues/649#issuecomment-885903316.
Also disables config support in lit tests to make sure tests are not affected by
clangd config files lying around.

Differential Revision: https://reviews.llvm.org/D107130

Added: 
    

Modified: 
    clang-tools-extra/clangd/test/check-fail.test
    clang-tools-extra/clangd/test/check-lines.test
    clang-tools-extra/clangd/test/check.test
    clang-tools-extra/clangd/tool/Check.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/test/check-fail.test b/clang-tools-extra/clangd/test/check-fail.test
index dd50b59b2c790..5a370b4653b1c 100644
--- a/clang-tools-extra/clangd/test/check-fail.test
+++ b/clang-tools-extra/clangd/test/check-fail.test
@@ -1,5 +1,5 @@
 // RUN: cp %s %t.cpp
-// RUN: not clangd -check=%t.cpp 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not clangd -enable-config=0 -check=%t.cpp 2>&1 | FileCheck -strict-whitespace %s
 
 // CHECK: Testing on source file {{.*}}check-fail.test
 // CHECK: internal (cc1) args are: -cc1

diff  --git a/clang-tools-extra/clangd/test/check-lines.test b/clang-tools-extra/clangd/test/check-lines.test
index bfd30dd6104ff..4e8509869d8f9 100644
--- a/clang-tools-extra/clangd/test/check-lines.test
+++ b/clang-tools-extra/clangd/test/check-lines.test
@@ -1,6 +1,6 @@
 // RUN: cp %s %t.cpp
-// RUN: not clangd -check=%t.cpp -check-lines=6-14 2>&1 | FileCheck -strict-whitespace %s
-// RUN: not clangd -check=%t.cpp -check-lines=14 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not clangd -enable-config=0 -check=%t.cpp -check-lines=6-14 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not clangd -enable-config=0 -check=%t.cpp -check-lines=14 2>&1 | FileCheck -strict-whitespace %s
 
 // CHECK: Testing on source file {{.*}}check-lines.test
 // CHECK: internal (cc1) args are: -cc1

diff  --git a/clang-tools-extra/clangd/test/check.test b/clang-tools-extra/clangd/test/check.test
index d83562c4dcf00..280e01ef0a044 100644
--- a/clang-tools-extra/clangd/test/check.test
+++ b/clang-tools-extra/clangd/test/check.test
@@ -1,5 +1,5 @@
 // RUN: cp %s %t.cpp
-// RUN: clangd -log=verbose -check=%t.cpp 2>&1 | FileCheck -strict-whitespace %s
+// RUN: clangd -enable-config=0 -log=verbose -check=%t.cpp 2>&1 | FileCheck -strict-whitespace %s
 
 // CHECK: Testing on source file
 // CHECK: internal (cc1) args are: -cc1

diff  --git a/clang-tools-extra/clangd/tool/Check.cpp b/clang-tools-extra/clangd/tool/Check.cpp
index 88eb945d20d43..6672b7d968de8 100644
--- a/clang-tools-extra/clangd/tool/Check.cpp
+++ b/clang-tools-extra/clangd/tool/Check.cpp
@@ -272,7 +272,10 @@ bool check(llvm::StringRef File,
 
   auto ContextProvider = ClangdServer::createConfiguredContextProvider(
       Opts.ConfigProvider, nullptr);
-  WithContext Ctx(ContextProvider(""));
+  WithContext Ctx(ContextProvider(
+      FakeFile.empty()
+          ? File
+          : /*Don't turn on local configs for an arbitrary temp path.*/ ""));
   Checker C(File, Opts);
   if (!C.buildCommand(TFS) || !C.buildInvocation(TFS, Contents) ||
       !C.buildAST())


        


More information about the cfe-commits mailing list