Skip to content

Commit 865c411

Browse files
committed
Merge commit '4903d4537864' from apple/stable/20200714 into swift/main
Conflicts: lldb/include/lldb/Core/ModuleList.h lldb/include/lldb/Target/Target.h lldb/source/Core/ModuleList.cpp lldb/source/Target/Target.cpp
2 parents bcb4baf + 4903d45 commit 865c411

File tree

109 files changed

+2529
-657
lines changed

Some content is hidden

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

109 files changed

+2529
-657
lines changed

clang/include/clang/AST/ASTStructuralEquivalence.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ struct StructuralEquivalenceContext {
9797
/// \c VisitedDecls members) and can cause faulty equivalent results.
9898
bool IsEquivalent(QualType T1, QualType T2);
9999

100+
/// Determine whether the two statements are structurally equivalent.
101+
/// Implementation functions (all static functions in
102+
/// ASTStructuralEquivalence.cpp) must never call this function because that
103+
/// will wreak havoc the internal state (\c DeclsToCheck and
104+
/// \c VisitedDecls members) and can cause faulty equivalent results.
105+
bool IsEquivalent(Stmt *S1, Stmt *S2);
106+
100107
/// Find the index of the given anonymous struct/union within its
101108
/// context.
102109
///

clang/include/clang/AST/PrettyPrinter.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ struct PrintingPolicy {
5656
SuppressInitializers(false), ConstantArraySizeAsWritten(false),
5757
AnonymousTagLocations(true), SuppressStrongLifetime(false),
5858
SuppressLifetimeQualifiers(false),
59-
SuppressTemplateArgsInCXXConstructors(false), Bool(LO.Bool),
59+
SuppressTemplateArgsInCXXConstructors(false),
60+
SuppressDefaultTemplateArgs(true), Bool(LO.Bool),
6061
Restrict(LO.C99), Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
6162
UseVoidForZeroParams(!LO.CPlusPlus),
6263
SplitTemplateClosers(!LO.CPlusPlus11), TerseOutput(false),
@@ -173,6 +174,10 @@ struct PrintingPolicy {
173174
/// constructors.
174175
unsigned SuppressTemplateArgsInCXXConstructors : 1;
175176

177+
/// When true, attempt to suppress template arguments that match the default
178+
/// argument for the parameter.
179+
unsigned SuppressDefaultTemplateArgs : 1;
180+
176181
/// Whether we can use 'bool' rather than '_Bool' (even if the language
177182
/// doesn't actually have 'bool', because, e.g., it is defined as a macro).
178183
unsigned Bool : 1;

clang/include/clang/AST/Type.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class ExtQuals;
6161
class QualType;
6262
class ConceptDecl;
6363
class TagDecl;
64+
class TemplateParameterList;
6465
class Type;
6566

6667
enum {
@@ -5358,15 +5359,18 @@ class alignas(8) TemplateSpecializationType
53585359
/// enclosing the template arguments.
53595360
void printTemplateArgumentList(raw_ostream &OS,
53605361
ArrayRef<TemplateArgument> Args,
5361-
const PrintingPolicy &Policy);
5362+
const PrintingPolicy &Policy,
5363+
const TemplateParameterList *TPL = nullptr);
53625364

53635365
void printTemplateArgumentList(raw_ostream &OS,
53645366
ArrayRef<TemplateArgumentLoc> Args,
5365-
const PrintingPolicy &Policy);
5367+
const PrintingPolicy &Policy,
5368+
const TemplateParameterList *TPL = nullptr);
53665369

53675370
void printTemplateArgumentList(raw_ostream &OS,
53685371
const TemplateArgumentListInfo &Args,
5369-
const PrintingPolicy &Policy);
5372+
const PrintingPolicy &Policy,
5373+
const TemplateParameterList *TPL = nullptr);
53705374

53715375
/// The injected class name of a C++ class template or class
53725376
/// template partial specialization. Used to record that a type was

clang/lib/AST/ASTImporter.cpp

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5152,8 +5152,6 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
51525152
// context. This context will be fixed when the actual template declaration
51535153
// is created.
51545154

5155-
// FIXME: Import default argument and constraint expression.
5156-
51575155
ExpectedSLoc BeginLocOrErr = import(D->getBeginLoc());
51585156
if (!BeginLocOrErr)
51595157
return BeginLocOrErr.takeError();
@@ -5200,6 +5198,14 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
52005198
ToIDC);
52015199
}
52025200

5201+
if (D->hasDefaultArgument()) {
5202+
Expected<TypeSourceInfo *> ToDefaultArgOrErr =
5203+
import(D->getDefaultArgumentInfo());
5204+
if (!ToDefaultArgOrErr)
5205+
return ToDefaultArgOrErr.takeError();
5206+
ToD->setDefaultArgument(*ToDefaultArgOrErr);
5207+
}
5208+
52035209
return ToD;
52045210
}
52055211

@@ -5215,15 +5221,22 @@ ASTNodeImporter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
52155221
if (Err)
52165222
return std::move(Err);
52175223

5218-
// FIXME: Import default argument.
5219-
52205224
NonTypeTemplateParmDecl *ToD = nullptr;
5221-
(void)GetImportedOrCreateDecl(
5222-
ToD, D, Importer.getToContext(),
5223-
Importer.getToContext().getTranslationUnitDecl(),
5224-
ToInnerLocStart, ToLocation, D->getDepth(),
5225-
D->getPosition(), ToDeclName.getAsIdentifierInfo(), ToType,
5226-
D->isParameterPack(), ToTypeSourceInfo);
5225+
if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(),
5226+
Importer.getToContext().getTranslationUnitDecl(),
5227+
ToInnerLocStart, ToLocation, D->getDepth(),
5228+
D->getPosition(),
5229+
ToDeclName.getAsIdentifierInfo(), ToType,
5230+
D->isParameterPack(), ToTypeSourceInfo))
5231+
return ToD;
5232+
5233+
if (D->hasDefaultArgument()) {
5234+
ExpectedExpr ToDefaultArgOrErr = import(D->getDefaultArgument());
5235+
if (!ToDefaultArgOrErr)
5236+
return ToDefaultArgOrErr.takeError();
5237+
ToD->setDefaultArgument(*ToDefaultArgOrErr);
5238+
}
5239+
52275240
return ToD;
52285241
}
52295242

@@ -5417,8 +5430,9 @@ ExpectedDecl ASTNodeImporter::VisitClassTemplateSpecializationDecl(
54175430

54185431
if (PrevDecl) {
54195432
if (IsStructuralMatch(D, PrevDecl)) {
5420-
if (D->isThisDeclarationADefinition() && PrevDecl->getDefinition()) {
5421-
Importer.MapImported(D, PrevDecl->getDefinition());
5433+
CXXRecordDecl *PrevDefinition = PrevDecl->getDefinition();
5434+
if (D->isThisDeclarationADefinition() && PrevDefinition) {
5435+
Importer.MapImported(D, PrevDefinition);
54225436
// Import those default field initializers which have been
54235437
// instantiated in the "From" context, but not in the "To" context.
54245438
for (auto *FromField : D->fields()) {
@@ -5440,7 +5454,7 @@ ExpectedDecl ASTNodeImporter::VisitClassTemplateSpecializationDecl(
54405454
//
54415455
// Generally, ASTCommon.h/DeclUpdateKind enum gives a very good hint
54425456
// what else could be fused during an AST merge.
5443-
return PrevDecl;
5457+
return PrevDefinition;
54445458
}
54455459
} else { // ODR violation.
54465460
// FIXME HandleNameConflict

0 commit comments

Comments
 (0)