[clang] [SemaCXX] Make __builtin_addressof more like std::addressof (PR #78035)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 06:05:16 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 8d817f6479a5df874028a8b40fd30aecd3479005 7384e99c5fc1bcba1a304735243e49e9738691aa -- clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaExpr.cpp clang/test/SemaCXX/builtins.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index e96436fd75..ec574b9224 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -242,7 +242,8 @@ static bool SemaBuiltinAddressof(Sema &S, CallExpr *TheCall) {
     return true;
 
   ExprResult Arg(TheCall->getArg(0));
-  QualType ResultType = S.CheckAddressOfOperand(Arg, TheCall->getBeginLoc(), true);
+  QualType ResultType =
+      S.CheckAddressOfOperand(Arg, TheCall->getBeginLoc(), true);
   if (ResultType.isNull())
     return true;
 
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 518c51e77c..6587276220 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -15125,7 +15125,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc,
     bool AllowTemporaryAddress = !isSFINAEContext() && !IsBuiltinAddressof;
     Diag(OpLoc, AllowTemporaryAddress ? diag::ext_typecheck_addrof_temporary
                                       : diag::err_typecheck_addrof_temporary)
-      << op->getType() << op->getSourceRange();
+        << op->getType() << op->getSourceRange();
     if (!AllowTemporaryAddress)
       return QualType();
     // Materialize the temporary as an lvalue so that we can take its address.

``````````

</details>


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


More information about the cfe-commits mailing list