Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation flags are parsed incorrectly unless the input files appears as the last argument #6

Open
petersohn opened this issue May 11, 2015 · 0 comments

Comments

@petersohn
Copy link
Contributor

If I have the following entry in compile_commands.json, everything works fine:

{
    "directory": "/home/peet/workspace/sokoban2/src",
    "command": "clang++ '-std=c++14' '-Wall' '-Wextra' '-Werror' '-ftemplate-backtrace-limit=0' '-I../src' '-I../cpp-util/include' '-c' '-o' 'AdvancedHeurCalculator.o' 'AdvancedHeurCalculator.cpp'",
    "file": "/home/peet/workspace/sokoban2/src/AdvancedHeurCalculator.cpp"
}

With no additional flags from ycm_jsondb_config.py, I have the following flags derived for this file:

['-std=c++14', '-Wall', '-Wextra', '-Werror', '-ftemplate-backtrace-limit=0', '-I/home/peet/workspace/sokoban2/src/../src', '-I/home/peet/workspace/sokoban2/src/../cpp-util/include', '-isystem', '/home/peet/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes']

However, if the input file name appears before the -o option, like this:

{
    "directory": "/home/peet/workspace/sokoban2/src",
    "command": "clang++ '-std=c++14' '-Wall' '-Wextra' '-Werror' '-ftemplate-backtrace-limit=0' '-I../src' '-I../cpp-util/include' '-c' 'AdvancedHeurCalculator.cpp' '-o' 'AdvancedHeurCalculator.o'",
    "file": "/home/peet/workspace/sokoban2/src/AdvancedHeurCalculator.cpp"
}

Then the flags are derived wrong and YCM doesn't work. The flags derived in this case are the following:

['-std=c++14', '-Wall', '-Wextra', '-Werror', '-ftemplate-backtrace-limit=0', '-I/home/peet/workspace/sokoban2/src/../src', '-I/home/peet/workspace/sokoban2/src/../cpp-util/include', 'AdvancedHeurCalculator.cpp', '-isystem', '/home/peet/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes']

If I try to use the YCM features, it simply won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant