Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Commit

Permalink
Treat include paths as relative to CWD of CC command
Browse files Browse the repository at this point in the history
  • Loading branch information
BKoller committed May 16, 2016
1 parent 74ea5db commit 2e8f06a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion config_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,12 @@ def parse_flags(build_log):
line_count += 1
words = split_flags(line)

cmd_pwd = './'

for (i, word) in enumerate(words):
if(word[0] != '-' or not flags_whitelist.match(word)):
if(word.find('YCM_CONFIG_GEN_PWD') == 0):
cmd_pwd = word[word.find("=") + 1:]
continue

# handle macro definitions
Expand All @@ -353,7 +357,7 @@ def parse_flags(build_log):

# include arguments for this option, if there are any, as a tuple
if(i != len(words) - 1 and word in filename_flags and words[i + 1][0] != '-'):
flags.add((word, words[i + 1]))
flags.add((word, os.path.realpath(os.path.join(cmd_pwd, words[i + 1]))))
else:
flags.add(word)

Expand Down
2 changes: 1 addition & 1 deletion fake-toolchain/Unix/cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@

else
echo "$@" >> $YCM_CONFIG_GEN_CC_LOG
echo "YCM_CONFIG_GEN_PWD=$(pwd) $@" >> $YCM_CONFIG_GEN_CC_LOG
fi

0 comments on commit 2e8f06a

Please sign in to comment.