Fix breakage of some compile_commands.json users
Depending on the user, the PrepareClangFlags rewrite of a few commits ago could break users with an extra "clang: 'linker' input not used" (or similar) error message because the compiler executable string was not removed from flags upstream if the user prepended some flags to the output of PrepareClangFlags before returning it to the caller of FlagsForFile. Since the rewrite was supposed to be backwards compatible, this needs to be handled.
This commit is contained in:
parent
11a7746753
commit
d9f45d576f
@ -18,8 +18,10 @@
|
||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# This function doesn't do anything; it used to do something useful, but not
|
||||
# anymore. It MUST NOT be removed because of backwards compatibility with old
|
||||
# ycm_extra_conf.py files.
|
||||
def PrepareClangFlags( flags, filename ):
|
||||
# When flags come from the compile_commands.json file, the first flag is
|
||||
# usually the path to the compiler that should be invoked. We want to strip
|
||||
# that.
|
||||
if not flags[ 0 ].startswith( '-' ):
|
||||
return flags[ 1: ]
|
||||
return flags
|
||||
|
Loading…
Reference in New Issue
Block a user