diff --git a/infer/lib/clang_wrappers/attach_plugin_and_run_clang_frontend.sh b/infer/lib/clang_wrappers/attach_plugin_and_run_clang_frontend.sh index 1fcbc91db..fae4c50b9 100755 --- a/infer/lib/clang_wrappers/attach_plugin_and_run_clang_frontend.sh +++ b/infer/lib/clang_wrappers/attach_plugin_and_run_clang_frontend.sh @@ -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" diff --git a/infer/lib/clang_wrappers/hijack_and_normalize_clang_command.sh b/infer/lib/clang_wrappers/hijack_and_normalize_clang_command.sh index c94ebc51e..b5b7dd76f 100755 --- a/infer/lib/clang_wrappers/hijack_and_normalize_clang_command.sh +++ b/infer/lib/clang_wrappers/hijack_and_normalize_clang_command.sh @@ -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