[llvm-branch-commits] [clang-tools-extra] 52f2d6d - [clangd] Disable all dependency outputs
Sam McCall via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 10 03:07:55 PDT 2020
Author: Kadir Cetinkaya
Date: 2020-06-10T12:00:38+02:00
New Revision: 52f2d6d4b20dbc4c72f87c27e6e7375496fe0e38
URL: https://github.com/llvm/llvm-project/commit/52f2d6d4b20dbc4c72f87c27e6e7375496fe0e38
DIFF: https://github.com/llvm/llvm-project/commit/52f2d6d4b20dbc4c72f87c27e6e7375496fe0e38.diff
LOG: [clangd] Disable all dependency outputs
Summary: Fixes https://github.com/clangd/clangd/issues/322
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78833
(cherry picked from commit 294b9d43cae77ea15453ec82203368903db4f538)
Fixes https://github.com/clangd/clangd/issues/422
Added:
clang-tools-extra/clangd/test/dependency-output.test
Modified:
clang-tools-extra/clangd/Compiler.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp
index eae753b5c9b3..47cec5ae12e8 100644
--- a/clang-tools-extra/clangd/Compiler.cpp
+++ b/clang-tools-extra/clangd/Compiler.cpp
@@ -65,6 +65,15 @@ buildCompilerInvocation(const ParseInputs &Inputs,
CI->getFrontendOpts().DisableFree = false;
CI->getLangOpts()->CommentOpts.ParseAllComments = true;
CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
+
+ // Disable any dependency outputting, we don't want to generate files or write
+ // to stdout/stderr.
+ CI->getDependencyOutputOpts().ShowIncludesDest =
+ ShowIncludesDestination::None;
+ CI->getDependencyOutputOpts().OutputFile.clear();
+ CI->getDependencyOutputOpts().HeaderIncludeOutputFile.clear();
+ CI->getDependencyOutputOpts().DOTOutputFile.clear();
+ CI->getDependencyOutputOpts().ModuleDependencyOutputDir.clear();
return CI;
}
diff --git a/clang-tools-extra/clangd/test/dependency-output.test b/clang-tools-extra/clangd/test/dependency-output.test
new file mode 100644
index 000000000000..10b493d6611d
--- /dev/null
+++ b/clang-tools-extra/clangd/test/dependency-output.test
@@ -0,0 +1,12 @@
+# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+---
+{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"/clangd-test/foo.c":
+{"workingDirectory":"/clangd-test", "compilationCommand": ["clang", "-c", "-Xclang", "--show-includes", "-Xclang", "-sys-header-deps", "foo.c"]}}}}}
+---
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"cpp","version":1,"text":"int a;\n#include <stddef.h>"}}}
+#CHECK-NOT: Note: including file
+---
+{"jsonrpc":"2.0","id":3,"method":"shutdown"}
+---
+{"jsonrpc":"2.0","method":"exit"}
More information about the llvm-branch-commits
mailing list