[clang] [Clang][C++23] Core language changes from P1467R9 extended floating-point types and standard names. (PR #78503)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 13:16:09 PST 2024


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 de423cfe3d5de0110b4f55ff1742988b529be6d2 d47d92d074e6a4870849db79dec5adb197bed010 -- clang/test/CodeGenCXX/cxx23-fp-ext-std-names-p1467r9.cpp clang/test/CodeGenCXX/cxx23-vector-bfloat16.cpp clang/test/Sema/cxx23-fp-ext-std-names-p1467r9.cpp clang/include/clang/AST/ASTContext.h clang/include/clang/AST/Type.h clang/include/clang/Lex/LiteralSupport.h clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h clang/lib/AST/ASTContext.cpp clang/lib/AST/StmtPrinter.cpp clang/lib/AST/Type.cpp clang/lib/Frontend/InitPreprocessor.cpp clang/lib/Lex/LiteralSupport.cpp clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaCast.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaOverload.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index beec40b4a8..beb0a49e72 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1116,7 +1116,8 @@ public:
       SatUnsignedLongFractTy;
   CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
   CanQualType BFloat16Ty; // [C++23 6.8.3p5][basic.extended.fp]
-  CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3 and [C++23 6.8.3p5][basic.extended.fp]
+  CanQualType Float16Ty;  // C11 extension ISO/IEC TS 18661-3 and
+                          // [C++23 6.8.3p5][basic.extended.fp]
   CanQualType VoidPtrTy, NullPtrTy;
   CanQualType DependentTy, OverloadTy, BoundMemberTy, UnknownAnyTy;
   CanQualType BuiltinFnTy;
@@ -2838,8 +2839,8 @@ public:
 
   /// C++23 6.8.2p12 [basic.fundamental]
   /// Returns true if \p Result is FRCR_Lesser or FRCR_Unordered rank.
-  bool
-  isCXX23SmallerOrUnorderedFloatingPointRank(FloatingRankCompareResult Result) const;
+  bool isCXX23SmallerOrUnorderedFloatingPointRank(
+      FloatingRankCompareResult Result) const;
 
   /// C++23 6.8.2p12 [basic.fundamental]
   /// Returns true if \p Result is FRCR_Equal, FRCR_Equal_Lesser_Subrank or
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 989dee9fca..15f3e326d3 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -125,7 +125,8 @@ constexpr unsigned CXX23FloatRankToIndex(clang::BuiltinType::Kind Kind) {
   case clang::BuiltinType::LongDouble:
     return 4;
   default:
-    // Both __float128 and __ibm128 are compiler extensions, not extended floating points.
+    // Both __float128 and __ibm128 are compiler extensions, not extended
+    // floating points.
     // __float128 also predates the invention of floating-point types.
     llvm_unreachable("Not a CXX23+ floating point builtin type");
   }
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index b762b58185..26ad81b5dd 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -1358,7 +1358,9 @@ static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node,
   case BuiltinType::Float:      OS << 'F'; break;
   case BuiltinType::LongDouble: OS << 'L'; break;
   case BuiltinType::Float128:   OS << 'Q'; break;
-  case BuiltinType::BFloat16:   OS << "BF16"; break;
+  case BuiltinType::BFloat16:
+    OS << "BF16";
+    break;
   }
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/78503


More information about the cfe-commits mailing list