From 2cf873497f8da187403062929b01d8f415720f4e Mon Sep 17 00:00:00 2001 From: martinoluca Date: Tue, 23 Jun 2015 16:37:30 -0100 Subject: [PATCH] Emit InferClang command on the .sh file when running in `--frontend-stats` mode (and similar) --- infer/lib/clang/clang_general_wrapper | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/infer/lib/clang/clang_general_wrapper b/infer/lib/clang/clang_general_wrapper index b5445bdd8..338406965 100755 --- a/infer/lib/clang/clang_general_wrapper +++ b/infer/lib/clang/clang_general_wrapper @@ -121,7 +121,11 @@ then EXTRA_ARGS=("-Xclang" "-load" "-Xclang" "${PLUGIN_PATH}" "-Xclang" "$ADD_PLUGIN_FLAG" - "-Xclang" "${PLUGIN_NAME}") + "-Xclang" "${PLUGIN_NAME}" + "-Xclang" "-plugin-arg-${PLUGIN_NAME}" + "-Xclang" "-" + "-Xclang" "-plugin-arg-${PLUGIN_NAME}" + "-Xclang" "PREPEND_CURRENT_DIR=1") if [ -n "$SYNTAX_ONLY" ]; then EXTRA_ARGS+=("-fsyntax-only") fi @@ -152,14 +156,13 @@ if [ -n "$ATTACH_PLUGIN" ]; then INFERCLANG_LOG_FILE="/dev/null" if [ -n "$DEBUG_MODE" ]; then - # Emit the clang command with the extra args - echo "${CLANG_CMD[@]}" > "${OBJECT_FILENAME}${CMD_FILE_EXT}" + # Emit the clang command with the extra args piped to InferClang + echo "${CLANG_CMD[@]} | tee ${OBJECT_FILENAME}.yjson | ${INFERCLANG_CMD[@]}" > "${OBJECT_FILENAME}${CMD_FILE_EXT}" # Emit the InferClang cmd used to run the frontend INFERCLANG_LOG_FILE="${OBJECT_FILENAME}${INFERCLANG_LOG_FILE_EXT}" echo "${INFERCLANG_CMD[@]}" > "$INFERCLANG_LOG_FILE" fi - export CLANG_FRONTEND_PLUGIN__PREPEND_CURRENT_DIR="1" # run clang and pipe its output to InferClang, or flush it in case the latter crashes "${CLANG_CMD[@]}" | ("${INFERCLANG_CMD[@]}" || { EC=$?; cat > /dev/null; exit $EC; }) >> "$INFERCLANG_LOG_FILE" 2>&1 STATUSES=("${PIPESTATUS[@]}")