Autocompletion from stdin with clang

一笑奈何 提交于 2019-12-10 16:44:57

问题


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 -Iinclude/ -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?


回答1:


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



来源:https://stackoverflow.com/questions/6646643/autocompletion-from-stdin-with-clang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!