[PATCH] D118618: [flang] Fix invalid diagnostics in wrapper and reduce code dup.

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 09:21:21 PST 2022


awarzynski added a comment.

Hey @ygribov, thanks for submitting this!

>   Fix invalid diagnostics

Which diagnostics are invalid?



================
Comment at: flang/tools/f18/flang:282
 
+run_checked() {
+  if ! "$@"
----------------
It would be great if this name could follow's LLVM's [[ https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly | coding guide ]]:

> Function names should be verb phrases (as they represent actions), and command-like function should be imperative. The name should be camel case, and start with a lower case letter (e.g. openFile() or isFoo()).

Perhaps `run_and_check_status`? `run_compiler_command`? `run_and_check`? `run_cmd`?

Also, could you add a short description?


================
Comment at: flang/tools/f18/flang:321
   for idx in "${!other_srcs[@]}"; do
-    if ! $ext_fc -E "${opts[@]}" "${other_srcs[$idx]}" ${output_definition:+$output_definition}
-    then status=$?
-         echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2
-         exit $status
-    fi
+    run_checked $ext_fc -E "${opts[@]}" "${other_srcs[$idx]}" ${output_definition:+$output_definition}
   done
----------------
Similar suggestion elsewhere


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118618/new/

https://reviews.llvm.org/D118618



More information about the llvm-commits mailing list