]> granicus.if.org Git - clang/commitdiff
Check in UnresolvedUsingDecl.
authorAnders Carlsson <andersca@mac.com>
Fri, 28 Aug 2009 05:30:28 +0000 (05:30 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 28 Aug 2009 05:30:28 +0000 (05:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80336 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclCXX.h
include/clang/AST/DeclNodes.def
lib/AST/DeclBase.cpp
lib/AST/DeclCXX.cpp

index b08a51f016aa1e6beb88fe1f2f2762350d8448db..2d16557d95478f0a5fa2ea7794498c3dbd83cb8e 100644 (file)
@@ -1576,20 +1576,23 @@ public:
 /// UsingDecl - Represents a C++ using-declaration. For example:
 ///    using someNameSpace::someIdentifier;
 class UsingDecl : public NamedDecl {
-
   /// \brief The source range that covers the nested-name-specifier
   /// preceding the declaration name.
   SourceRange NestedNameRange;
+  
   /// \brief The source location of the target declaration name.
   SourceLocation TargetNameLocation;
+  
   /// \brief The source location of the "using" location itself.
   SourceLocation UsingLocation;
+  
   /// \brief Target declaration.
   NamedDecl* TargetDecl;
-  /// \brief Target declaration.
+  
+  /// \brief Target nested name specifier.
   NestedNameSpecifier* TargetNestedNameDecl;
 
-  // Had 'typename' keyword.
+  // \brief Has 'typename' keyword.
   bool IsTypeName;
 
   UsingDecl(DeclContext *DC, SourceLocation L, SourceRange NNR,
@@ -1635,6 +1638,47 @@ public:
   }
   static bool classof(const UsingDecl *D) { return true; }
 };
+
+/// UnresolvedUsingDecl - Represents a using declaration whose name can not
+/// yet be resolved.
+class UnresolvedUsingDecl : public NamedDecl {
+  /// \brief The source range that covers the nested-name-specifier
+  /// preceding the declaration name.
+  SourceRange TargetNestedNameRange;
+  
+  /// \brief The source location of the target declaration name.
+  SourceLocation TargetNameLocation;
+  
+  NestedNameSpecifier *TargetNestedNameSpecifier;
+  
+  DeclarationName TargetName;
+  
+  // \brief Has 'typename' keyword.
+  bool IsTypeName;
+  
+  UnresolvedUsingDecl(DeclContext *DC, SourceLocation UsingLoc,
+                      SourceRange TargetNNR, NestedNameSpecifier *TargetNNS,
+                      SourceLocation TargetNameLoc, DeclarationName TargetName,
+                      bool IsTypeNameArg)
+  : NamedDecl(Decl::UnresolvedUsing, DC, UsingLoc, TargetName),
+    TargetNestedNameRange(TargetNNR), TargetNameLocation(TargetNameLoc), 
+    TargetNestedNameSpecifier(TargetNNS), TargetName(TargetName), 
+    IsTypeName(IsTypeNameArg) { }
+
+public:
+  static UnresolvedUsingDecl *Create(ASTContext &C, DeclContext *DC,
+                                     SourceLocation UsingLoc,
+                                     SourceRange TargetNNR,
+                                     NestedNameSpecifier *TargetNNS,
+                                     SourceLocation TargetNameLoc,
+                                     DeclarationName TargetName,
+                                     bool IsTypeNameArg);
+  
+  static bool classof(const Decl *D) {
+    return D->getKind() == Decl::UnresolvedUsing;
+  }
+  static bool classof(const UnresolvedUsingDecl *D) { return true; }
+};
   
 /// StaticAssertDecl - Represents a C++0x static_assert declaration.
 class StaticAssertDecl : public Decl {
index 629197be599606bcb46419997f8b6f789a3d2dd2..996d042d14f131fee661b6e56285fef746ce6f82 100644 (file)
@@ -111,6 +111,7 @@ ABSTRACT_DECL(Named,  Decl)
     DECL(ClassTemplate, TemplateDecl)
     DECL(TemplateTemplateParm, TemplateDecl)
   DECL(Using, NamedDecl)
+  DECL(UnresolvedUsing, NamedDecl)
   DECL(ObjCMethod, NamedDecl)
   DECL(ObjCContainer, NamedDecl)
     DECL(ObjCCategory, ObjCContainerDecl)
index cd5b0063a63ed1869b8dcde84696ae0f2f7aca2c..28d543785fa259da13be99eafffb6b9d3f23b2d8 100644 (file)
@@ -191,6 +191,7 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
     case OriginalParmVar:
     case NonTypeTemplateParm:
     case Using:
+    case UnresolvedUsing:
     case ObjCMethod:
     case ObjCContainer:
     case ObjCCategory:
index e3a0f486d593c3fb99eedcfaad71dd6bccf87f96..70e48976daa90cd2ca756d3e9410e50c5f769b24 100644 (file)
@@ -832,6 +832,17 @@ UsingDecl *UsingDecl::Create(ASTContext &C, DeclContext *DC,
       TargetNNS, IsTypeNameArg);
 }
 
+UnresolvedUsingDecl *UnresolvedUsingDecl::Create(ASTContext &C, DeclContext *DC,
+                                                 SourceLocation UsingLoc,
+                                                 SourceRange TargetNNR,
+                                                 NestedNameSpecifier *TargetNNS,
+                                                 SourceLocation TargetNameLoc,
+                                                 DeclarationName TargetName,
+                                                 bool IsTypeNameArg) {
+  return new (C) UnresolvedUsingDecl(DC, UsingLoc, TargetNNR, TargetNNS,
+                                     TargetNameLoc, TargetName, IsTypeNameArg);
+}
+
 StaticAssertDecl *StaticAssertDecl::Create(ASTContext &C, DeclContext *DC,
                                            SourceLocation L, Expr *AssertExpr,
                                            StringLiteral *Message) {