[PATCH] D96761: [clang][cli] Generate -f[no-]finite-loops arguments
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 16 01:21:33 PST 2021
jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith, fhahn.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This patch generates the `-f[no-]finite-loops` arguments from `CompilerInvocation` (added in D96419 <https://reviews.llvm.org/D96419>), fixing test failures of Clang built with `-DCLANG_ROUND_TRIP_CC1_ARGS=ON`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D96761
Files:
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGenCXX/attr-mustprogress.cpp
Index: clang/test/CodeGenCXX/attr-mustprogress.cpp
===================================================================
--- clang/test/CodeGenCXX/attr-mustprogress.cpp
+++ clang/test/CodeGenCXX/attr-mustprogress.cpp
@@ -7,7 +7,7 @@
// Make sure -ffinite-loops overrides -std=c++98 for loops.
// RUN: %clang_cc1 -std=c++98 -ffinite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=FINITE %s
-// Make sure -fno_finite-loops overrides -std=c++11
+// Make sure -fno-finite-loops overrides -std=c++11
// RUN: %clang_cc1 -std=c++11 -fno-finite-loops -triple=x86_64-unknown-linux-gnu -S -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CXX98 %s
int a = 0;
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1509,6 +1509,17 @@
if (!Opts.EmitVersionIdentMetadata)
GenerateArg(Args, OPT_Qn, SA);
+
+ switch (Opts.FiniteLoops) {
+ case CodeGenOptions::FiniteLoopsKind::Language:
+ break;
+ case CodeGenOptions::FiniteLoopsKind::Always:
+ GenerateArg(Args, OPT_ffinite_loops, SA);
+ break;
+ case CodeGenOptions::FiniteLoopsKind::Never:
+ GenerateArg(Args, OPT_fno_finite_loops, SA);
+ break;
+ }
}
bool CompilerInvocation::ParseCodeGenArgsImpl(CodeGenOptions &Opts,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96761.323914.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210216/e6ac7162/attachment.bin>
More information about the cfe-commits
mailing list