[clang] [clang] Add `__bf16` Type Support Macros With Literal Suffix Support (PR #134214)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 3 01:16:18 PDT 2025
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 HEAD~1 HEAD --extensions cpp,h -- clang/include/clang/Lex/LiteralSupport.h clang/lib/Frontend/InitPreprocessor.cpp clang/lib/Lex/LiteralSupport.cpp clang/lib/Sema/SemaExpr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 69ab02d6c..e37dd3448 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -107,7 +107,7 @@ static T PickFP(const llvm::fltSemantics *Sem, T IEEEHalfVal, T IEEESingleVal,
return X87DoubleExtendedVal;
if (Sem == (const llvm::fltSemantics*)&llvm::APFloat::PPCDoubleDouble())
return PPCDoubleDoubleVal;
- if (Sem == (const llvm::fltSemantics*)&llvm::APFloat::BFloat())
+ if (Sem == (const llvm::fltSemantics *)&llvm::APFloat::BFloat())
return BFloatVal;
assert(Sem == (const llvm::fltSemantics*)&llvm::APFloat::IEEEquad());
return IEEEQuadVal;
@@ -138,8 +138,8 @@ static void DefineFloatMacros(MacroBuilder &Builder, StringRef Prefix,
int Max10Exp = PickFP(Sem, 4, 38, 308, 4932, 308, 38, 4932);
int MinExp = PickFP(Sem, -13, -125, -1021, -16381, -968, -125, -16381);
int MaxExp = PickFP(Sem, 16, 128, 1024, 16384, 1024, 128, 16384);
- Min = PickFP(Sem, "6.103515625e-5", "1.17549435e-38", "2.2250738585072014e-308",
- "3.36210314311209350626e-4932",
+ Min = PickFP(Sem, "6.103515625e-5", "1.17549435e-38",
+ "2.2250738585072014e-308", "3.36210314311209350626e-4932",
"2.00416836000897277799610805135016e-292",
"1.17549435082228750796873653722224568e-38",
"3.36210314311209350626267781732175260e-4932");
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index ab0d301a7..bdfb7575b 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -982,9 +982,12 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
switch (*s) {
case 'b':
case 'B':
- if (isBFloat16) break;
- if (isBF16) break;
- if (HasSize) break;
+ if (isBFloat16)
+ break;
+ if (isBF16)
+ break;
+ if (HasSize)
+ break;
isBF16 = true;
continue;
``````````
</details>
https://github.com/llvm/llvm-project/pull/134214
More information about the cfe-commits
mailing list