summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-12-19 10:09:25 +0000
committerDaniel Jasper <djasper@google.com>2016-12-19 10:09:25 +0000
commit9932fa356f19703a93d630c8b424e9641e4aa0c2 (patch)
tree5729956a022175e1db6d0c410b2d85ecaab70e01 /include
parent895b5f639a673c8189c984d3c26c9237950257be (diff)
Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."
This reverts commit r290080 as it leads to many Clang crashes, e.g.: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/1814 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/AST/DeclCXX.h119
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h2
-rw-r--r--include/clang/Basic/DeclNodes.td1
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td7
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td5
-rw-r--r--include/clang/Parse/Parser.h6
-rw-r--r--include/clang/Sema/Sema.h16
-rw-r--r--include/clang/Sema/Template.h5
-rw-r--r--include/clang/Serialization/ASTBitCodes.h2
9 files changed, 17 insertions, 146 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 06ecd3c373..46434c4c7b 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -3140,77 +3140,6 @@ public:
friend class ASTDeclWriter;
};
-/// Represents a pack of using declarations that a single
-/// using-declarator pack-expanded into.
-///
-/// \code
-/// template<typename ...T> struct X : T... {
-/// using T::operator()...;
-/// using T::operator T...;
-/// };
-/// \endcode
-///
-/// In the second case above, the UsingPackDecl will have the name
-/// 'operator T' (which contains an unexpanded pack), but the individual
-/// UsingDecls and UsingShadowDecls will have more reasonable names.
-class UsingPackDecl final
- : public NamedDecl, public Mergeable<UsingPackDecl>,
- private llvm::TrailingObjects<UsingPackDecl, NamedDecl *> {
- void anchor() override;
-
- /// The UnresolvedUsingValueDecl or UnresolvedUsingTypenameDecl from
- /// which this waas instantiated.
- NamedDecl *InstantiatedFrom;
-
- /// The number of using-declarations created by this pack expansion.
- unsigned NumExpansions;
-
- UsingPackDecl(DeclContext *DC, NamedDecl *InstantiatedFrom,
- ArrayRef<NamedDecl *> UsingDecls)
- : NamedDecl(UsingPack, DC,
- InstantiatedFrom ? InstantiatedFrom->getLocation()
- : SourceLocation(),
- InstantiatedFrom ? InstantiatedFrom->getDeclName()
- : DeclarationName()),
- InstantiatedFrom(InstantiatedFrom), NumExpansions(UsingDecls.size()) {
- std::uninitialized_copy(UsingDecls.begin(), UsingDecls.end(),
- getTrailingObjects<NamedDecl *>());
- }
-
-public:
- /// Get the using declaration from which this was instantiated. This will
- /// always be an UnresolvedUsingValueDecl or an UnresolvedUsingTypenameDecl
- /// that is a pack expansion.
- NamedDecl *getInstantiatedFromUsingDecl() { return InstantiatedFrom; }
-
- /// Get the set of using declarations that this pack expanded into. Note that
- /// some of these may still be unresolved.
- ArrayRef<NamedDecl *> expansions() const {
- return llvm::makeArrayRef(getTrailingObjects<NamedDecl *>(), NumExpansions);
- }
-
- static UsingPackDecl *Create(ASTContext &C, DeclContext *DC,
- NamedDecl *InstantiatedFrom,
- ArrayRef<NamedDecl *> UsingDecls);
-
- static UsingPackDecl *CreateDeserialized(ASTContext &C, unsigned ID,
- unsigned NumExpansions);
-
- SourceRange getSourceRange() const override LLVM_READONLY {
- return InstantiatedFrom->getSourceRange();
- }
-
- UsingPackDecl *getCanonicalDecl() override { return getFirstDecl(); }
- const UsingPackDecl *getCanonicalDecl() const { return getFirstDecl(); }
-
- static bool classof(const Decl *D) { return classofKind(D->getKind()); }
- static bool classofKind(Kind K) { return K == UsingPack; }
-
- friend class ASTDeclReader;
- friend class ASTDeclWriter;
- friend TrailingObjects;
-};
-
/// \brief Represents a dependent using declaration which was not marked with
/// \c typename.
///
@@ -3229,9 +3158,6 @@ class UnresolvedUsingValueDecl : public ValueDecl,
/// \brief The source location of the 'using' keyword
SourceLocation UsingLocation;
- /// \brief If this is a pack expansion, the location of the '...'.
- SourceLocation EllipsisLoc;
-
/// \brief The nested-name-specifier that precedes the name.
NestedNameSpecifierLoc QualifierLoc;
@@ -3242,12 +3168,11 @@ class UnresolvedUsingValueDecl : public ValueDecl,
UnresolvedUsingValueDecl(DeclContext *DC, QualType Ty,
SourceLocation UsingLoc,
NestedNameSpecifierLoc QualifierLoc,
- const DeclarationNameInfo &NameInfo,
- SourceLocation EllipsisLoc)
+ const DeclarationNameInfo &NameInfo)
: ValueDecl(UnresolvedUsingValue, DC,
NameInfo.getLoc(), NameInfo.getName(), Ty),
- UsingLocation(UsingLoc), EllipsisLoc(EllipsisLoc),
- QualifierLoc(QualifierLoc), DNLoc(NameInfo.getInfo())
+ UsingLocation(UsingLoc), QualifierLoc(QualifierLoc),
+ DNLoc(NameInfo.getInfo())
{ }
public:
@@ -3273,20 +3198,10 @@ public:
return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
}
- /// \brief Determine whether this is a pack expansion.
- bool isPackExpansion() const {
- return EllipsisLoc.isValid();
- }
-
- /// \brief Get the location of the ellipsis if this is a pack expansion.
- SourceLocation getEllipsisLoc() const {
- return EllipsisLoc;
- }
-
static UnresolvedUsingValueDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc,
NestedNameSpecifierLoc QualifierLoc,
- const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc);
+ const DeclarationNameInfo &NameInfo);
static UnresolvedUsingValueDecl *
CreateDeserialized(ASTContext &C, unsigned ID);
@@ -3327,9 +3242,6 @@ class UnresolvedUsingTypenameDecl
/// \brief The source location of the 'typename' keyword
SourceLocation TypenameLocation;
- /// \brief If this is a pack expansion, the location of the '...'.
- SourceLocation EllipsisLoc;
-
/// \brief The nested-name-specifier that precedes the name.
NestedNameSpecifierLoc QualifierLoc;
@@ -3337,12 +3249,10 @@ class UnresolvedUsingTypenameDecl
SourceLocation TypenameLoc,
NestedNameSpecifierLoc QualifierLoc,
SourceLocation TargetNameLoc,
- IdentifierInfo *TargetName,
- SourceLocation EllipsisLoc)
+ IdentifierInfo *TargetName)
: TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName,
UsingLoc),
- TypenameLocation(TypenameLoc), EllipsisLoc(EllipsisLoc),
- QualifierLoc(QualifierLoc) { }
+ TypenameLocation(TypenameLoc), QualifierLoc(QualifierLoc) { }
friend class ASTDeclReader;
@@ -3362,25 +3272,10 @@ public:
return QualifierLoc.getNestedNameSpecifier();
}
- DeclarationNameInfo getNameInfo() const {
- return DeclarationNameInfo(getDeclName(), getLocation());
- }
-
- /// \brief Determine whether this is a pack expansion.
- bool isPackExpansion() const {
- return EllipsisLoc.isValid();
- }
-
- /// \brief Get the location of the ellipsis if this is a pack expansion.
- SourceLocation getEllipsisLoc() const {
- return EllipsisLoc;
- }
-
static UnresolvedUsingTypenameDecl *
Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc,
SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc,
- SourceLocation TargetNameLoc, DeclarationName TargetName,
- SourceLocation EllipsisLoc);
+ SourceLocation TargetNameLoc, DeclarationName TargetName);
static UnresolvedUsingTypenameDecl *
CreateDeserialized(ASTContext &C, unsigned ID);
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index afacfd5723..058ab1fcbe 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -1505,8 +1505,6 @@ DEF_TRAVERSE_DECL(UsingDecl, {
TRY_TO(TraverseDeclarationNameInfo(D->getNameInfo()));
})
-DEF_TRAVERSE_DECL(UsingPackDecl, {})
-
DEF_TRAVERSE_DECL(UsingDirectiveDecl, {
TRY_TO(TraverseNestedNameSpecifierLoc(D->getQualifierLoc()));
})
diff --git a/include/clang/Basic/DeclNodes.td b/include/clang/Basic/DeclNodes.td
index 7b581d3eec..6da2c2c3d6 100644
--- a/include/clang/Basic/DeclNodes.td
+++ b/include/clang/Basic/DeclNodes.td
@@ -67,7 +67,6 @@ def Named : Decl<1>;
def TemplateTemplateParm : DDecl<Template>;
def BuiltinTemplate : DDecl<Template>;
def Using : DDecl<Named>;
- def UsingPack : DDecl<Named>;
def UsingShadow : DDecl<Named>;
def ConstructorUsingShadow : DDecl<UsingShadow>;
def ObjCMethod : DDecl<Named>, DeclContext;
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index b5f3246e53..0ebf34802b 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -740,8 +740,6 @@ def err_alias_declaration_not_identifier : Error<
"name defined in alias declaration must be an identifier">;
def err_alias_declaration_specialization : Error<
"%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">;
-def err_alias_declaration_pack_expansion : Error<
- "alias declaration cannot be a pack expansion">;
// C++1z using-declaration pack expansions
def ext_multi_using_declaration : ExtWarn<
@@ -751,11 +749,6 @@ def warn_cxx1z_compat_multi_using_declaration : Warning<
"use of multiple declarators in a single using declaration is "
"incompatible with C++ standards before C++1z">,
InGroup<CXXPre1zCompat>, DefaultIgnore;
-def ext_using_declaration_pack : ExtWarn<
- "pack expansion of using declaration is a C++1z extension">, InGroup<CXX1z>;
-def warn_cxx1z_compat_using_declaration_pack : Warning<
- "pack expansion using declaration is incompatible with C++ standards "
- "before C++1z">, InGroup<CXXPre1zCompat>, DefaultIgnore;
// C++11 override control
def ext_override_control_keyword : ExtWarn<
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index e98d282a21..73f7f4ddd6 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -474,8 +474,6 @@ def err_using_decl_conflict : Error<
def err_using_decl_conflict_reverse : Error<
"declaration conflicts with target of using declaration already in scope">;
def note_using_decl : Note<"%select{|previous }0using declaration">;
-def err_using_decl_redeclaration_expansion : Error<
- "using declaration pack expansion at block scope produces multiple values">;
def warn_access_decl_deprecated : Warning<
"access declarations are deprecated; use using declarations instead">,
@@ -4157,9 +4155,6 @@ def err_variable_instantiates_to_function : Error<
def err_nested_name_spec_non_tag : Error<
"type %0 cannot be used prior to '::' because it has no members">;
-def err_using_pack_expansion_empty : Error<
- "%select{|member}0 using declaration %1 instantiates to an empty pack">;
-
// C++ Explicit Instantiation
def err_explicit_instantiation_duplicate : Error<
"duplicate explicit instantiation of %0">;
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 972f13daca..3d098fab84 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -2436,10 +2436,9 @@ private:
CXXScopeSpec SS;
SourceLocation TemplateKWLoc;
UnqualifiedId Name;
- SourceLocation EllipsisLoc;
void clear() {
- TypenameLoc = TemplateKWLoc = EllipsisLoc = SourceLocation();
+ TypenameLoc = TemplateKWLoc = SourceLocation();
SS.clear();
Name.clear();
}
@@ -2451,6 +2450,9 @@ private:
SourceLocation UsingLoc,
SourceLocation &DeclEnd,
AccessSpecifier AS = AS_none);
+ Decl *ParseAliasTemplate(const ParsedTemplateInfo &TemplateInfo,
+ SourceLocation &DeclEnd, AccessSpecifier AS,
+ ParsedAttributesWithRange &MisplacedAttrs1);
Decl *ParseAliasDeclarationAfterDeclarator(
const ParsedTemplateInfo &TemplateInfo, SourceLocation UsingLoc,
UsingDeclarator &D, SourceLocation &DeclEnd, AccessSpecifier AS,
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index ebbc1e1b3e..136f848338 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -4324,15 +4324,12 @@ public:
NamedDecl *BuildUsingDeclaration(Scope *S, AccessSpecifier AS,
SourceLocation UsingLoc,
- bool HasTypenameKeyword,
- SourceLocation TypenameLoc,
CXXScopeSpec &SS,
DeclarationNameInfo NameInfo,
- SourceLocation EllipsisLoc,
AttributeList *AttrList,
- bool IsInstantiation);
- NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
- ArrayRef<NamedDecl *> Expansions);
+ bool IsInstantiation,
+ bool HasTypenameKeyword,
+ SourceLocation TypenameLoc);
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD);
@@ -4346,11 +4343,10 @@ public:
Decl *ActOnUsingDeclaration(Scope *CurScope,
AccessSpecifier AS,
SourceLocation UsingLoc,
- SourceLocation TypenameLoc,
CXXScopeSpec &SS,
UnqualifiedId &Name,
- SourceLocation EllipsisLoc,
- AttributeList *AttrList);
+ AttributeList *AttrList,
+ SourceLocation TypenameLoc);
Decl *ActOnAliasDeclaration(Scope *CurScope,
AccessSpecifier AS,
MultiTemplateParamsArg TemplateParams,
@@ -6355,7 +6351,7 @@ public:
///
/// \param SS The nested-name-specifier that will be traversed to find
/// unexpanded parameter packs.
- void collectUnexpandedParameterPacks(NestedNameSpecifierLoc NNS,
+ void collectUnexpandedParameterPacks(CXXScopeSpec &SS,
SmallVectorImpl<UnexpandedParameterPack> &Unexpanded);
/// \brief Collect the set of unexpanded parameter packs within the given
diff --git a/include/clang/Sema/Template.h b/include/clang/Sema/Template.h
index 401bbbf1e5..0d12880354 100644
--- a/include/clang/Sema/Template.h
+++ b/include/clang/Sema/Template.h
@@ -515,11 +515,6 @@ namespace clang {
VarTemplateDecl *VarTemplate,
VarTemplatePartialSpecializationDecl *PartialSpec);
void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern);
-
- private:
- template<typename T>
- Decl *instantiateUnresolvedUsingDecl(T *D,
- bool InstantiatingPackElement = false);
};
}
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 4e29ad6a02..611c00d0e9 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -1103,8 +1103,6 @@ namespace clang {
DECL_NAMESPACE_ALIAS,
/// \brief A UsingDecl record.
DECL_USING,
- /// \brief A UsingPackDecl record.
- DECL_USING_PACK,
/// \brief A UsingShadowDecl record.
DECL_USING_SHADOW,
/// \brief A ConstructorUsingShadowDecl record.