[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 22 17:36:40 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 -- clang/lib/CodeGen/CodeGenFunction.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 2da48cea7..9690d6c5d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1570,10 +1570,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
   else if (isa<CXXConstructorDecl>(FD)) {
     Fn->addParamAttr(0, llvm::Attribute::NoAlias);
     EmitConstructorBody(Args);
-  }
-  else if (getLangOpts().CUDA &&
-           !getLangOpts().CUDAIsDevice &&
-           FD->hasAttr<CUDAGlobalAttr>())
+  } else if (getLangOpts().CUDA && !getLangOpts().CUDAIsDevice &&
+             FD->hasAttr<CUDAGlobalAttr>())
     CGM.getCUDARuntime().emitDeviceStub(*this, Args);
   else if (isa<CXXMethodDecl>(FD) &&
            cast<CXXMethodDecl>(FD)->isLambdaStaticInvoker()) {

``````````

</details>


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


More information about the cfe-commits mailing list