[clang] Add -ffinite-loops & -fno-finite-loops options.
authorFlorian Hahn <flo@fhahn.com>
Fri, 12 Feb 2021 17:45:18 +0000 (17:45 +0000)
committerFlorian Hahn <flo@fhahn.com>
Fri, 12 Feb 2021 19:25:49 +0000 (19:25 +0000)
commit51bf4c0e6d4cbc6dfa57857fc78003413cbeb17f
tree3e584387f80bf1f832c93d1c905b566164bb9575
parent4fc25573089c53804a035080739867ee3b346fdd
[clang] Add -ffinite-loops & -fno-finite-loops options.

This patch adds 2 new options to control when Clang adds `mustprogress`:

  1. -ffinite-loops: assume all loops are finite; mustprogress is added
     to all loops, regardless of the selected language standard.
  2. -fno-finite-loops: assume no loop is finite; mustprogress is not
     added to any loop or function. We could add mustprogress to
     functions without loops, but we would have to detect that in Clang,
     which is probably not worth it.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D96419
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/attr-mustprogress.c
clang/test/CodeGenCXX/attr-mustprogress.cpp