[clang] 3238934 - [clang][cli] Generate -f[no-]finite-loops arguments
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 16 05:39:28 PST 2021
Author: Jan Svoboda
Date: 2021-02-16T14:39:20+01:00
New Revision: 32389346ed83e14b7a9bd3a31a96181c6a1cdb5e
URL: https://github.com/llvm/llvm-project/commit/32389346ed83e14b7a9bd3a31a96181c6a1cdb5e
DIFF: https://github.com/llvm/llvm-project/commit/32389346ed83e14b7a9bd3a31a96181c6a1cdb5e.diff
LOG: [clang][cli] Generate -f[no-]finite-loops arguments
This patch generates the `-f[no-]finite-loops` arguments from `CompilerInvocation` (added in D96419), fixing test failures of Clang built with `-DCLANG_ROUND_TRIP_CC1_ARGS=ON`.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D96761
Added:
Modified:
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGenCXX/attr-mustprogress.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index b2ee11a42f57..f92964732688 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1509,6 +1509,17 @@ void CompilerInvocation::GenerateCodeGenArgs(
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,
diff --git a/clang/test/CodeGenCXX/attr-mustprogress.cpp b/clang/test/CodeGenCXX/attr-mustprogress.cpp
index 93e366b4ca7f..48ac7ad938ba 100644
--- a/clang/test/CodeGenCXX/attr-mustprogress.cpp
+++ b/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;
More information about the cfe-commits
mailing list