summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-12-16 00:58:48 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-12-16 00:58:48 +0000
commit57dd102ec8ab2e463113c75f4656c90a1209f4aa (patch)
tree028b2d88f82255e8fc149f02cca8deeec5498dfe /include
parente3521eb182b2a93328cf6bbb96120af6bc6ca104 (diff)
[c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td9
-rw-r--r--include/clang/Parse/Parser.h47
-rw-r--r--include/clang/Sema/Sema.h2
3 files changed, 45 insertions, 13 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index 8aa3e1ccb3..f6d8b3ad54 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -741,6 +741,15 @@ def err_alias_declaration_not_identifier : Error<
def err_alias_declaration_specialization : Error<
"%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">;
+// C++1z using-declaration pack expansions
+def ext_multi_using_declaration : ExtWarn<
+ "use of multiple declarators in a single using declaration is "
+ "a C++1z extension">, InGroup<CXX1z>;
+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;
+
// C++11 override control
def ext_override_control_keyword : ExtWarn<
"'%0' keyword is a C++11 extension">, InGroup<CXX11>;
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index c956aaeffc..3d098fab84 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -1261,6 +1261,11 @@ private:
ParsedAttributesWithRange(AttributeFactory &factory)
: ParsedAttributes(factory) {}
+ void clear() {
+ ParsedAttributes::clear();
+ Range = SourceRange();
+ }
+
SourceRange Range;
};
@@ -2418,21 +2423,41 @@ private:
BalancedDelimiterTracker &Tracker);
Decl *ParseLinkage(ParsingDeclSpec &DS, unsigned Context);
Decl *ParseExportDeclaration();
- Decl *ParseUsingDirectiveOrDeclaration(unsigned Context,
- const ParsedTemplateInfo &TemplateInfo,
- SourceLocation &DeclEnd,
- ParsedAttributesWithRange &attrs,
- Decl **OwnedType = nullptr);
+ DeclGroupPtrTy ParseUsingDirectiveOrDeclaration(
+ unsigned Context, const ParsedTemplateInfo &TemplateInfo,
+ SourceLocation &DeclEnd, ParsedAttributesWithRange &attrs);
Decl *ParseUsingDirective(unsigned Context,
SourceLocation UsingLoc,
SourceLocation &DeclEnd,
ParsedAttributes &attrs);
- Decl *ParseUsingDeclaration(unsigned Context,
- const ParsedTemplateInfo &TemplateInfo,
- SourceLocation UsingLoc,
- SourceLocation &DeclEnd,
- AccessSpecifier AS = AS_none,
- Decl **OwnedType = nullptr);
+
+ struct UsingDeclarator {
+ SourceLocation TypenameLoc;
+ CXXScopeSpec SS;
+ SourceLocation TemplateKWLoc;
+ UnqualifiedId Name;
+
+ void clear() {
+ TypenameLoc = TemplateKWLoc = SourceLocation();
+ SS.clear();
+ Name.clear();
+ }
+ };
+
+ bool ParseUsingDeclarator(unsigned Context, UsingDeclarator &D);
+ DeclGroupPtrTy ParseUsingDeclaration(unsigned Context,
+ const ParsedTemplateInfo &TemplateInfo,
+ 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,
+ ParsedAttributes &Attrs, Decl **OwnedType = nullptr);
+
Decl *ParseStaticAssertDeclaration(SourceLocation &DeclEnd);
Decl *ParseNamespaceAlias(SourceLocation NamespaceLoc,
SourceLocation AliasLoc, IdentifierInfo *Alias,
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 2028d2cd78..e5b08b01a7 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -4341,12 +4341,10 @@ public:
Decl *ActOnUsingDeclaration(Scope *CurScope,
AccessSpecifier AS,
- bool HasUsingKeyword,
SourceLocation UsingLoc,
CXXScopeSpec &SS,
UnqualifiedId &Name,
AttributeList *AttrList,
- bool HasTypenameKeyword,
SourceLocation TypenameLoc);
Decl *ActOnAliasDeclaration(Scope *CurScope,
AccessSpecifier AS,