Commit 62e4b501 authored by Jonas Devlieghere's avatar Jonas Devlieghere
Browse files
parent bb9b9640
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ class AtomicExpr;
class BlockExpr;
class BuiltinTemplateDecl;
class CharUnits;
class ConceptDecl;
class CXXABI;
class CXXConstructorDecl;
class CXXMethodDecl;
@@ -212,7 +211,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
  mutable llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
  mutable llvm::FoldingSet<DependentUnaryTransformType>
    DependentUnaryTransformTypes;
  mutable llvm::ContextualFoldingSet<AutoType, ASTContext&> AutoTypes;
  mutable llvm::FoldingSet<AutoType> AutoTypes;
  mutable llvm::FoldingSet<DeducedTemplateSpecializationType>
    DeducedTemplateSpecializationTypes;
  mutable llvm::FoldingSet<AtomicType> AtomicTypes;
@@ -1543,9 +1542,7 @@ public:

  /// C++11 deduced auto type.
  QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword,
                       bool IsDependent, bool IsPack = false,
                       ConceptDecl *TypeConstraintConcept = nullptr,
                       ArrayRef<TemplateArgument> TypeConstraintArgs ={}) const;
                       bool IsDependent, bool IsPack = false) const;

  /// C++11 deduction pattern for 'auto' type.
  QualType getAutoDeductType() const;
+2 −2
Original line number Diff line number Diff line
@@ -548,8 +548,8 @@ public:
  }

  void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
    if (const auto *E = D->getPlaceholderTypeConstraint())
      Visit(E);
    if (const auto *TC = D->getPlaceholderTypeConstraint())
      Visit(TC->getImmediatelyDeclaredConstraint());
    if (D->hasDefaultArgument())
      Visit(D->getDefaultArgument(), SourceRange(),
            D->getDefaultArgStorage().getInheritedFrom(),
+14 −29
Original line number Diff line number Diff line
@@ -1102,17 +1102,6 @@ public:
  /// template.
  ArrayRef<TemplateArgument> getInjectedTemplateArgs();

  /// Return whether this function template is an abbreviated function template,
  /// e.g. `void foo(auto x)` or `template<typename T> void foo(auto x)`
  bool isAbbreviated() const {
    // Since the invented template parameters generated from 'auto' parameters
    // are either appended to the end of the explicit template parameter list or
    // form a new template paramter list, we can simply observe the last
    // parameter to determine if such a thing happened.
    const TemplateParameterList *TPL = getTemplateParameters();
    return TPL->getParam(TPL->size() - 1)->isImplicit();
  }

  /// Merge \p Prev with our RedeclarableTemplateDecl::Common.
  void mergePrevDecl(FunctionTemplateDecl *Prev);

@@ -1226,6 +1215,7 @@ public:
                                      bool ParameterPack,
                                      bool HasTypeConstraint = false,
                                      Optional<unsigned> NumExpanded = None);

  static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
                                                  unsigned ID);
  static TemplateTypeParmDecl *CreateDeserialized(const ASTContext &C,
@@ -1384,8 +1374,7 @@ class NonTypeTemplateParmDecl final
    : public DeclaratorDecl,
      protected TemplateParmPosition,
      private llvm::TrailingObjects<NonTypeTemplateParmDecl,
                                    std::pair<QualType, TypeSourceInfo *>,
                                    Expr *> {
                                    std::pair<QualType, TypeSourceInfo *>> {
  friend class ASTDeclReader;
  friend TrailingObjects;

@@ -1440,12 +1429,10 @@ public:
         ArrayRef<TypeSourceInfo *> ExpandedTInfos);

  static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
                                                     unsigned ID,
                                                     bool HasTypeConstraint);
                                                     unsigned ID);
  static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
                                                     unsigned ID,
                                                     unsigned NumExpandedTypes,
                                                     bool HasTypeConstraint);
                                                     unsigned NumExpandedTypes);

  using TemplateParmPosition::getDepth;
  using TemplateParmPosition::setDepth;
@@ -1556,22 +1543,20 @@ public:
    return TypesAndInfos[I].second;
  }

  /// Return the constraint introduced by the placeholder type of this non-type
  /// Return the type-constraint in the placeholder type of this non-type
  /// template parameter (if any).
  Expr *getPlaceholderTypeConstraint() const {
    return hasPlaceholderTypeConstraint() ? *getTrailingObjects<Expr *>() :
        nullptr;
  }

  void setPlaceholderTypeConstraint(Expr *E) {
    *getTrailingObjects<Expr *>() = E;
  TypeConstraint *getPlaceholderTypeConstraint() const {
    // TODO: Concepts: Implement once we have actual placeholders with type
    //                 constraints.
    return nullptr;
  }

  /// Determine whether this non-type template parameter's type has a
  /// placeholder with a type-constraint.
  bool hasPlaceholderTypeConstraint() const {
    auto *AT = getType()->getContainedAutoType();
    return AT && AT->isConstrained();
    // TODO: Concepts: Implement once we have actual placeholders with type
    //                 constraints.
    return false;
  }

  /// \brief Get the associated-constraints of this template parameter.
@@ -1581,8 +1566,8 @@ public:
  /// Use this instead of getPlaceholderImmediatelyDeclaredConstraint for
  /// concepts APIs that accept an ArrayRef of constraint expressions.
  void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> &AC) const {
    if (Expr *E = getPlaceholderTypeConstraint())
      AC.push_back(E);
    if (TypeConstraint *TC = getPlaceholderTypeConstraint())
      AC.push_back(TC->getImmediatelyDeclaredConstraint());
  }

  // Implement isa/cast/dyncast/etc.
+0 −2
Original line number Diff line number Diff line
@@ -99,8 +99,6 @@ def DeclRef : RefPropertyType<"Decl"> { let ConstWhenWriting = 1; }
    SubclassPropertyType<"TagDecl", DeclRef>;
  def TemplateDeclRef :
    SubclassPropertyType<"TemplateDecl", DeclRef>;
  def ConceptDeclRef :
    SubclassPropertyType<"ConceptDecl", DeclRef>;
  def TemplateTypeParmDeclRef :
    SubclassPropertyType<"TemplateTypeParmDecl", DeclRef>;
  def TemplateTemplateParmDeclRef :
+1 −13
Original line number Diff line number Diff line
@@ -1040,13 +1040,7 @@ DEF_TRAVERSE_TYPE(UnaryTransformType, {
  TRY_TO(TraverseType(T->getUnderlyingType()));
})

DEF_TRAVERSE_TYPE(AutoType, {
  TRY_TO(TraverseType(T->getDeducedType()));
  if (T->isConstrained()) {
    TRY_TO(TraverseDecl(T->getTypeConstraintConcept()));
    TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
  }
})
DEF_TRAVERSE_TYPE(AutoType, { TRY_TO(TraverseType(T->getDeducedType())); })
DEF_TRAVERSE_TYPE(DeducedTemplateSpecializationType, {
  TRY_TO(TraverseTemplateName(T->getTemplateName()));
  TRY_TO(TraverseType(T->getDeducedType()));
@@ -1293,12 +1287,6 @@ DEF_TRAVERSE_TYPELOC(UnaryTransformType, {

DEF_TRAVERSE_TYPELOC(AutoType, {
  TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
  if (TL.isConstrained()) {
    TRY_TO(TraverseNestedNameSpecifierLoc(TL.getNestedNameSpecifierLoc()));
    TRY_TO(TraverseDeclarationNameInfo(TL.getConceptNameInfo()));
    for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
      TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
  }
})

DEF_TRAVERSE_TYPELOC(DeducedTemplateSpecializationType, {
Loading