Golevka / emacs-clang-complete-async

An emacs plugin to complete C and C++ code using libclang
360 stars 71 forks source link

Read cflags from ini-style file #35

Open kschn opened 11 years ago

kschn commented 11 years ago

With my patch cflags can be read from an ini styled file.

The format of the file looks like this:

[<path/to/project>] -I -D ...

The file is read every time a new clang-complete process is created. This way one can update the cflags file and the changes will be applied as soon a file is newly opened. The paths to the include directories are expanded relative to the path within the brackets, if they are relative. None, one or more sections my apply to a single source file if the paths within the braces lay in the path of the current source file:

source file: ~/src/myproj/subdir/module.cpp

cflags-file:

[~] ...

[~/src/myproj] ...

[~/src/myproj/subdir] ...

[~/src/otherproj] ...

If the file ~/src/myproj/subdir/module.cpp is visited the flags from the sections [~], [~/src/myproj] and [~/src/myproj/subdir] are applied to this file.

The file, which is used to fill the cflags variable, can be customized by setting the variable ac-clang-cflags-file.

zougloub commented 10 years ago

Hi, take a look at http://clang.llvm.org/docs/JSONCompilationDatabase.html and you could submit a much more useful patch. Note that CMake and waf can generate the clang compilation database.