[PATCH] D90528: [clangd] Fix check-clangd with no clang built

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 12:10:58 PST 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc29513f7e023: [clangd] Fix check-clangd with no clang built (authored by sammccall).

Changed prior to commit:
  https://reviews.llvm.org/D90528?vs=302084&id=302362#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90528

Files:
  clang-tools-extra/clangd/test/document-link.test
  clang-tools-extra/clangd/test/lit.cfg.py
  llvm/utils/lit/lit/llvm/config.py


Index: llvm/utils/lit/lit/llvm/config.py
===================================================================
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -396,11 +396,6 @@
 
         self.with_environment('LD_LIBRARY_PATH', paths, append_path=True)
 
-        # Discover the 'clang' and 'clangcc' to use.
-
-        self.config.clang = self.use_llvm_tool(
-            'clang', search_env='CLANG', required=required)
-
         shl = getattr(self.config, 'llvm_shlib_dir', None)
         pext = getattr(self.config, 'llvm_plugin_ext', None)
         if shl:
@@ -408,23 +403,28 @@
         if pext:
             self.config.substitutions.append(('%pluginext', pext))
 
-        builtin_include_dir = self.get_clang_builtin_include_dir(self.config.clang)
-        tool_substitutions = [
-            ToolSubst('%clang', command=self.config.clang, extra_args=additional_flags),
-            ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze', '-setup-static-analyzer']+additional_flags),
-            ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']+additional_flags),
-            ToolSubst('%clang_cpp', command=self.config.clang, extra_args=['--driver-mode=cpp']+additional_flags),
-            ToolSubst('%clang_cl', command=self.config.clang, extra_args=['--driver-mode=cl']+additional_flags),
-            ToolSubst('%clangxx', command=self.config.clang, extra_args=['--driver-mode=g++']+additional_flags),
-            ]
-        self.add_tool_substitutions(tool_substitutions)
+        # Discover the 'clang' and 'clangcc' to use.
+        self.config.clang = self.use_llvm_tool(
+            'clang', search_env='CLANG', required=required)
+        if self.config.clang:
+          self.config.available_features.add('clang')
+          builtin_include_dir = self.get_clang_builtin_include_dir(self.config.clang)
+          tool_substitutions = [
+              ToolSubst('%clang', command=self.config.clang, extra_args=additional_flags),
+              ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze', '-setup-static-analyzer']+additional_flags),
+              ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']+additional_flags),
+              ToolSubst('%clang_cpp', command=self.config.clang, extra_args=['--driver-mode=cpp']+additional_flags),
+              ToolSubst('%clang_cl', command=self.config.clang, extra_args=['--driver-mode=cl']+additional_flags),
+              ToolSubst('%clangxx', command=self.config.clang, extra_args=['--driver-mode=g++']+additional_flags),
+              ]
+          self.add_tool_substitutions(tool_substitutions)
+          self.config.substitutions.append(
+              ('%resource_dir', builtin_include_dir))
 
         self.config.substitutions.append(('%itanium_abi_triple',
                                           self.make_itanium_abi_triple(self.config.target_triple)))
         self.config.substitutions.append(('%ms_abi_triple',
                                           self.make_msabi_triple(self.config.target_triple)))
-        self.config.substitutions.append(
-            ('%resource_dir', builtin_include_dir))
 
         # The host triple might not be set, at least if we're compiling clang from
         # an already installed llvm.
Index: clang-tools-extra/clangd/test/lit.cfg.py
===================================================================
--- clang-tools-extra/clangd/test/lit.cfg.py
+++ clang-tools-extra/clangd/test/lit.cfg.py
@@ -1,7 +1,7 @@
 import lit.llvm
 
 lit.llvm.initialize(lit_config, config)
-lit.llvm.llvm_config.use_clang()
+lit.llvm.llvm_config.use_clang([], [], required=False)
 lit.llvm.llvm_config.use_default_substitutions()
 
 config.name = 'Clangd'
Index: clang-tools-extra/clangd/test/document-link.test
===================================================================
--- clang-tools-extra/clangd/test/document-link.test
+++ clang-tools-extra/clangd/test/document-link.test
@@ -1,3 +1,4 @@
+# for %resource_dir: REQUIRES: clang
 # %resource_dir actually points at builtin_include_dir, go up one directory.
 # RUN: clangd -lit-test -resource-dir=%resource_dir/.. < %s | FileCheck -strict-whitespace %s
 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90528.302362.patch
Type: text/x-patch
Size: 4519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201102/be803295/attachment-0001.bin>


More information about the cfe-commits mailing list