Emit InferClang command on the .sh file when running in `--frontend-stats` mode (and similar)

master
martinoluca 10 years ago
parent dd066c828c
commit 2cf873497f

@ -121,7 +121,11 @@ then
EXTRA_ARGS=("-Xclang" "-load" EXTRA_ARGS=("-Xclang" "-load"
"-Xclang" "${PLUGIN_PATH}" "-Xclang" "${PLUGIN_PATH}"
"-Xclang" "$ADD_PLUGIN_FLAG" "-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 if [ -n "$SYNTAX_ONLY" ]; then
EXTRA_ARGS+=("-fsyntax-only") EXTRA_ARGS+=("-fsyntax-only")
fi fi
@ -152,14 +156,13 @@ if [ -n "$ATTACH_PLUGIN" ]; then
INFERCLANG_LOG_FILE="/dev/null" INFERCLANG_LOG_FILE="/dev/null"
if [ -n "$DEBUG_MODE" ]; then if [ -n "$DEBUG_MODE" ]; then
# Emit the clang command with the extra args # Emit the clang command with the extra args piped to InferClang
echo "${CLANG_CMD[@]}" > "${OBJECT_FILENAME}${CMD_FILE_EXT}" echo "${CLANG_CMD[@]} | tee ${OBJECT_FILENAME}.yjson | ${INFERCLANG_CMD[@]}" > "${OBJECT_FILENAME}${CMD_FILE_EXT}"
# Emit the InferClang cmd used to run the frontend # Emit the InferClang cmd used to run the frontend
INFERCLANG_LOG_FILE="${OBJECT_FILENAME}${INFERCLANG_LOG_FILE_EXT}" INFERCLANG_LOG_FILE="${OBJECT_FILENAME}${INFERCLANG_LOG_FILE_EXT}"
echo "${INFERCLANG_CMD[@]}" > "$INFERCLANG_LOG_FILE" echo "${INFERCLANG_CMD[@]}" > "$INFERCLANG_LOG_FILE"
fi 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 # 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 "${CLANG_CMD[@]}" | ("${INFERCLANG_CMD[@]}" || { EC=$?; cat > /dev/null; exit $EC; }) >> "$INFERCLANG_LOG_FILE" 2>&1
STATUSES=("${PIPESTATUS[@]}") STATUSES=("${PIPESTATUS[@]}")

Loading…
Cancel
Save