Fix FCP_RUN_SYNTAX_ONLY variable

Summary: When we switched scripts to run `-cc1` commands coming from `-###` invocation we broke passing `-fsyntax-only` argument.

Reviewed By: jberdine

Differential Revision: D3835751

fbshipit-source-id: a742db4
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot 6
parent 5a49755690
commit 0817ab0ec2

@ -104,10 +104,6 @@ CLANG_CMD+=(
"-plugin-arg-${PLUGIN_NAME}"
"PREPEND_CURRENT_DIR=1")
if [ -n "$SYNTAX_ONLY" ]; then
CLANG_CMD+=("-fsyntax-only")
fi
if [ -n "$LLVM_MODE" ]; then
CLANG_CMD+=("-o" "-" "-g" "-S" "-emit-llvm")
fi
@ -122,6 +118,11 @@ if ! [[ "$SOURCE_FILENAME" = /* ]]; then
SOURCE_FILENAME="$(pwd)/$SOURCE_FILENAME"
fi
# add fsyntax-only to the end of arg list to override previous options
if [ -n "$SYNTAX_ONLY" ]; then
CLANG_CMD+=("-fsyntax-only")
fi
if [ -n "$LLVM_MODE" ]; then
INFER_FRONTEND_CMD=(
"${BIN_DIR}/InferLLVM"

@ -26,8 +26,11 @@ APPLE_CLANG="$FCP_APPLE_CLANG"
# Main
if [ "${0%++}" != "$0" ]; then XX="++"; fi
# Skip -cc1as commands
if [ "$1" = "-cc1as" ]; then
STATUS=0
# Normalize clang command if not -cc1 already. -cc1 is always the first argument if present.
if [ "$1" = "-cc1" ]; then
elif [ "$1" = "-cc1" ]; then
"$CLANG_CC1_CAPTURE" "$@"
STATUS=$?
else
@ -50,6 +53,10 @@ else
grep -e '^\([[:space:]]\"\|clang: error:\)' | \
# replace -cc1 commands with our clang wrapper
sed -e "s#^[[:space:]]\"\([^\"]*\)\" \"-cc1\" \(.*\)\$# \"$CLANG_CC1_CAPTURE\" \"-cc1\" \2#g" | \
# do not run if language is assembler or assembler-with-cpp
grep -v -- '"-x" "assembler' | \
# do not run -cc1as commands
grep -v -- '"-cc1as"' | \
# replace error messages by failures
sed -e 's#^\(^clang: error:.*$\)#echo "\1"; exit 1#g' | \
# add trailing ; to each line

Loading…
Cancel
Save