[PATCH] D78833: [clangd] Disable all dependency outputs
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 24 15:12:12 PDT 2020
kadircet created this revision.
kadircet added a reviewer: sammccall.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.
Fixes https://github.com/clangd/clangd/issues/322
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78833
Files:
clang-tools-extra/clangd/Compiler.cpp
clang-tools-extra/clangd/test/dependency-output.test
Index: clang-tools-extra/clangd/test/dependency-output.test
===================================================================
--- /dev/null
+++ 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"}
Index: clang-tools-extra/clangd/Compiler.cpp
===================================================================
--- clang-tools-extra/clangd/Compiler.cpp
+++ clang-tools-extra/clangd/Compiler.cpp
@@ -65,6 +65,15 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78833.260002.patch
Type: text/x-patch
Size: 1840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200424/db4383a0/attachment.bin>
More information about the cfe-commits
mailing list