[cfe-commits] r111584 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/AST/ExprCXX.h lib/AST/Expr.cpp lib/AST/ExprCXX.cpp lib/AST/StmtPrinter.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp

John McCall rjmccall at apple.com
Thu Aug 19 16:49:38 PDT 2010


Author: rjmccall
Date: Thu Aug 19 18:49:38 2010
New Revision: 111584

URL: http://llvm.org/viewvc/llvm-project?rev=111584&view=rev
Log:
Regularize the API for accessing explicit template arguments.


Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/include/clang/AST/ExprCXX.h
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/lib/AST/ExprCXX.cpp
    cfe/trunk/lib/AST/StmtPrinter.cpp
    cfe/trunk/lib/Sema/TreeTransform.h
    cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
    cfe/trunk/lib/Serialization/ASTWriterStmt.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu Aug 19 18:49:38 2010
@@ -542,26 +542,7 @@
   const NameQualifier *getNameQualifier() const {
     return const_cast<DeclRefExpr *>(this)->getNameQualifier();
   }
-  
-  /// \brief Retrieve the explicit template argument list that followed the
-  /// member template name, if any.
-  ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
-    if ((DecoratedD.getInt() & HasExplicitTemplateArgumentListFlag) == 0)
-      return 0;
-    
-    if ((DecoratedD.getInt() & HasQualifierFlag) == 0)
-      return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
-    
-    return reinterpret_cast<ExplicitTemplateArgumentList *>(
-                                                      getNameQualifier() + 1);
-  }
-  
-  /// \brief Retrieve the explicit template argument list that followed the
-  /// member template name, if any.
-  const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
-    return const_cast<DeclRefExpr *>(this)->getExplicitTemplateArgumentList();
-  }
-  
+
   DeclRefExpr(NestedNameSpecifier *Qualifier, SourceRange QualifierRange,
               ValueDecl *D, SourceLocation NameLoc,
               const TemplateArgumentListInfo *TemplateArgs,
@@ -641,53 +622,77 @@
     return getNameQualifier()->NNS;
   }
   
-  /// \brief Determines whether this member expression actually had a C++
-  /// template argument list explicitly specified, e.g., x.f<int>.
-  bool hasExplicitTemplateArgumentList() const {
-    return DecoratedD.getInt() & HasExplicitTemplateArgumentListFlag;
+  bool hasExplicitTemplateArgs() const {
+    return (DecoratedD.getInt() & HasExplicitTemplateArgumentListFlag);
+  }
+  
+  /// \brief Retrieve the explicit template argument list that followed the
+  /// member template name.
+  ExplicitTemplateArgumentList &getExplicitTemplateArgs() {
+    assert(hasExplicitTemplateArgs());
+
+    if ((DecoratedD.getInt() & HasQualifierFlag) == 0)
+      return *reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
+    
+    return *reinterpret_cast<ExplicitTemplateArgumentList *>(
+                                                      getNameQualifier() + 1);
+  }
+  
+  /// \brief Retrieve the explicit template argument list that followed the
+  /// member template name.
+  const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const {
+    return const_cast<DeclRefExpr *>(this)->getExplicitTemplateArgs();
   }
 
+  /// \brief Retrieves the optional explicit template arguments.
+  /// This points to the same data as getExplicitTemplateArgs(), but
+  /// returns null if there are no explicit template arguments.
+  const ExplicitTemplateArgumentList *getExplicitTemplateArgsOpt() const {
+    if (!hasExplicitTemplateArgs()) return 0;
+    return &getExplicitTemplateArgs();
+  }
+  
   /// \brief Copies the template arguments (if present) into the given
   /// structure.
   void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
-    if (hasExplicitTemplateArgumentList())
-      getExplicitTemplateArgumentList()->copyInto(List);
+    if (hasExplicitTemplateArgs())
+      getExplicitTemplateArgs().copyInto(List);
   }
   
   /// \brief Retrieve the location of the left angle bracket following the
   /// member name ('<'), if any.
   SourceLocation getLAngleLoc() const {
-    if (!hasExplicitTemplateArgumentList())
+    if (!hasExplicitTemplateArgs())
       return SourceLocation();
     
-    return getExplicitTemplateArgumentList()->LAngleLoc;
+    return getExplicitTemplateArgs().LAngleLoc;
   }
   
   /// \brief Retrieve the template arguments provided as part of this
   /// template-id.
   const TemplateArgumentLoc *getTemplateArgs() const {
-    if (!hasExplicitTemplateArgumentList())
+    if (!hasExplicitTemplateArgs())
       return 0;
     
-    return getExplicitTemplateArgumentList()->getTemplateArgs();
+    return getExplicitTemplateArgs().getTemplateArgs();
   }
   
   /// \brief Retrieve the number of template arguments provided as part of this
   /// template-id.
   unsigned getNumTemplateArgs() const {
-    if (!hasExplicitTemplateArgumentList())
+    if (!hasExplicitTemplateArgs())
       return 0;
     
-    return getExplicitTemplateArgumentList()->NumTemplateArgs;
+    return getExplicitTemplateArgs().NumTemplateArgs;
   }
   
   /// \brief Retrieve the location of the right angle bracket following the
   /// template arguments ('>').
   SourceLocation getRAngleLoc() const {
-    if (!hasExplicitTemplateArgumentList())
+    if (!hasExplicitTemplateArgs())
       return SourceLocation();
     
-    return getExplicitTemplateArgumentList()->RAngleLoc;
+    return getExplicitTemplateArgs().RAngleLoc;
   }
   
   static bool classof(const Stmt *T) {
@@ -1630,25 +1635,6 @@
     return const_cast<MemberExpr *>(this)->getMemberQualifier();
   }
 
-  /// \brief Retrieve the explicit template argument list that followed the
-  /// member template name, if any.
-  ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
-    if (!HasExplicitTemplateArgumentList)
-      return 0;
-
-    if (!HasQualifierOrFoundDecl)
-      return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
-
-    return reinterpret_cast<ExplicitTemplateArgumentList *>(
-                                                      getMemberQualifier() + 1);
-  }
-
-  /// \brief Retrieve the explicit template argument list that followed the
-  /// member template name, if any.
-  const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
-    return const_cast<MemberExpr *>(this)->getExplicitTemplateArgumentList();
-  }
-
 public:
   MemberExpr(Expr *base, bool isarrow, ValueDecl *memberdecl,
              const DeclarationNameInfo &NameInfo, QualType ty)
@@ -1724,15 +1710,42 @@
 
   /// \brief Determines whether this member expression actually had a C++
   /// template argument list explicitly specified, e.g., x.f<int>.
-  bool hasExplicitTemplateArgumentList() const {
+  bool hasExplicitTemplateArgs() const {
     return HasExplicitTemplateArgumentList;
   }
 
   /// \brief Copies the template arguments (if present) into the given
   /// structure.
   void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
-    if (hasExplicitTemplateArgumentList())
-      getExplicitTemplateArgumentList()->copyInto(List);
+    if (hasExplicitTemplateArgs())
+      getExplicitTemplateArgs().copyInto(List);
+  }
+
+  /// \brief Retrieve the explicit template argument list that
+  /// follow the member template name.  This must only be called on an
+  /// expression with explicit template arguments.
+  ExplicitTemplateArgumentList &getExplicitTemplateArgs() {
+    assert(HasExplicitTemplateArgumentList);
+    if (!HasQualifierOrFoundDecl)
+      return *reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
+
+    return *reinterpret_cast<ExplicitTemplateArgumentList *>(
+                                                      getMemberQualifier() + 1);
+  }
+
+  /// \brief Retrieve the explicit template argument list that
+  /// followed the member template name.  This must only be called on
+  /// an expression with explicit template arguments.
+  const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const {
+    return const_cast<MemberExpr *>(this)->getExplicitTemplateArgs();
+  }
+
+  /// \brief Retrieves the optional explicit template arguments.
+  /// This points to the same data as getExplicitTemplateArgs(), but
+  /// returns null if there are no explicit template arguments.
+  const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() const {
+    if (!hasExplicitTemplateArgs()) return 0;
+    return &getExplicitTemplateArgs();
   }
   
   /// \brief Retrieve the location of the left angle bracket following the
@@ -1741,7 +1754,7 @@
     if (!HasExplicitTemplateArgumentList)
       return SourceLocation();
 
-    return getExplicitTemplateArgumentList()->LAngleLoc;
+    return getExplicitTemplateArgs().LAngleLoc;
   }
 
   /// \brief Retrieve the template arguments provided as part of this
@@ -1750,7 +1763,7 @@
     if (!HasExplicitTemplateArgumentList)
       return 0;
 
-    return getExplicitTemplateArgumentList()->getTemplateArgs();
+    return getExplicitTemplateArgs().getTemplateArgs();
   }
 
   /// \brief Retrieve the number of template arguments provided as part of this
@@ -1759,7 +1772,7 @@
     if (!HasExplicitTemplateArgumentList)
       return 0;
 
-    return getExplicitTemplateArgumentList()->NumTemplateArgs;
+    return getExplicitTemplateArgs().NumTemplateArgs;
   }
 
   /// \brief Retrieve the location of the right angle bracket following the
@@ -1768,7 +1781,7 @@
     if (!HasExplicitTemplateArgumentList)
       return SourceLocation();
 
-    return getExplicitTemplateArgumentList()->RAngleLoc;
+    return getExplicitTemplateArgs().RAngleLoc;
   }
 
   /// \brief Retrieve the member declaration name info.

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Aug 19 18:49:38 2010
@@ -1500,10 +1500,12 @@
     return const_cast<OverloadExpr*>(this)->getExplicitTemplateArgs();
   }
 
-  ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() {
-    if (hasExplicitTemplateArgs())
-      return &getExplicitTemplateArgs();
-    return 0;
+  /// \brief Retrieves the optional explicit template arguments.
+  /// This points to the same data as getExplicitTemplateArgs(), but
+  /// returns null if there are no explicit template arguments.
+  const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() {
+    if (!hasExplicitTemplateArgs()) return 0;
+    return &getExplicitTemplateArgs();
   }
 
   static bool classof(const Stmt *T) {
@@ -1618,6 +1620,14 @@
     return *reinterpret_cast<const ExplicitTemplateArgumentList*>(this + 1);
   }
 
+  /// \brief Retrieves the optional explicit template arguments.
+  /// This points to the same data as getExplicitTemplateArgs(), but
+  /// returns null if there are no explicit template arguments.
+  const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() {
+    if (!hasExplicitTemplateArgs()) return 0;
+    return &getExplicitTemplateArgs();
+  }
+
   /// \brief Copies the template arguments (if present) into the given
   /// structure.
   void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
@@ -1744,6 +1754,14 @@
     return *reinterpret_cast<const ExplicitTemplateArgumentList*>(this + 1);
   }
 
+  /// \brief Retrieves the optional explicit template arguments.
+  /// This points to the same data as getExplicitTemplateArgs(), but
+  /// returns null if there are no explicit template arguments.
+  const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() {
+    if (!hasExplicitTemplateArgs()) return 0;
+    return &getExplicitTemplateArgs();
+  }
+
   /// \brief Copies the template arguments (if present) into the given
   /// structure.
   void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
@@ -2118,57 +2136,59 @@
 
   /// \brief Retrieve the explicit template argument list that followed the
   /// member template name, if any.
-  ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
+  ExplicitTemplateArgumentList &getExplicitTemplateArgs() {
     assert(HasExplicitTemplateArgs);
-    return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
+    return *reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
   }
 
   /// \brief Retrieve the explicit template argument list that followed the
   /// member template name, if any.
-  const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
+  const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const {
     return const_cast<CXXDependentScopeMemberExpr *>(this)
-             ->getExplicitTemplateArgumentList();
+             ->getExplicitTemplateArgs();
+  }
+
+  /// \brief Retrieves the optional explicit template arguments.
+  /// This points to the same data as getExplicitTemplateArgs(), but
+  /// returns null if there are no explicit template arguments.
+  const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() {
+    if (!hasExplicitTemplateArgs()) return 0;
+    return &getExplicitTemplateArgs();
   }
 
   /// \brief Copies the template arguments (if present) into the given
   /// structure.
   void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
-    assert(HasExplicitTemplateArgs);
-    getExplicitTemplateArgumentList()->copyInto(List);
+    getExplicitTemplateArgs().copyInto(List);
   }
 
   /// \brief Initializes the template arguments using the given structure.
   void initializeTemplateArgumentsFrom(const TemplateArgumentListInfo &List) {
-    assert(HasExplicitTemplateArgs);
-    getExplicitTemplateArgumentList()->initializeFrom(List);
+    getExplicitTemplateArgs().initializeFrom(List);
   }
 
   /// \brief Retrieve the location of the left angle bracket following the
   /// member name ('<'), if any.
   SourceLocation getLAngleLoc() const {
-    assert(HasExplicitTemplateArgs);
-    return getExplicitTemplateArgumentList()->LAngleLoc;
+    return getExplicitTemplateArgs().LAngleLoc;
   }
 
   /// \brief Retrieve the template arguments provided as part of this
   /// template-id.
   const TemplateArgumentLoc *getTemplateArgs() const {
-    assert(HasExplicitTemplateArgs);
-    return getExplicitTemplateArgumentList()->getTemplateArgs();
+    return getExplicitTemplateArgs().getTemplateArgs();
   }
 
   /// \brief Retrieve the number of template arguments provided as part of this
   /// template-id.
   unsigned getNumTemplateArgs() const {
-    assert(HasExplicitTemplateArgs);
-    return getExplicitTemplateArgumentList()->NumTemplateArgs;
+    return getExplicitTemplateArgs().NumTemplateArgs;
   }
 
   /// \brief Retrieve the location of the right angle bracket following the
   /// template arguments ('>').
   SourceLocation getRAngleLoc() const {
-    assert(HasExplicitTemplateArgs);
-    return getExplicitTemplateArgumentList()->RAngleLoc;
+    return getExplicitTemplateArgs().RAngleLoc;
   }
 
   virtual SourceRange getSourceRange() const {
@@ -2324,6 +2344,14 @@
     return *reinterpret_cast<const ExplicitTemplateArgumentList *>(this + 1);
   }
 
+  /// \brief Retrieves the optional explicit template arguments.
+  /// This points to the same data as getExplicitTemplateArgs(), but
+  /// returns null if there are no explicit template arguments.
+  const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() {
+    if (!hasExplicitTemplateArgs()) return 0;
+    return &getExplicitTemplateArgs();
+  }
+
   /// \brief Copies the template arguments into the given structure.
   void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
     getExplicitTemplateArgs().copyInto(List);

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Thu Aug 19 18:49:38 2010
@@ -151,7 +151,7 @@
     ValueDependent = true;
   }
   //  (TD)  - a template-id that is dependent,
-  else if (hasExplicitTemplateArgumentList() && 
+  else if (hasExplicitTemplateArgs() && 
            TemplateSpecializationType::anyDependentTemplateArguments(
                                                        getTemplateArgs(), 
                                                        getNumTemplateArgs())) {
@@ -204,7 +204,7 @@
   }
       
   if (TemplateArgs)
-    getExplicitTemplateArgumentList()->initializeFrom(*TemplateArgs);
+    getExplicitTemplateArgs().initializeFrom(*TemplateArgs);
 
   computeDependence();
 }
@@ -226,7 +226,7 @@
   }
 
   if (TemplateArgs)
-    getExplicitTemplateArgumentList()->initializeFrom(*TemplateArgs);
+    getExplicitTemplateArgs().initializeFrom(*TemplateArgs);
 
   computeDependence();
 }
@@ -279,7 +279,7 @@
   SourceRange R = getNameInfo().getSourceRange();
   if (hasQualifier())
     R.setBegin(getQualifierRange().getBegin());
-  if (hasExplicitTemplateArgumentList())
+  if (hasExplicitTemplateArgs())
     R.setEnd(getRAngleLoc());
   return R;
 }
@@ -686,7 +686,7 @@
 
   if (targs) {
     E->HasExplicitTemplateArgumentList = true;
-    E->getExplicitTemplateArgumentList()->initializeFrom(*targs);
+    E->getExplicitTemplateArgs().initializeFrom(*targs);
   }
 
   return E;

Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Thu Aug 19 18:49:38 2010
@@ -759,7 +759,7 @@
     FirstQualifierFoundInScope(FirstQualifierFoundInScope),
     MemberNameInfo(MemberNameInfo) {
   if (TemplateArgs)
-    getExplicitTemplateArgumentList()->initializeFrom(*TemplateArgs);
+    getExplicitTemplateArgs().initializeFrom(*TemplateArgs);
 }
 
 CXXDependentScopeMemberExpr *

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Thu Aug 19 18:49:38 2010
@@ -470,7 +470,7 @@
   if (NestedNameSpecifier *Qualifier = Node->getQualifier())
     Qualifier->print(OS, Policy);
   OS << Node->getNameInfo();
-  if (Node->hasExplicitTemplateArgumentList())
+  if (Node->hasExplicitTemplateArgs())
     OS << TemplateSpecializationType::PrintTemplateArgumentList(
                                                     Node->getTemplateArgs(),
                                                     Node->getNumTemplateArgs(),
@@ -753,7 +753,7 @@
 
   OS << Node->getMemberNameInfo();
 
-  if (Node->hasExplicitTemplateArgumentList())
+  if (Node->hasExplicitTemplateArgs())
     OS << TemplateSpecializationType::PrintTemplateArgumentList(
                                                     Node->getTemplateArgs(),
                                                     Node->getNumTemplateArgs(),

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Aug 19 18:49:38 2010
@@ -4225,7 +4225,7 @@
       Qualifier == E->getQualifier() &&
       ND == E->getDecl() &&
       NameInfo.getName() == E->getDecl()->getDeclName() &&
-      !E->hasExplicitTemplateArgumentList()) {
+      !E->hasExplicitTemplateArgs()) {
 
     // Mark it referenced in the new context regardless.
     // FIXME: this is a bit instantiation-specific.
@@ -4235,7 +4235,7 @@
   }
 
   TemplateArgumentListInfo TransArgs, *TemplateArgs = 0;
-  if (E->hasExplicitTemplateArgumentList()) {
+  if (E->hasExplicitTemplateArgs()) {
     TemplateArgs = &TransArgs;
     TransArgs.setLAngleLoc(E->getLAngleLoc());
     TransArgs.setRAngleLoc(E->getRAngleLoc());
@@ -4513,7 +4513,7 @@
       Qualifier == E->getQualifier() &&
       Member == E->getMemberDecl() &&
       FoundDecl == E->getFoundDecl() &&
-      !E->hasExplicitTemplateArgumentList()) {
+      !E->hasExplicitTemplateArgs()) {
     
     // Mark it referenced in the new context regardless.
     // FIXME: this is a bit instantiation-specific.
@@ -4522,7 +4522,7 @@
   }
 
   TemplateArgumentListInfo TransArgs;
-  if (E->hasExplicitTemplateArgumentList()) {
+  if (E->hasExplicitTemplateArgs()) {
     TransArgs.setLAngleLoc(E->getLAngleLoc());
     TransArgs.setRAngleLoc(E->getRAngleLoc());
     for (unsigned I = 0, N = E->getNumTemplateArgs(); I != N; ++I) {
@@ -4550,7 +4550,7 @@
                                         E->getMemberNameInfo(),
                                         Member,
                                         FoundDecl,
-                                        (E->hasExplicitTemplateArgumentList()
+                                        (E->hasExplicitTemplateArgs()
                                            ? &TransArgs : 0),
                                         FirstQualifierInScope);
 }

Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Thu Aug 19 18:49:38 2010
@@ -398,7 +398,7 @@
   }
 
   if (NumTemplateArgs)
-    ReadExplicitTemplateArgumentList(*E->getExplicitTemplateArgumentList(),
+    ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(),
                                      NumTemplateArgs);
 
   E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++])));
@@ -1145,7 +1145,7 @@
   assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgs() &&
          "Read wrong record during creation ?");
   if (E->hasExplicitTemplateArgs())
-    ReadExplicitTemplateArgumentList(*E->getExplicitTemplateArgumentList(),
+    ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(),
                                      NumTemplateArgs);
 
   E->setBase(Reader.ReadSubExpr());

Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=111584&r1=111583&r2=111584&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Thu Aug 19 18:49:38 2010
@@ -369,7 +369,7 @@
 
   Record.push_back(E->hasQualifier());
   unsigned NumTemplateArgs = E->getNumTemplateArgs();
-  assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgumentList() &&
+  assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgs() &&
          "Template args list with no args ?");
   Record.push_back(NumTemplateArgs);
 
@@ -379,7 +379,7 @@
   }
 
   if (NumTemplateArgs)
-    AddExplicitTemplateArgumentList(*E->getExplicitTemplateArgumentList());
+    AddExplicitTemplateArgumentList(E->getExplicitTemplateArgs());
 
   Writer.AddDeclRef(E->getDecl(), Record);
   // FIXME: write DeclarationNameLoc.
@@ -535,7 +535,7 @@
   }
 
   unsigned NumTemplateArgs = E->getNumTemplateArgs();
-  assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgumentList() &&
+  assert((NumTemplateArgs != 0) == E->hasExplicitTemplateArgs() &&
          "Template args list with no args ?");
   Record.push_back(NumTemplateArgs);
   if (NumTemplateArgs) {
@@ -1159,8 +1159,7 @@
   // Don't emit anything here, NumTemplateArgs must be emitted first.
 
   if (E->hasExplicitTemplateArgs()) {
-    const ExplicitTemplateArgumentList &Args
-      = *E->getExplicitTemplateArgumentList();
+    const ExplicitTemplateArgumentList &Args = E->getExplicitTemplateArgs();
     assert(Args.NumTemplateArgs &&
            "Num of template args was zero! AST reading will mess up!");
     Record.push_back(Args.NumTemplateArgs);





More information about the cfe-commits mailing list