Skip to content

Commit eee2dc4

Browse files
committed
Merge "merge main into amd-staging" into amd-staging
2 parents f62f54d + ce04999 commit eee2dc4

File tree

100 files changed

+2033
-891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2033
-891
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ Bug Fixes to C++ Support
747747
- Fix a bug with checking constrained non-type template parameters for equivalence. Fixes (#GH77377).
748748
- Fix a bug where the last argument was not considered when considering the most viable function for
749749
explicit object argument member functions. Fixes (#GH92188).
750+
- Fix a C++11 crash when a non-const non-static member function is defined out-of-line with
751+
the ``constexpr`` specifier. Fixes (#GH61004).
750752

751753
Bug Fixes to AST Handling
752754
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/ARCMigrate/ARCMT.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,7 @@ bool MigrationProcess::applyTransform(TransformFn trans,
606606
llvm::raw_svector_ostream vecOS(newText);
607607
buf.write(vecOS);
608608
std::unique_ptr<llvm::MemoryBuffer> memBuf(
609-
llvm::MemoryBuffer::getMemBufferCopy(
610-
StringRef(newText.data(), newText.size()), newFname));
609+
llvm::MemoryBuffer::getMemBufferCopy(newText.str(), newFname));
611610
SmallString<64> filePath(file->getName());
612611
Unit->getFileManager().FixupRelativePath(filePath);
613612
Remapper.remap(filePath.str(), std::move(memBuf));

clang/lib/ARCMigrate/ObjCMT.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,8 +1963,7 @@ void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
19631963
llvm::raw_svector_ostream vecOS(newText);
19641964
buf.write(vecOS);
19651965
std::unique_ptr<llvm::MemoryBuffer> memBuf(
1966-
llvm::MemoryBuffer::getMemBufferCopy(
1967-
StringRef(newText.data(), newText.size()), file->getName()));
1966+
llvm::MemoryBuffer::getMemBufferCopy(newText.str(), file->getName()));
19681967
SmallString<64> filePath(file->getName());
19691968
FileMgr.FixupRelativePath(filePath);
19701969
Remapper.remap(filePath.str(), std::move(memBuf));

clang/lib/CodeGen/CGAtomic.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ namespace {
150150
Address getAtomicAddress() const {
151151
llvm::Type *ElTy;
152152
if (LVal.isSimple())
153-
ElTy = LVal.getAddress(CGF).getElementType();
153+
ElTy = LVal.getAddress().getElementType();
154154
else if (LVal.isBitField())
155155
ElTy = LVal.getBitFieldAddress().getElementType();
156156
else if (LVal.isVectorElt())
@@ -363,7 +363,7 @@ bool AtomicInfo::requiresMemSetZero(llvm::Type *type) const {
363363

364364
bool AtomicInfo::emitMemSetZeroIfNecessary() const {
365365
assert(LVal.isSimple());
366-
Address addr = LVal.getAddress(CGF);
366+
Address addr = LVal.getAddress();
367367
if (!requiresMemSetZero(addr.getElementType()))
368368
return false;
369369

@@ -1603,7 +1603,7 @@ Address AtomicInfo::materializeRValue(RValue rvalue) const {
16031603
LValue TempLV = CGF.MakeAddrLValue(CreateTempAlloca(), getAtomicType());
16041604
AtomicInfo Atomics(CGF, TempLV);
16051605
Atomics.emitCopyIntoMemory(rvalue);
1606-
return TempLV.getAddress(CGF);
1606+
return TempLV.getAddress();
16071607
}
16081608

16091609
llvm::Value *AtomicInfo::getScalarRValValueOrNull(RValue RVal) const {
@@ -1951,7 +1951,7 @@ void CodeGenFunction::EmitAtomicStore(RValue rvalue, LValue dest,
19511951
// maybe for address-space qualification.
19521952
assert(!rvalue.isAggregate() ||
19531953
rvalue.getAggregateAddress().getElementType() ==
1954-
dest.getAddress(*this).getElementType());
1954+
dest.getAddress().getElementType());
19551955

19561956
AtomicInfo atomics(*this, dest);
19571957
LValue LVal = atomics.getAtomicLValue();
@@ -2024,10 +2024,10 @@ std::pair<RValue, llvm::Value *> CodeGenFunction::EmitAtomicCompareExchange(
20242024
// maybe for address-space qualification.
20252025
assert(!Expected.isAggregate() ||
20262026
Expected.getAggregateAddress().getElementType() ==
2027-
Obj.getAddress(*this).getElementType());
2027+
Obj.getAddress().getElementType());
20282028
assert(!Desired.isAggregate() ||
20292029
Desired.getAggregateAddress().getElementType() ==
2030-
Obj.getAddress(*this).getElementType());
2030+
Obj.getAddress().getElementType());
20312031
AtomicInfo Atomics(*this, Obj);
20322032

20332033
return Atomics.EmitAtomicCompareExchange(Expected, Desired, Success, Failure,
@@ -2068,7 +2068,7 @@ void CodeGenFunction::EmitAtomicInit(Expr *init, LValue dest) {
20682068

20692069
// Evaluate the expression directly into the destination.
20702070
AggValueSlot slot = AggValueSlot::forLValue(
2071-
dest, *this, AggValueSlot::IsNotDestructed,
2071+
dest, AggValueSlot::IsNotDestructed,
20722072
AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased,
20732073
AggValueSlot::DoesNotOverlap,
20742074
Zeroed ? AggValueSlot::IsZeroed : AggValueSlot::IsNotZeroed);

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
927927
/*RefersToEnclosingVariableOrCapture*/ CI.isNested(),
928928
type.getNonReferenceType(), VK_LValue,
929929
SourceLocation());
930-
src = EmitDeclRefLValue(&declRef).getAddress(*this);
930+
src = EmitDeclRefLValue(&declRef).getAddress();
931931
};
932932

933933
// For byrefs, we just write the pointer to the byref struct into

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5609,8 +5609,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
56095609
llvm::Value *Queue = EmitScalarExpr(E->getArg(0));
56105610
llvm::Value *Flags = EmitScalarExpr(E->getArg(1));
56115611
LValue NDRangeL = EmitAggExprToLValue(E->getArg(2));
5612-
llvm::Value *Range = NDRangeL.getAddress(*this).emitRawPointer(*this);
5613-
llvm::Type *RangeTy = NDRangeL.getAddress(*this).getType();
5612+
llvm::Value *Range = NDRangeL.getAddress().emitRawPointer(*this);
5613+
llvm::Type *RangeTy = NDRangeL.getAddress().getType();
56145614

56155615
if (NumArgs == 4) {
56165616
// The most basic form of the call with parameters:
@@ -5629,7 +5629,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
56295629
Builder.CreatePointerCast(Info.BlockArg, GenericVoidPtrTy);
56305630

56315631
AttrBuilder B(Builder.getContext());
5632-
B.addByValAttr(NDRangeL.getAddress(*this).getElementType());
5632+
B.addByValAttr(NDRangeL.getAddress().getElementType());
56335633
llvm::AttributeList ByValAttrSet =
56345634
llvm::AttributeList::get(CGM.getModule().getContext(), 3U, B);
56355635

@@ -5817,7 +5817,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
58175817
llvm::Type *GenericVoidPtrTy = Builder.getPtrTy(
58185818
getContext().getTargetAddressSpace(LangAS::opencl_generic));
58195819
LValue NDRangeL = EmitAggExprToLValue(E->getArg(0));
5820-
llvm::Value *NDRange = NDRangeL.getAddress(*this).emitRawPointer(*this);
5820+
llvm::Value *NDRange = NDRangeL.getAddress().emitRawPointer(*this);
58215821
auto Info =
58225822
CGM.getOpenCLRuntime().emitOpenCLEnqueuedBlock(*this, E->getArg(1));
58235823
Value *Kernel =
@@ -21600,7 +21600,7 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
2160021600
// Handle aggregate argument, namely RVV tuple types in segment load/store
2160121601
if (hasAggregateEvaluationKind(E->getArg(i)->getType())) {
2160221602
LValue L = EmitAggExprToLValue(E->getArg(i));
21603-
llvm::Value *AggValue = Builder.CreateLoad(L.getAddress(*this));
21603+
llvm::Value *AggValue = Builder.CreateLoad(L.getAddress());
2160421604
Ops.push_back(AggValue);
2160521605
continue;
2160621606
}

clang/lib/CodeGen/CGCall.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,12 +1052,12 @@ void CodeGenFunction::ExpandTypeFromArgs(QualType Ty, LValue LV,
10521052
auto Exp = getTypeExpansion(Ty, getContext());
10531053
if (auto CAExp = dyn_cast<ConstantArrayExpansion>(Exp.get())) {
10541054
forConstantArrayExpansion(
1055-
*this, CAExp, LV.getAddress(*this), [&](Address EltAddr) {
1055+
*this, CAExp, LV.getAddress(), [&](Address EltAddr) {
10561056
LValue LV = MakeAddrLValue(EltAddr, CAExp->EltTy);
10571057
ExpandTypeFromArgs(CAExp->EltTy, LV, AI);
10581058
});
10591059
} else if (auto RExp = dyn_cast<RecordExpansion>(Exp.get())) {
1060-
Address This = LV.getAddress(*this);
1060+
Address This = LV.getAddress();
10611061
for (const CXXBaseSpecifier *BS : RExp->Bases) {
10621062
// Perform a single step derived-to-base conversion.
10631063
Address Base =
@@ -1089,7 +1089,7 @@ void CodeGenFunction::ExpandTypeFromArgs(QualType Ty, LValue LV,
10891089
// pointer type they use (see D118744). Once clang uses opaque pointers
10901090
// all LLVM pointer types will be the same and we can remove this check.
10911091
if (Arg->getType()->isPointerTy()) {
1092-
Address Addr = LV.getAddress(*this);
1092+
Address Addr = LV.getAddress();
10931093
Arg = Builder.CreateBitCast(Arg, Addr.getElementType());
10941094
}
10951095
EmitStoreOfScalar(Arg, LV);
@@ -1102,7 +1102,7 @@ void CodeGenFunction::ExpandTypeToArgs(
11021102
SmallVectorImpl<llvm::Value *> &IRCallArgs, unsigned &IRCallArgPos) {
11031103
auto Exp = getTypeExpansion(Ty, getContext());
11041104
if (auto CAExp = dyn_cast<ConstantArrayExpansion>(Exp.get())) {
1105-
Address Addr = Arg.hasLValue() ? Arg.getKnownLValue().getAddress(*this)
1105+
Address Addr = Arg.hasLValue() ? Arg.getKnownLValue().getAddress()
11061106
: Arg.getKnownRValue().getAggregateAddress();
11071107
forConstantArrayExpansion(
11081108
*this, CAExp, Addr, [&](Address EltAddr) {
@@ -1113,7 +1113,7 @@ void CodeGenFunction::ExpandTypeToArgs(
11131113
IRCallArgPos);
11141114
});
11151115
} else if (auto RExp = dyn_cast<RecordExpansion>(Exp.get())) {
1116-
Address This = Arg.hasLValue() ? Arg.getKnownLValue().getAddress(*this)
1116+
Address This = Arg.hasLValue() ? Arg.getKnownLValue().getAddress()
11171117
: Arg.getKnownRValue().getAggregateAddress();
11181118
for (const CXXBaseSpecifier *BS : RExp->Bases) {
11191119
// Perform a single step derived-to-base conversion.
@@ -4150,7 +4150,7 @@ static bool isProvablyNonNull(Address Addr, CodeGenFunction &CGF) {
41504150
static void emitWriteback(CodeGenFunction &CGF,
41514151
const CallArgList::Writeback &writeback) {
41524152
const LValue &srcLV = writeback.Source;
4153-
Address srcAddr = srcLV.getAddress(CGF);
4153+
Address srcAddr = srcLV.getAddress();
41544154
assert(!isProvablyNull(srcAddr.getBasePointer()) &&
41554155
"shouldn't have writeback for provably null argument");
41564156

@@ -4257,7 +4257,7 @@ static void emitWritebackArg(CodeGenFunction &CGF, CallArgList &args,
42574257
CRE->getSubExpr()->getType()->castAs<PointerType>()->getPointeeType();
42584258
srcLV = CGF.MakeAddrLValue(srcAddr, srcAddrType);
42594259
}
4260-
Address srcAddr = srcLV.getAddress(CGF);
4260+
Address srcAddr = srcLV.getAddress();
42614261

42624262
// The dest and src types don't necessarily match in LLVM terms
42634263
// because of the crazy ObjC compatibility rules.
@@ -4663,7 +4663,7 @@ RValue CallArg::getRValue(CodeGenFunction &CGF) const {
46634663
CGF.EmitAggregateCopy(Copy, LV, Ty, AggValueSlot::DoesNotOverlap,
46644664
LV.isVolatile());
46654665
IsUsed = true;
4666-
return RValue::getAggregate(Copy.getAddress(CGF));
4666+
return RValue::getAggregate(Copy.getAddress());
46674667
}
46684668

46694669
void CallArg::copyInto(CodeGenFunction &CGF, Address Addr) const {
@@ -4673,7 +4673,7 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address Addr) const {
46734673
else if (!HasLV && RV.isComplex())
46744674
CGF.EmitStoreOfComplex(RV.getComplexVal(), Dst, /*init=*/true);
46754675
else {
4676-
auto Addr = HasLV ? LV.getAddress(CGF) : RV.getAggregateAddress();
4676+
auto Addr = HasLV ? LV.getAddress() : RV.getAggregateAddress();
46774677
LValue SrcLV = CGF.MakeAddrLValue(Addr, Ty);
46784678
// We assume that call args are never copied into subobjects.
46794679
CGF.EmitAggregateCopy(Dst, SrcLV, Ty, AggValueSlot::DoesNotOverlap,
@@ -5161,7 +5161,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
51615161
assert(getTarget().getTriple().getArch() == llvm::Triple::x86);
51625162
if (I->isAggregate()) {
51635163
RawAddress Addr = I->hasLValue()
5164-
? I->getKnownLValue().getAddress(*this)
5164+
? I->getKnownLValue().getAddress()
51655165
: I->getKnownRValue().getAggregateAddress();
51665166
llvm::Instruction *Placeholder =
51675167
cast<llvm::Instruction>(Addr.getPointer());
@@ -5227,7 +5227,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
52275227
// 3. If the argument is byval, but RV is not located in default
52285228
// or alloca address space.
52295229
Address Addr = I->hasLValue()
5230-
? I->getKnownLValue().getAddress(*this)
5230+
? I->getKnownLValue().getAddress()
52315231
: I->getKnownRValue().getAggregateAddress();
52325232
CharUnits Align = ArgInfo.getIndirectAlign();
52335233
const llvm::DataLayout *TD = &CGM.getDataLayout();
@@ -5323,7 +5323,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
53235323
V = I->getKnownRValue().getScalarVal();
53245324
else
53255325
V = Builder.CreateLoad(
5326-
I->hasLValue() ? I->getKnownLValue().getAddress(*this)
5326+
I->hasLValue() ? I->getKnownLValue().getAddress()
53275327
: I->getKnownRValue().getAggregateAddress());
53285328

53295329
// Implement swifterror by copying into a new swifterror argument.
@@ -5386,7 +5386,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
53865386
Src = CreateMemTemp(I->Ty, "coerce");
53875387
I->copyInto(*this, Src);
53885388
} else {
5389-
Src = I->hasLValue() ? I->getKnownLValue().getAddress(*this)
5389+
Src = I->hasLValue() ? I->getKnownLValue().getAddress()
53905390
: I->getKnownRValue().getAggregateAddress();
53915391
}
53925392

@@ -5473,7 +5473,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
54735473
Address addr = Address::invalid();
54745474
RawAddress AllocaAddr = RawAddress::invalid();
54755475
if (I->isAggregate()) {
5476-
addr = I->hasLValue() ? I->getKnownLValue().getAddress(*this)
5476+
addr = I->hasLValue() ? I->getKnownLValue().getAddress()
54775477
: I->getKnownRValue().getAggregateAddress();
54785478

54795479
} else {

clang/lib/CodeGen/CGClass.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
680680
// the constructor.
681681
QualType::DestructionKind dtorKind = FieldType.isDestructedType();
682682
if (CGF.needsEHCleanup(dtorKind))
683-
CGF.pushEHDestroy(dtorKind, LHS.getAddress(CGF), FieldType);
683+
CGF.pushEHDestroy(dtorKind, LHS.getAddress(), FieldType);
684684
return;
685685
}
686686
}
@@ -705,9 +705,9 @@ void CodeGenFunction::EmitInitializerForField(FieldDecl *Field, LValue LHS,
705705
break;
706706
case TEK_Aggregate: {
707707
AggValueSlot Slot = AggValueSlot::forLValue(
708-
LHS, *this, AggValueSlot::IsDestructed,
709-
AggValueSlot::DoesNotNeedGCBarriers, AggValueSlot::IsNotAliased,
710-
getOverlapForFieldInit(Field), AggValueSlot::IsNotZeroed,
708+
LHS, AggValueSlot::IsDestructed, AggValueSlot::DoesNotNeedGCBarriers,
709+
AggValueSlot::IsNotAliased, getOverlapForFieldInit(Field),
710+
AggValueSlot::IsNotZeroed,
711711
// Checks are made by the code that calls constructor.
712712
AggValueSlot::IsSanitizerChecked);
713713
EmitAggExpr(Init, Slot);
@@ -719,7 +719,7 @@ void CodeGenFunction::EmitInitializerForField(FieldDecl *Field, LValue LHS,
719719
// later in the constructor.
720720
QualType::DestructionKind dtorKind = FieldType.isDestructedType();
721721
if (needsEHCleanup(dtorKind))
722-
pushEHDestroy(dtorKind, LHS.getAddress(*this), FieldType);
722+
pushEHDestroy(dtorKind, LHS.getAddress(), FieldType);
723723
}
724724

725725
/// Checks whether the given constructor is a valid subject for the
@@ -983,8 +983,8 @@ namespace {
983983
LValue Src = CGF.EmitLValueForFieldInitialization(SrcLV, FirstField);
984984

985985
emitMemcpyIR(
986-
Dest.isBitField() ? Dest.getBitFieldAddress() : Dest.getAddress(CGF),
987-
Src.isBitField() ? Src.getBitFieldAddress() : Src.getAddress(CGF),
986+
Dest.isBitField() ? Dest.getBitFieldAddress() : Dest.getAddress(),
987+
Src.isBitField() ? Src.getBitFieldAddress() : Src.getAddress(),
988988
MemcpySize);
989989
reset();
990990
}
@@ -1131,7 +1131,7 @@ namespace {
11311131
continue;
11321132
LValue FieldLHS = LHS;
11331133
EmitLValueForAnyFieldInitialization(CGF, MemberInit, FieldLHS);
1134-
CGF.pushEHDestroy(dtorKind, FieldLHS.getAddress(CGF), FieldType);
1134+
CGF.pushEHDestroy(dtorKind, FieldLHS.getAddress(), FieldType);
11351135
}
11361136
}
11371137

@@ -1647,7 +1647,7 @@ namespace {
16471647
LValue LV = CGF.EmitLValueForField(ThisLV, field);
16481648
assert(LV.isSimple());
16491649

1650-
CGF.emitDestroy(LV.getAddress(CGF), field->getType(), destroyer,
1650+
CGF.emitDestroy(LV.getAddress(), field->getType(), destroyer,
16511651
flags.isForNormalCleanup() && useEHCleanupForArray);
16521652
}
16531653
};

0 commit comments

Comments
 (0)