[clangd] Add option to skip per-location checks.
authorSam McCall <sam.mccall@gmail.com>
Mon, 21 Nov 2022 15:41:53 +0000 (16:41 +0100)
committerSam McCall <sam.mccall@gmail.com>
Mon, 21 Nov 2022 15:41:53 +0000 (16:41 +0100)
This avoids a slow step after timing tidy checks for https://github.com/clangd/clangd/issues/1337

clang-tools-extra/clangd/tool/Check.cpp

index 9517d74..49dfad9 100644 (file)
@@ -72,6 +72,12 @@ llvm::cl::opt<std::string> CheckFileLines{
         "testing to lines 3 to 7 (inclusive) or --check-lines=5 to restrict "
         "to one line. Default is testing entire file."),
     llvm::cl::init("")};
+llvm::cl::opt<bool> CheckLocations{
+    "check-locations",
+    llvm::cl::desc(
+        "Runs certain features (e.g. hover) at each point in the file. "
+        "Somewhat slow."),
+    llvm::cl::init(true)};
 llvm::cl::opt<bool> CheckCompletion{
     "check-completion",
     llvm::cl::desc("Run code-completion at each point (slow)"),
@@ -455,7 +461,8 @@ bool check(llvm::StringRef File, const ThreadsafeFS &TFS,
     return false;
   C.buildInlayHints(LineRange);
   C.buildSemanticHighlighting(LineRange);
-  C.testLocationFeatures(LineRange);
+  if (CheckLocations)
+    C.testLocationFeatures(LineRange);
 
   log("All checks completed, {0} errors", C.ErrCount);
   return C.ErrCount == 0;