开发者

Autocompletion from stdin with clang

I have set up an environment for autocompletion in Emacs, using clang 2.8 as the parser. It works well, but relies on saving the currently edited buffer to file before completion. This is slow, so I am trying to get clang to parse a file given to it via stdin instead, without luck so far.

The command line I feed clang when parsing a file is as follows:

clang -cc1 -fsyntax-only -Iin开发者_StackOverflowclude/ -code-completion-at foo.cpp:10:20 foo.cpp

This works well. But attempts to read from stdin fail. I've tried this:

cat foo.cpp | clang -xc++ -cc1 -fsyntax-only -Iinclude/ -code-completion-at -:10:20 -

But that makes clang terminate without making any completions and prints the warnings:

clang: warning: argument unused during compilation: '-cc1'
clang: warning: argument unused during compilation: '-code-completion-at'
clang: warning: argument unused during compilation: '-:10:20'

Any ideas?


Does it work if you specify -cc1 before -x c++?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜