Skip to content

Commit ba3d52c

Browse files
committed
[Clang] Add noalias to this pointer in C++ constructors
1 parent 8c74dc1 commit ba3d52c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,8 +1567,10 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
15671567
PGO.assignRegionCounters(GD, CurFn);
15681568
if (isa<CXXDestructorDecl>(FD))
15691569
EmitDestructorBody(Args);
1570-
else if (isa<CXXConstructorDecl>(FD))
1570+
else if (isa<CXXConstructorDecl>(FD)) {
1571+
Fn->addParamAttr(0, llvm::Attribute::NoAlias);
15711572
EmitConstructorBody(Args);
1573+
}
15721574
else if (getLangOpts().CUDA &&
15731575
!getLangOpts().CUDAIsDevice &&
15741576
FD->hasAttr<CUDAGlobalAttr>())

0 commit comments

Comments
 (0)