[clang] Add support for -fcx-limited-range and #pragma CX_LIMITED_RANGE. (PR #68820)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 11 10:24:34 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff c1b6ed42b75a17d1718aa377f76633b27e15a4e2 91de35737b74233f29da76573b4099bf64e8bdd4 -- clang/test/CodeGen/cx-full-range.c clang/test/CodeGen/pragma-cx-limited-range.c clang/test/CodeGenCXX/cx-limited-range.c clang/include/clang/Parse/Parser.h clang/include/clang/Sema/Sema.h clang/lib/CodeGen/CGExprComplex.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Parse/ParsePragma.cpp clang/lib/Parse/ParseStmt.cpp clang/lib/Parse/Parser.cpp clang/lib/Sema/SemaAttr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index f206f5de1310..3f49788cf793 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -8452,9 +8452,9 @@ public:
SourceLocation PrevPtOfInstantiation,
bool &SuppressNew);
- bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD,
- const TemplateArgumentListInfo &ExplicitTemplateArgs,
- LookupResult &Previous);
+ bool CheckDependentFunctionTemplateSpecialization(
+ FunctionDecl *FD, const TemplateArgumentListInfo &ExplicitTemplateArgs,
+ LookupResult &Previous);
bool CheckFunctionTemplateSpecialization(
FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs,
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index f18fdb170909..2ce60ea1d605 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -890,13 +890,13 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) {
DSTr = Builder.CreateFDiv(ACpBD, CCpDD);
DSTi = Builder.CreateFDiv(BCmAD, CCpDD);
} else if (RHSi && !CGF.getLangOpts().FastMath) {
- // If we have a complex operand on the RHS and FastMath is not allowed, we
- // delegate to a libcall to handle all of the complexities and minimize
- // underflow/overflow cases. When FastMath is allowed we construct the
- // divide inline using the same algorithm as for integer operands.
- //
- // FIXME: We would be able to avoid the libcall in many places if we
- // supported imaginary types in addition to complex types.
+ // If we have a complex operand on the RHS and FastMath is not allowed, we
+ // delegate to a libcall to handle all of the complexities and minimize
+ // underflow/overflow cases. When FastMath is allowed we construct the
+ // divide inline using the same algorithm as for integer operands.
+ //
+ // FIXME: We would be able to avoid the libcall in many places if we
+ // supported imaginary types in addition to complex types.
BinOpInfo LibCallOp = Op;
// If LHS was a real, supply a null imaginary part.
if (!LHSi)
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index eae4b54ecfc5..6e4db5da9fdb 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -873,9 +873,9 @@ void Parser::HandlePragmaCXLimitedRange() {
IsEnabled = false;
break;
case tok::OOS_DEFAULT:
- // According to ISO C99 standard chapter 7.3.4, the default value
- // for the pragma is ``off'. In GCC, the option -fcx-limited-range
- // controls the default setting of the pragma.
+ // According to ISO C99 standard chapter 7.3.4, the default value
+ // for the pragma is ``off'. In GCC, the option -fcx-limited-range
+ // controls the default setting of the pragma.
IsEnabled = getLangOpts().CxLimitedRange ? true : false;
break;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/68820
More information about the cfe-commits
mailing list