Skip to content

Commit cef842e

Browse files
authored
Merge branch 'main' into bionic-cast
2 parents a536acb + 6a30076 commit cef842e

File tree

704 files changed

+21731
-11144
lines changed

Some content is hidden

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

704 files changed

+21731
-11144
lines changed

clang-tools-extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ static bool checkOverrideByDerivedMethod(const CXXMethodDecl *BaseMD,
179179

180180
bool VirtualNearMissCheck::isPossibleToBeOverridden(
181181
const CXXMethodDecl *BaseMD) {
182-
auto Iter = PossibleMap.find(BaseMD);
183-
if (Iter != PossibleMap.end())
182+
auto [Iter, Inserted] = PossibleMap.try_emplace(BaseMD);
183+
if (!Inserted)
184184
return Iter->second;
185185

186186
bool IsPossible = !BaseMD->isImplicit() && !isa<CXXConstructorDecl>(BaseMD) &&
187187
!isa<CXXDestructorDecl>(BaseMD) && BaseMD->isVirtual() &&
188188
!BaseMD->isOverloadedOperator() &&
189189
!isa<CXXConversionDecl>(BaseMD);
190-
PossibleMap[BaseMD] = IsPossible;
190+
Iter->second = IsPossible;
191191
return IsPossible;
192192
}
193193

clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ void IncludeModernizePPCallbacks::InclusionDirective(
199199
// 2. Insert `using namespace std;` to the beginning of TU.
200200
// 3. Do nothing and let the user deal with the migration himself.
201201
SourceLocation DiagLoc = FilenameRange.getBegin();
202-
if (CStyledHeaderToCxx.count(FileName) != 0) {
203-
IncludesToBeProcessed.emplace_back(
204-
IncludeMarker{CStyledHeaderToCxx[FileName], FileName,
205-
FilenameRange.getAsRange(), DiagLoc});
202+
if (auto It = CStyledHeaderToCxx.find(FileName);
203+
It != CStyledHeaderToCxx.end()) {
204+
IncludesToBeProcessed.emplace_back(IncludeMarker{
205+
It->second, FileName, FilenameRange.getAsRange(), DiagLoc});
206206
} else if (DeleteHeaders.count(FileName) != 0) {
207207
IncludesToBeProcessed.emplace_back(
208208
// NOLINTNEXTLINE(modernize-use-emplace) - false-positive

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ Code Completion
270270
Static Analyzer
271271
---------------
272272

273+
- Clang currently support extending lifetime of object bound to
274+
reference members of aggregates in CFG and ExprEngine, that are
275+
created from default member initializer.
276+
273277
New features
274278
^^^^^^^^^^^^
275279

clang/include/clang/AST/Redeclarable.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ class Redeclarable {
114114

115115
bool isFirst() const {
116116
return isa<KnownLatest>(Link) ||
117-
// FIXME: 'template' is required on the next line due to an
118-
// apparent clang bug.
119117
isa<UninitializedLatest>(cast<NotKnownLatest>(Link));
120118
}
121119

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12626,6 +12626,9 @@ def err_hlsl_pointers_unsupported : Error<
1262612626
"%select{pointers|references}0 are unsupported in HLSL">;
1262712627
def err_hlsl_missing_resource_class : Error<"HLSL resource needs to have [[hlsl::resource_class()]] attribute">;
1262812628
def err_hlsl_attribute_needs_intangible_type: Error<"attribute %0 can be used only on HLSL intangible type %1">;
12629+
def err_hlsl_incorrect_num_initializers: Error<
12630+
"too %select{few|many}0 initializers in list for type %1 "
12631+
"(expected %2 but found %3)">;
1262912632

1263012633
def err_hlsl_operator_unsupported : Error<
1263112634
"the '%select{&|*|->}0' operator is unsupported in HLSL">;

clang/include/clang/Sema/SemaHLSL.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
namespace clang {
2727
class AttributeCommonInfo;
2828
class IdentifierInfo;
29+
class InitializedEntity;
30+
class InitializationKind;
2931
class ParsedAttr;
3032
class Scope;
3133
class VarDecl;
@@ -149,6 +151,9 @@ class SemaHLSL : public SemaBase {
149151

150152
QualType getInoutParameterType(QualType Ty);
151153

154+
bool TransformInitList(const InitializedEntity &Entity,
155+
const InitializationKind &Kind, InitListExpr *Init);
156+
152157
private:
153158
// HLSL resource type attributes need to be processed all at once.
154159
// This is a list to collect them.

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,6 @@ class ASTWriter : public ASTDeserializationListener,
751751
/// Get the unique number used to refer to the given macro.
752752
serialization::MacroID getMacroRef(MacroInfo *MI, const IdentifierInfo *Name);
753753

754-
/// Determine the ID of an already-emitted macro.
755-
serialization::MacroID getMacroID(MacroInfo *MI);
756-
757754
uint32_t getMacroDirectivesOffset(const IdentifierInfo *Name);
758755

759756
/// Emit a reference to a type.

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace interp {
2929
template <class Emitter> class DeclScope final : public LocalScope<Emitter> {
3030
public:
3131
DeclScope(Compiler<Emitter> *Ctx, const ValueDecl *VD)
32-
: LocalScope<Emitter>(Ctx, VD), Scope(Ctx->P, VD),
32+
: LocalScope<Emitter>(Ctx, VD), Scope(Ctx->P),
3333
OldInitializingDecl(Ctx->InitializingDecl) {
3434
Ctx->InitializingDecl = VD;
3535
Ctx->InitStack.push_back(InitLink::Decl(VD));
@@ -2707,7 +2707,8 @@ bool Compiler<Emitter>::VisitMaterializeTemporaryExpr(
27072707

27082708
// For everyhing else, use local variables.
27092709
if (SubExprT) {
2710-
unsigned LocalIndex = allocateLocalPrimitive(E, *SubExprT, /*IsConst=*/true,
2710+
bool IsConst = SubExpr->getType().isConstQualified();
2711+
unsigned LocalIndex = allocateLocalPrimitive(E, *SubExprT, IsConst,
27112712
/*IsExtended=*/true);
27122713
if (!this->visit(SubExpr))
27132714
return false;
@@ -3028,7 +3029,7 @@ bool Compiler<Emitter>::VisitCXXConstructExpr(const CXXConstructExpr *E) {
30283029

30293030
size_t NumElems = CAT->getZExtSize();
30303031
const Function *Func = getFunction(E->getConstructor());
3031-
if (!Func || !Func->isConstexpr())
3032+
if (!Func)
30323033
return false;
30333034

30343035
// FIXME(perf): We're calling the constructor once per array element here,

clang/lib/AST/ByteCode/Descriptor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ struct Descriptor final {
274274

275275
void dump() const;
276276
void dump(llvm::raw_ostream &OS) const;
277+
void dumpFull(unsigned Offset = 0, unsigned Indent = 0) const;
277278
};
278279

279280
/// Bitfield tracking the initialisation status of elements of primitive arrays.

clang/lib/AST/ByteCode/Disasm.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,38 @@ LLVM_DUMP_METHOD void Descriptor::dump(llvm::raw_ostream &OS) const {
251251
OS << " dummy";
252252
}
253253

254+
/// Dump descriptor, including all valid offsets.
255+
LLVM_DUMP_METHOD void Descriptor::dumpFull(unsigned Offset,
256+
unsigned Indent) const {
257+
unsigned Spaces = Indent * 2;
258+
llvm::raw_ostream &OS = llvm::errs();
259+
OS.indent(Spaces);
260+
dump(OS);
261+
OS << '\n';
262+
OS.indent(Spaces) << "Metadata: " << getMetadataSize() << " bytes\n";
263+
OS.indent(Spaces) << "Size: " << getSize() << " bytes\n";
264+
OS.indent(Spaces) << "AllocSize: " << getAllocSize() << " bytes\n";
265+
Offset += getMetadataSize();
266+
if (isCompositeArray()) {
267+
OS.indent(Spaces) << "Elements: " << getNumElems() << '\n';
268+
unsigned FO = Offset;
269+
for (unsigned I = 0; I != getNumElems(); ++I) {
270+
FO += sizeof(InlineDescriptor);
271+
assert(ElemDesc->getMetadataSize() == 0);
272+
OS.indent(Spaces) << "Element " << I << " offset: " << FO << '\n';
273+
ElemDesc->dumpFull(FO, Indent + 1);
274+
275+
FO += ElemDesc->getAllocSize();
276+
}
277+
} else if (isRecord()) {
278+
ElemRecord->dump(OS, Indent + 1, Offset);
279+
} else if (isPrimitive()) {
280+
} else {
281+
}
282+
283+
OS << '\n';
284+
}
285+
254286
LLVM_DUMP_METHOD void InlineDescriptor::dump(llvm::raw_ostream &OS) const {
255287
{
256288
ColorScope SC(OS, true, {llvm::raw_ostream::BLUE, true});

0 commit comments

Comments
 (0)