Skip to content

Commit 1a8d88e

Browse files
committed
[Clang] Add noalias to this pointer in C++ constructors
1 parent d0cd6f3 commit 1a8d88e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,9 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
15521552
// Emit the standard function prologue.
15531553
StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin());
15541554

1555+
if (isa<CXXConstructorDecl>(FD))
1556+
Fn->addParamAttr(0, llvm::Attribute::NoAlias);
1557+
15551558
// Save parameters for coroutine function.
15561559
if (Body && isa_and_nonnull<CoroutineBodyStmt>(Body))
15571560
llvm::append_range(FnArgs, FD->parameters());

0 commit comments

Comments
 (0)