[cfe-commits] r104468 - in /cfe/trunk: include/clang/AST/ExprCXX.h lib/AST/ExprCXX.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaOverload.cpp lib/Sema/SemaTemplate.cpp

Douglas Gregor dgregor at apple.com
Sun May 23 11:57:34 PDT 2010


Author: dgregor
Date: Sun May 23 13:57:34 2010
New Revision: 104468

URL: http://llvm.org/viewvc/llvm-project?rev=104468&view=rev
Log:
Provide the overloaded functions for UnresolvedLookupExpr and
UnresolvedMemberExpr in their constructors, rather than adding them
after the fact. No functionality change.


Modified:
    cfe/trunk/include/clang/AST/ExprCXX.h
    cfe/trunk/lib/AST/ExprCXX.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/lib/Sema/SemaTemplate.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=104468&r1=104467&r2=104468&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Sun May 23 13:57:34 2010
@@ -1366,11 +1366,14 @@
   OverloadExpr(StmtClass K, QualType T, bool Dependent,
                NestedNameSpecifier *Qualifier, SourceRange QRange,
                DeclarationName Name, SourceLocation NameLoc,
-               bool HasTemplateArgs)
+               bool HasTemplateArgs,
+               UnresolvedSetIterator Begin, UnresolvedSetIterator End)
     : Expr(K, T, Dependent, Dependent),
       Name(Name), Qualifier(Qualifier), QualifierRange(QRange),
       NameLoc(NameLoc), HasExplicitTemplateArgs(HasTemplateArgs)
-  {}
+  {
+    Results.append(Begin, End);
+  }
 
 public:
   /// Computes whether an unresolved lookup on the given declarations
@@ -1394,10 +1397,6 @@
     return llvm::PointerIntPair<OverloadExpr*,1>(cast<OverloadExpr>(E), op);
   }
 
-  void addDecls(UnresolvedSetIterator Begin, UnresolvedSetIterator End) {
-    Results.append(Begin, End);
-  }
-
   /// Gets the naming class of this lookup, if any.
   CXXRecordDecl *getNamingClass() const;
 
@@ -1405,9 +1404,6 @@
   decls_iterator decls_begin() const { return Results.begin(); }
   decls_iterator decls_end() const { return Results.end(); }
 
-  /// Gets the decls as an unresolved set.
-  const UnresolvedSetImpl &getDecls() { return Results; }
-
   /// Gets the number of declarations in the unresolved set.
   unsigned getNumDecls() const { return Results.size(); }
 
@@ -1478,9 +1474,10 @@
   UnresolvedLookupExpr(QualType T, bool Dependent, CXXRecordDecl *NamingClass,
                        NestedNameSpecifier *Qualifier, SourceRange QRange,
                        DeclarationName Name, SourceLocation NameLoc,
-                       bool RequiresADL, bool Overloaded, bool HasTemplateArgs)
+                       bool RequiresADL, bool Overloaded, bool HasTemplateArgs,
+                       UnresolvedSetIterator Begin, UnresolvedSetIterator End)
     : OverloadExpr(UnresolvedLookupExprClass, T, Dependent, Qualifier, QRange,
-                   Name, NameLoc, HasTemplateArgs),
+                   Name, NameLoc, HasTemplateArgs, Begin, End),
       RequiresADL(RequiresADL), Overloaded(Overloaded), NamingClass(NamingClass)
   {}
 
@@ -1492,11 +1489,14 @@
                                       SourceRange QualifierRange,
                                       DeclarationName Name,
                                       SourceLocation NameLoc,
-                                      bool ADL, bool Overloaded) {
+                                      bool ADL, bool Overloaded,
+                                      UnresolvedSetIterator Begin, 
+                                      UnresolvedSetIterator End) {
     return new(C) UnresolvedLookupExpr(Dependent ? C.DependentTy : C.OverloadTy,
                                        Dependent, NamingClass,
                                        Qualifier, QualifierRange,
-                                       Name, NameLoc, ADL, Overloaded, false);
+                                       Name, NameLoc, ADL, Overloaded, false,
+                                       Begin, End);
   }
 
   static UnresolvedLookupExpr *Create(ASTContext &C,
@@ -1507,7 +1507,9 @@
                                       DeclarationName Name,
                                       SourceLocation NameLoc,
                                       bool ADL,
-                                      const TemplateArgumentListInfo &Args);
+                                      const TemplateArgumentListInfo &Args,
+                                      UnresolvedSetIterator Begin, 
+                                      UnresolvedSetIterator End);
 
   /// True if this declaration should be extended by
   /// argument-dependent lookup.
@@ -2123,7 +2125,8 @@
                        SourceRange QualifierRange,
                        DeclarationName Member,
                        SourceLocation MemberLoc,
-                       const TemplateArgumentListInfo *TemplateArgs);
+                       const TemplateArgumentListInfo *TemplateArgs,
+                       UnresolvedSetIterator Begin, UnresolvedSetIterator End);
 
 public:
   static UnresolvedMemberExpr *
@@ -2134,7 +2137,8 @@
          SourceRange QualifierRange,
          DeclarationName Member,
          SourceLocation MemberLoc,
-         const TemplateArgumentListInfo *TemplateArgs);
+         const TemplateArgumentListInfo *TemplateArgs,
+         UnresolvedSetIterator Begin, UnresolvedSetIterator End);
 
   /// \brief True if this is an implicit access, i.e. one in which the
   /// member being accessed was not written in the source.  The source

Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=104468&r1=104467&r2=104468&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Sun May 23 13:57:34 2010
@@ -169,7 +169,9 @@
                              NestedNameSpecifier *Qualifier,
                              SourceRange QualifierRange, DeclarationName Name,
                              SourceLocation NameLoc, bool ADL,
-                             const TemplateArgumentListInfo &Args) 
+                             const TemplateArgumentListInfo &Args,
+                             UnresolvedSetIterator Begin, 
+                             UnresolvedSetIterator End) 
 {
   void *Mem = C.Allocate(sizeof(UnresolvedLookupExpr) + 
                          ExplicitTemplateArgumentList::sizeFor(Args));
@@ -179,7 +181,8 @@
                                      Qualifier, QualifierRange,
                                      Name, NameLoc, ADL,
                                      /*Overload*/ true,
-                                     /*ExplicitTemplateArgs*/ true);
+                                     /*ExplicitTemplateArgs*/ true,
+                                     Begin, End);
 
   reinterpret_cast<ExplicitTemplateArgumentList*>(ULE+1)->initializeFrom(Args);
 
@@ -709,10 +712,12 @@
                                            SourceRange QualifierRange,
                                            DeclarationName MemberName,
                                            SourceLocation MemberLoc,
-                                   const TemplateArgumentListInfo *TemplateArgs)
+                                   const TemplateArgumentListInfo *TemplateArgs,
+                                           UnresolvedSetIterator Begin, 
+                                           UnresolvedSetIterator End)
   : OverloadExpr(UnresolvedMemberExprClass, T, Dependent,
                  Qualifier, QualifierRange, MemberName, MemberLoc,
-                 TemplateArgs != 0),
+                 TemplateArgs != 0, Begin, End),
     IsArrow(IsArrow), HasUnresolvedUsing(HasUnresolvedUsing),
     Base(Base), BaseType(BaseType), OperatorLoc(OperatorLoc) {
   if (TemplateArgs)
@@ -728,7 +733,9 @@
                              SourceRange QualifierRange,
                              DeclarationName Member,
                              SourceLocation MemberLoc,
-                             const TemplateArgumentListInfo *TemplateArgs) {
+                             const TemplateArgumentListInfo *TemplateArgs,
+                             UnresolvedSetIterator Begin, 
+                             UnresolvedSetIterator End) {
   std::size_t size = sizeof(UnresolvedMemberExpr);
   if (TemplateArgs)
     size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs);
@@ -738,7 +745,7 @@
                              Dependent ? C.DependentTy : C.OverloadTy,
                              Dependent, HasUnresolvedUsing, Base, BaseType,
                              IsArrow, OperatorLoc, Qualifier, QualifierRange,
-                             Member, MemberLoc, TemplateArgs);
+                             Member, MemberLoc, TemplateArgs, Begin, End);
 }
 
 CXXRecordDecl *UnresolvedMemberExpr::getNamingClass() const {

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=104468&r1=104467&r2=104468&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun May 23 13:57:34 2010
@@ -1667,8 +1667,8 @@
                                    (NestedNameSpecifier*) SS.getScopeRep(),
                                    SS.getRange(),
                                    R.getLookupName(), R.getNameLoc(),
-                                   NeedsADL, R.isOverloadedResult());
-  ULE->addDecls(R.begin(), R.end());
+                                   NeedsADL, R.isOverloadedResult(),
+                                   R.begin(), R.end());
 
   return Owned(ULE);
 }
@@ -2729,8 +2729,7 @@
                                      IsArrow, OpLoc,
                                      Qualifier, SS.getRange(),
                                      MemberName, MemberLoc,
-                                     TemplateArgs);
-    MemExpr->addDecls(R.begin(), R.end());
+                                     TemplateArgs, R.begin(), R.end());
 
     return Owned(MemExpr);
   }

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=104468&r1=104467&r2=104468&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun May 23 13:57:34 2010
@@ -6285,9 +6285,8 @@
     UnresolvedLookupExpr *Fn
       = UnresolvedLookupExpr::Create(Context, /*Dependent*/ true, NamingClass,
                                      0, SourceRange(), OpName, OpLoc,
-                                     /*ADL*/ true, IsOverloaded(Fns));
-    Fn->addDecls(Fns.begin(), Fns.end());
-
+                                     /*ADL*/ true, IsOverloaded(Fns),
+                                     Fns.begin(), Fns.end());
     input.release();
     return Owned(new (Context) CXXOperatorCallExpr(Context, Op, Fn,
                                                    &Args[0], NumArgs,
@@ -6458,9 +6457,8 @@
     UnresolvedLookupExpr *Fn
       = UnresolvedLookupExpr::Create(Context, /*Dependent*/ true, NamingClass,
                                      0, SourceRange(), OpName, OpLoc,
-                                     /*ADL*/ true, IsOverloaded(Fns));
-
-    Fn->addDecls(Fns.begin(), Fns.end());
+                                     /*ADL*/ true, IsOverloaded(Fns),
+                                     Fns.begin(), Fns.end());
     return Owned(new (Context) CXXOperatorCallExpr(Context, Op, Fn,
                                                    Args, 2,
                                                    Context.DependentTy,
@@ -6656,7 +6654,9 @@
     UnresolvedLookupExpr *Fn
       = UnresolvedLookupExpr::Create(Context, /*Dependent*/ true, NamingClass,
                                      0, SourceRange(), OpName, LLoc,
-                                     /*ADL*/ true, /*Overloaded*/ false);
+                                     /*ADL*/ true, /*Overloaded*/ false,
+                                     UnresolvedSetIterator(),
+                                     UnresolvedSetIterator());
     // Can't add any actual overloads yet
 
     Base.release();

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=104468&r1=104467&r2=104468&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Sun May 23 13:57:34 2010
@@ -1637,8 +1637,8 @@
     = UnresolvedLookupExpr::Create(Context, Dependent, R.getNamingClass(),
                                    Qualifier, QualifierRange,
                                    R.getLookupName(), R.getNameLoc(),
-                                   RequiresADL, TemplateArgs);
-  ULE->addDecls(R.begin(), R.end());
+                                   RequiresADL, TemplateArgs, 
+                                   R.begin(), R.end());
 
   return Owned(ULE);
 }





More information about the cfe-commits mailing list