]> granicus.if.org Git - clang/commitdiff
Fixed InnerLocStart.
authorAbramo Bagnara <abramo.bagnara@gmail.com>
Wed, 9 Mar 2011 14:09:51 +0000 (14:09 +0000)
committerAbramo Bagnara <abramo.bagnara@gmail.com>
Wed, 9 Mar 2011 14:09:51 +0000 (14:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127330 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
include/clang/AST/Decl.h
include/clang/AST/DeclCXX.h
include/clang/AST/DeclTemplate.h
lib/AST/ASTContext.cpp
lib/AST/ASTImporter.cpp
lib/AST/Decl.cpp
lib/AST/DeclCXX.cpp
lib/AST/DeclTemplate.cpp
lib/CodeGen/CGObjCMac.cpp
lib/Rewrite/RewriteObjC.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp

index 016e2b338c4696657eab3613d43095d8707fa2ea..4fc9bf55a3e325509815b2eb9f535dc2a1e2e074 100644 (file)
@@ -569,7 +569,7 @@ public:
 
   /// getInnerLocStart - Return SourceLocation representing start of source
   /// range ignoring outer template declarations.
-  virtual SourceLocation getInnerLocStart() const { return InnerLocStart; }
+  SourceLocation getInnerLocStart() const { return InnerLocStart; }
   void setInnerLocStart(SourceLocation L) { InnerLocStart = L; }
 
   /// getOuterLocStart - Return SourceLocation representing start of source
@@ -2134,7 +2134,7 @@ public:
 
   /// getInnerLocStart - Return SourceLocation representing start of source
   /// range ignoring outer template declarations.
-  virtual SourceLocation getInnerLocStart() const { return getLocStart(); }
+  SourceLocation getInnerLocStart() const { return getLocStart(); }
 
   /// getOuterLocStart - Return SourceLocation representing start of source
   /// range taking into account any outer template declarations.
@@ -2296,10 +2296,10 @@ class EnumDecl : public TagDecl {
     NumBitsMask = (1 << NumBitsWidth) - 1
   };
 
-  EnumDecl(DeclContext *DC, SourceLocation L,
-           IdentifierInfo *Id, EnumDecl *PrevDecl, SourceLocation StartL,
+  EnumDecl(DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc,
+           IdentifierInfo *Id, EnumDecl *PrevDecl,
            bool Scoped, bool ScopedUsingClassTag, bool Fixed)
-    : TagDecl(Enum, TTK_Enum, DC, L, Id, PrevDecl, StartL),
+    : TagDecl(Enum, TTK_Enum, DC, IdLoc, Id, PrevDecl, StartLoc),
       InstantiatedFrom(0) {
     assert(Scoped || !ScopedUsingClassTag);
     IntegerType = (const Type*)0;
@@ -2325,8 +2325,8 @@ public:
   }
 
   static EnumDecl *Create(ASTContext &C, DeclContext *DC,
-                          SourceLocation L, IdentifierInfo *Id,
-                          SourceLocation StartL, EnumDecl *PrevDecl,
+                          SourceLocation StartLoc, SourceLocation IdLoc,
+                          IdentifierInfo *Id, EnumDecl *PrevDecl,
                           bool IsScoped, bool IsScopedUsingClassTag,
                           bool IsFixed);
   static EnumDecl *Create(ASTContext &C, EmptyShell Empty);
@@ -2481,14 +2481,13 @@ class RecordDecl : public TagDecl {
 
 protected:
   RecordDecl(Kind DK, TagKind TK, DeclContext *DC,
-             SourceLocation L, IdentifierInfo *Id,
-             RecordDecl *PrevDecl, SourceLocation StartL);
+             SourceLocation StartLoc, SourceLocation IdLoc,
+             IdentifierInfo *Id, RecordDecl *PrevDecl);
 
 public:
   static RecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC,
-                            SourceLocation L, IdentifierInfo *Id,
-                            SourceLocation StartL = SourceLocation(),
-                            RecordDecl* PrevDecl = 0);
+                            SourceLocation StartLoc, SourceLocation IdLoc,
+                            IdentifierInfo *Id, RecordDecl* PrevDecl = 0);
   static RecordDecl *Create(const ASTContext &C, EmptyShell Empty);
 
   const RecordDecl *getPreviousDeclaration() const {
index cc7d626d69b15ea4840338f9adabe6455258fa49..76510ca31483e9a4f7f6975bb969a98528079e45 100644 (file)
@@ -449,9 +449,8 @@ class CXXRecordDecl : public RecordDecl {
   
 protected:
   CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
-                SourceLocation L, IdentifierInfo *Id,
-                CXXRecordDecl *PrevDecl,
-                SourceLocation StartL = SourceLocation());
+                SourceLocation StartLoc, SourceLocation IdLoc,
+                IdentifierInfo *Id, CXXRecordDecl *PrevDecl);
 
 public:
   /// base_class_iterator - Iterator that traverses the base classes
@@ -494,9 +493,8 @@ public:
   bool hasDefinition() const { return DefinitionData != 0; }
 
   static CXXRecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC,
-                               SourceLocation L, IdentifierInfo *Id,
-                               SourceLocation StartL = SourceLocation(),
-                               CXXRecordDecl* PrevDecl=0,
+                               SourceLocation StartLoc, SourceLocation IdLoc,
+                               IdentifierInfo *Id, CXXRecordDecl* PrevDecl=0,
                                bool DelayTypeCreation = false);
   static CXXRecordDecl *Create(const ASTContext &C, EmptyShell Empty);
 
index 58186b3a3d30be9426b4b5ec4f4762046d61afc6..0fba9f62070a89cea97cb6d3f330ae3abe0d22b6 100644 (file)
@@ -1346,7 +1346,8 @@ class ClassTemplateSpecializationDecl
 
 protected:
   ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK,
-                                  DeclContext *DC, SourceLocation L,
+                                  DeclContext *DC, SourceLocation StartLoc,
+                                  SourceLocation IdLoc,
                                   ClassTemplateDecl *SpecializedTemplate,
                                   const TemplateArgument *Args,
                                   unsigned NumArgs,
@@ -1356,7 +1357,8 @@ protected:
 
 public:
   static ClassTemplateSpecializationDecl *
-  Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation L,
+  Create(ASTContext &Context, TagKind TK, DeclContext *DC,
+         SourceLocation StartLoc, SourceLocation IdLoc,
          ClassTemplateDecl *SpecializedTemplate,
          const TemplateArgument *Args,
          unsigned NumArgs,
@@ -1518,8 +1520,6 @@ public:
     return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
   }
 
-  SourceLocation getInnerLocStart() const { return getTemplateKeywordLoc(); }
-
   SourceRange getSourceRange() const;
 
   void Profile(llvm::FoldingSetNodeID &ID) const {
@@ -1576,7 +1576,9 @@ class ClassTemplatePartialSpecializationDecl
       InstantiatedFromMember;
     
   ClassTemplatePartialSpecializationDecl(ASTContext &Context, TagKind TK,
-                                         DeclContext *DC, SourceLocation L,
+                                         DeclContext *DC,
+                                         SourceLocation StartLoc,
+                                         SourceLocation IdLoc,
                                          TemplateParameterList *Params,
                                          ClassTemplateDecl *SpecializedTemplate,
                                          const TemplateArgument *Args,
@@ -1594,7 +1596,8 @@ class ClassTemplatePartialSpecializationDecl
 
 public:
   static ClassTemplatePartialSpecializationDecl *
-  Create(ASTContext &Context, TagKind TK,DeclContext *DC, SourceLocation L,
+  Create(ASTContext &Context, TagKind TK,DeclContext *DC,
+         SourceLocation StartLoc, SourceLocation IdLoc,
          TemplateParameterList *Params,
          ClassTemplateDecl *SpecializedTemplate,
          const TemplateArgument *Args,
index 674356245faf091f16e9a7b1ab173ed03a675485..fcfd230de0a91173e42833726c1c3f30fffa28db 100644 (file)
@@ -3361,19 +3361,20 @@ int ASTContext::getIntegerTypeOrder(QualType LHS, QualType RHS) const {
 }
 
 static RecordDecl *
-CreateRecordDecl(const ASTContext &Ctx, RecordDecl::TagKind TK, DeclContext *DC,
-                 SourceLocation L, IdentifierInfo *Id) {
+CreateRecordDecl(const ASTContext &Ctx, RecordDecl::TagKind TK,
+                 DeclContext *DC, IdentifierInfo *Id) {
+  SourceLocation Loc;
   if (Ctx.getLangOptions().CPlusPlus)
-    return CXXRecordDecl::Create(Ctx, TK, DC, L, Id);
+    return CXXRecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id);
   else
-    return RecordDecl::Create(Ctx, TK, DC, L, Id);
+    return RecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id);
 }
-                                    
+
 // getCFConstantStringType - Return the type used for constant CFStrings.
 QualType ASTContext::getCFConstantStringType() const {
   if (!CFConstantStringTypeDecl) {
     CFConstantStringTypeDecl =
-      CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
+      CreateRecordDecl(*this, TTK_Struct, TUDecl,
                        &Idents.get("NSConstantString"));
     CFConstantStringTypeDecl->startDefinition();
 
@@ -3416,7 +3417,7 @@ void ASTContext::setCFConstantStringType(QualType T) {
 QualType ASTContext::getNSConstantStringType() const {
   if (!NSConstantStringTypeDecl) {
     NSConstantStringTypeDecl =
-    CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
+    CreateRecordDecl(*this, TTK_Struct, TUDecl,
                      &Idents.get("__builtin_NSString"));
     NSConstantStringTypeDecl->startDefinition();
     
@@ -3456,7 +3457,7 @@ void ASTContext::setNSConstantStringType(QualType T) {
 QualType ASTContext::getObjCFastEnumerationStateType() const {
   if (!ObjCFastEnumerationStateTypeDecl) {
     ObjCFastEnumerationStateTypeDecl =
-      CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
+      CreateRecordDecl(*this, TTK_Struct, TUDecl,
                        &Idents.get("__objcFastEnumerationState"));
     ObjCFastEnumerationStateTypeDecl->startDefinition();
 
@@ -3492,7 +3493,7 @@ QualType ASTContext::getBlockDescriptorType() const {
 
   RecordDecl *T;
   // FIXME: Needs the FlagAppleBlock bit.
-  T = CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
+  T = CreateRecordDecl(*this, TTK_Struct, TUDecl,
                        &Idents.get("__block_descriptor"));
   T->startDefinition();
   
@@ -3536,7 +3537,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() const {
 
   RecordDecl *T;
   // FIXME: Needs the FlagAppleBlock bit.
-  T = CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
+  T = CreateRecordDecl(*this, TTK_Struct, TUDecl,
                        &Idents.get("__block_descriptor_withcopydispose"));
   T->startDefinition();
   
@@ -3614,8 +3615,7 @@ ASTContext::BuildByRefType(llvm::StringRef DeclName, QualType Ty) const {
   llvm::raw_svector_ostream(Name) << "__Block_byref_" <<
                                   ++UniqueBlockByRefTypeID << '_' << DeclName;
   RecordDecl *T;
-  T = CreateRecordDecl(*this, TTK_Struct, TUDecl, SourceLocation(),
-                       &Idents.get(Name.str()));
+  T = CreateRecordDecl(*this, TTK_Struct, TUDecl, &Idents.get(Name.str()));
   T->startDefinition();
   QualType Int32Ty = IntTy;
   assert(getIntWidth(IntTy) == 32 && "non-32bit int not supported");
index 89488deaa3e2bcbc048d14ed84fd8e61f4e7fe75..357819a6842dd60a02205aa0696aaf9dd2e9d55e 100644 (file)
@@ -2094,9 +2094,9 @@ Decl *ASTNodeImporter::VisitEnumDecl(EnumDecl *D) {
   }
   
   // Create the enum declaration.
-  EnumDecl *D2 = EnumDecl::Create(Importer.getToContext(), DC, Loc,
-                                  Name.getAsIdentifierInfo(),
-                                  Importer.Import(D->getLocStart()), 0,
+  EnumDecl *D2 = EnumDecl::Create(Importer.getToContext(), DC,
+                                  Importer.Import(D->getLocStart()),
+                                  Loc, Name.getAsIdentifierInfo(), 0,
                                   D->isScoped(), D->isScopedUsingClassTag(),
                                   D->isFixed());
   // Import the qualifier, if any.
@@ -2209,20 +2209,18 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {
   
   // Create the record declaration.
   RecordDecl *D2 = AdoptDecl;
+  SourceLocation StartLoc = Importer.Import(D->getLocStart());
   if (!D2) {
     if (isa<CXXRecordDecl>(D)) {
       CXXRecordDecl *D2CXX = CXXRecordDecl::Create(Importer.getToContext(), 
                                                    D->getTagKind(),
-                                                   DC, Loc,
-                                                   Name.getAsIdentifierInfo(), 
-                                           Importer.Import(D->getLocStart()));
+                                                   DC, StartLoc, Loc,
+                                                   Name.getAsIdentifierInfo());
       D2 = D2CXX;
       D2->setAccess(D->getAccess());
     } else {
       D2 = RecordDecl::Create(Importer.getToContext(), D->getTagKind(),
-                                    DC, Loc,
-                                    Name.getAsIdentifierInfo(), 
-                                    Importer.Import(D->getLocStart()));
+                              DC, StartLoc, Loc, Name.getAsIdentifierInfo());
     }
     
     D2->setQualifierInfo(Importer.Import(D->getQualifierLoc()));
@@ -3584,12 +3582,12 @@ Decl *ASTNodeImporter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
   CXXRecordDecl *DTemplated = D->getTemplatedDecl();
   
   // Create the declaration that is being templated.
+  SourceLocation StartLoc = Importer.Import(DTemplated->getLocStart());
+  SourceLocation IdLoc = Importer.Import(DTemplated->getLocation());
   CXXRecordDecl *D2Templated = CXXRecordDecl::Create(Importer.getToContext(),
                                                      DTemplated->getTagKind(),
-                                                     DC, 
-                                     Importer.Import(DTemplated->getLocation()),
-                                                     Name.getAsIdentifierInfo(),                                                       
-                               Importer.Import(DTemplated->getLocStart()));
+                                                     DC, StartLoc, IdLoc,
+                                                   Name.getAsIdentifierInfo());
   D2Templated->setAccess(DTemplated->getAccess());
   D2Templated->setQualifierInfo(Importer.Import(DTemplated->getQualifierLoc()));
   D2Templated->setLexicalDeclContext(LexicalDC);
@@ -3654,7 +3652,8 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl(
   }
   
   // Import the location of this declaration.
-  SourceLocation Loc = Importer.Import(D->getLocation());
+  SourceLocation StartLoc = Importer.Import(D->getLocStart());
+  SourceLocation IdLoc = Importer.Import(D->getLocation());
 
   // Import template arguments.
   llvm::SmallVector<TemplateArgument, 2> TemplateArgs;
@@ -3686,7 +3685,8 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl(
     // Create a new specialization.
     D2 = ClassTemplateSpecializationDecl::Create(Importer.getToContext(), 
                                                  D->getTagKind(), DC, 
-                                                 Loc, ClassTemplate,
+                                                 StartLoc, IdLoc,
+                                                 ClassTemplate,
                                                  TemplateArgs.data(), 
                                                  TemplateArgs.size(), 
                                                  /*PrevDecl=*/0);
index a7f6c45dd491866843f3cf2a6a7498e33b83c38d..b2d9af2361ee5580b07e4b9d14b9d7e68522358b 100644 (file)
@@ -2110,18 +2110,19 @@ void TagDecl::setQualifierInfo(NestedNameSpecifierLoc QualifierLoc) {
 // EnumDecl Implementation
 //===----------------------------------------------------------------------===//
 
-EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
-                           IdentifierInfo *Id, SourceLocation TKL,
+EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC,
+                           SourceLocation StartLoc, SourceLocation IdLoc,
+                           IdentifierInfo *Id,
                            EnumDecl *PrevDecl, bool IsScoped,
                            bool IsScopedUsingClassTag, bool IsFixed) {
-  EnumDecl *Enum = new (C) EnumDecl(DC, L, Id, PrevDecl, TKL,
+  EnumDecl *Enum = new (C) EnumDecl(DC, StartLoc, IdLoc, Id, PrevDecl,
                                     IsScoped, IsScopedUsingClassTag, IsFixed);
   C.getTypeDeclType(Enum, PrevDecl);
   return Enum;
 }
 
 EnumDecl *EnumDecl::Create(ASTContext &C, EmptyShell Empty) {
-  return new (C) EnumDecl(0, SourceLocation(), 0, 0, SourceLocation(),
+  return new (C) EnumDecl(0, SourceLocation(), SourceLocation(), 0, 0,
                           false, false, false);
 }
 
@@ -2142,10 +2143,10 @@ void EnumDecl::completeDefinition(QualType NewType,
 // RecordDecl Implementation
 //===----------------------------------------------------------------------===//
 
-RecordDecl::RecordDecl(Kind DK, TagKind TK, DeclContext *DC, SourceLocation L,
-                       IdentifierInfo *Id, RecordDecl *PrevDecl,
-                       SourceLocation TKL)
-  : TagDecl(DK, TK, DC, L, Id, PrevDecl, TKL) {
+RecordDecl::RecordDecl(Kind DK, TagKind TK, DeclContext *DC,
+                       SourceLocation StartLoc, SourceLocation IdLoc,
+                       IdentifierInfo *Id, RecordDecl *PrevDecl)
+  : TagDecl(DK, TK, DC, IdLoc, Id, PrevDecl, StartLoc) {
   HasFlexibleArrayMember = false;
   AnonymousStructOrUnion = false;
   HasObjectMember = false;
@@ -2154,17 +2155,17 @@ RecordDecl::RecordDecl(Kind DK, TagKind TK, DeclContext *DC, SourceLocation L,
 }
 
 RecordDecl *RecordDecl::Create(const ASTContext &C, TagKind TK, DeclContext *DC,
-                               SourceLocation L, IdentifierInfo *Id,
-                               SourceLocation TKL, RecordDecl* PrevDecl) {
-
-  RecordDecl* R = new (C) RecordDecl(Record, TK, DC, L, Id, PrevDecl, TKL);
+                               SourceLocation StartLoc, SourceLocation IdLoc,
+                               IdentifierInfo *Id, RecordDecl* PrevDecl) {
+  RecordDecl* R = new (C) RecordDecl(Record, TK, DC, StartLoc, IdLoc, Id,
+                                     PrevDecl);
   C.getTypeDeclType(R, PrevDecl);
   return R;
 }
 
 RecordDecl *RecordDecl::Create(const ASTContext &C, EmptyShell Empty) {
-  return new (C) RecordDecl(Record, TTK_Struct, 0, SourceLocation(), 0, 0,
-                            SourceLocation());
+  return new (C) RecordDecl(Record, TTK_Struct, 0, SourceLocation(),
+                            SourceLocation(), 0, 0);
 }
 
 bool RecordDecl::isInjectedClassName() const {
index f6a8f25d7dc7a0ce70f373c3000ebfbf40aad6d4..8cfb12a72e64c6fb72a82873d95b022f0e44d374 100644 (file)
@@ -41,20 +41,19 @@ CXXRecordDecl::DefinitionData::DefinitionData(CXXRecordDecl *D)
 }
 
 CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
-                             SourceLocation L, IdentifierInfo *Id,
-                             CXXRecordDecl *PrevDecl,
-                             SourceLocation TKL)
-  : RecordDecl(K, TK, DC, L, Id, PrevDecl, TKL),
+                             SourceLocation StartLoc, SourceLocation IdLoc,
+                             IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
+  : RecordDecl(K, TK, DC, StartLoc, IdLoc, Id, PrevDecl),
     DefinitionData(PrevDecl ? PrevDecl->DefinitionData : 0),
     TemplateOrInstantiation() { }
 
 CXXRecordDecl *CXXRecordDecl::Create(const ASTContext &C, TagKind TK,
-                                     DeclContext *DC, SourceLocation L,
-                                     IdentifierInfo *Id, SourceLocation TKL,
+                                     DeclContext *DC, SourceLocation StartLoc,
+                                     SourceLocation IdLoc, IdentifierInfo *Id,
                                      CXXRecordDecl* PrevDecl,
                                      bool DelayTypeCreation) {
-  CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id,
-                                           PrevDecl, TKL);
+  CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, StartLoc, IdLoc,
+                                           Id, PrevDecl);
 
   // FIXME: DelayTypeCreation seems like such a hack
   if (!DelayTypeCreation)
@@ -63,8 +62,8 @@ CXXRecordDecl *CXXRecordDecl::Create(const ASTContext &C, TagKind TK,
 }
 
 CXXRecordDecl *CXXRecordDecl::Create(const ASTContext &C, EmptyShell Empty) {
-  return new (C) CXXRecordDecl(CXXRecord, TTK_Struct, 0, SourceLocation(), 0, 0,
-                               SourceLocation());
+  return new (C) CXXRecordDecl(CXXRecord, TTK_Struct, 0, SourceLocation(),
+                               SourceLocation(), 0, 0);
 }
 
 void
index de0e71ebacee0615aeed1b190a3a20e5c463a169..ae17dd15b1289551a615fda6d1572e655ace8877 100644 (file)
@@ -555,12 +555,13 @@ TemplateArgumentList::CreateCopy(ASTContext &Context,
 //===----------------------------------------------------------------------===//
 ClassTemplateSpecializationDecl::
 ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK,
-                                DeclContext *DC, SourceLocation L,
+                                DeclContext *DC, SourceLocation StartLoc,
+                                SourceLocation IdLoc,
                                 ClassTemplateDecl *SpecializedTemplate,
                                 const TemplateArgument *Args,
                                 unsigned NumArgs,
                                 ClassTemplateSpecializationDecl *PrevDecl)
-  : CXXRecordDecl(DK, TK, DC, L,
+  : CXXRecordDecl(DK, TK, DC, StartLoc, IdLoc,
                   SpecializedTemplate->getIdentifier(),
                   PrevDecl),
     SpecializedTemplate(SpecializedTemplate),
@@ -570,14 +571,16 @@ ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK,
 }
 
 ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl(Kind DK)
-  : CXXRecordDecl(DK, TTK_Struct, 0, SourceLocation(), 0, 0),
+  : CXXRecordDecl(DK, TTK_Struct, 0, SourceLocation(), SourceLocation(), 0, 0),
     ExplicitInfo(0),
     SpecializationKind(TSK_Undeclared) {
 }
 
 ClassTemplateSpecializationDecl *
 ClassTemplateSpecializationDecl::Create(ASTContext &Context, TagKind TK,
-                                        DeclContext *DC, SourceLocation L,
+                                        DeclContext *DC,
+                                        SourceLocation StartLoc,
+                                        SourceLocation IdLoc,
                                         ClassTemplateDecl *SpecializedTemplate,
                                         const TemplateArgument *Args,
                                         unsigned NumArgs,
@@ -585,7 +588,7 @@ ClassTemplateSpecializationDecl::Create(ASTContext &Context, TagKind TK,
   ClassTemplateSpecializationDecl *Result
     = new (Context)ClassTemplateSpecializationDecl(Context,
                                                    ClassTemplateSpecialization,
-                                                   TK, DC, L,
+                                                   TK, DC, StartLoc, IdLoc,
                                                    SpecializedTemplate,
                                                    Args, NumArgs,
                                                    PrevDecl);
@@ -638,7 +641,9 @@ ClassTemplateSpecializationDecl::getSourceRange() const {
 //===----------------------------------------------------------------------===//
 ClassTemplatePartialSpecializationDecl::
 ClassTemplatePartialSpecializationDecl(ASTContext &Context, TagKind TK,
-                                       DeclContext *DC, SourceLocation L,
+                                       DeclContext *DC,
+                                       SourceLocation StartLoc,
+                                       SourceLocation IdLoc,
                                        TemplateParameterList *Params,
                                        ClassTemplateDecl *SpecializedTemplate,
                                        const TemplateArgument *Args,
@@ -649,7 +654,8 @@ ClassTemplatePartialSpecializationDecl(ASTContext &Context, TagKind TK,
                                        unsigned SequenceNumber)
   : ClassTemplateSpecializationDecl(Context,
                                     ClassTemplatePartialSpecialization,
-                                    TK, DC, L, SpecializedTemplate, 
+                                    TK, DC, StartLoc, IdLoc,
+                                    SpecializedTemplate,
                                     Args, NumArgs, PrevDecl),
     TemplateParams(Params), ArgsAsWritten(ArgInfos),
     NumArgsAsWritten(NumArgInfos), SequenceNumber(SequenceNumber),
@@ -660,7 +666,8 @@ ClassTemplatePartialSpecializationDecl(ASTContext &Context, TagKind TK,
 
 ClassTemplatePartialSpecializationDecl *
 ClassTemplatePartialSpecializationDecl::
-Create(ASTContext &Context, TagKind TK,DeclContext *DC, SourceLocation L,
+Create(ASTContext &Context, TagKind TK,DeclContext *DC,
+       SourceLocation StartLoc, SourceLocation IdLoc,
        TemplateParameterList *Params,
        ClassTemplateDecl *SpecializedTemplate,
        const TemplateArgument *Args,
@@ -675,8 +682,9 @@ Create(ASTContext &Context, TagKind TK,DeclContext *DC, SourceLocation L,
     ClonedArgs[I] = ArgInfos[I];
 
   ClassTemplatePartialSpecializationDecl *Result
-    = new (Context)ClassTemplatePartialSpecializationDecl(Context, TK,
-                                                          DC, L, Params,
+    = new (Context)ClassTemplatePartialSpecializationDecl(Context, TK, DC,
+                                                          StartLoc, IdLoc,
+                                                          Params,
                                                           SpecializedTemplate,
                                                           Args, NumArgs,
                                                           ClonedArgs, N,
index 9829ae128ba846842e249fa14afeb95e8f6aed98..a33e0941cb50ef5e71ee67f9d70c90704b0975c5 100644 (file)
@@ -4174,7 +4174,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
   // }
   RecordDecl *RD = RecordDecl::Create(Ctx, TTK_Struct,
                                       Ctx.getTranslationUnitDecl(),
-                                      SourceLocation(),
+                                      SourceLocation(), SourceLocation(),
                                       &Ctx.Idents.get("_objc_super"));
   RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), SourceLocation(), 0,
                                 Ctx.getObjCIdType(), 0, 0, false));
@@ -4637,7 +4637,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
   // First the clang type for struct _message_ref_t
   RecordDecl *RD = RecordDecl::Create(Ctx, TTK_Struct,
                                       Ctx.getTranslationUnitDecl(),
-                                      SourceLocation(),
+                                      SourceLocation(), SourceLocation(),
                                       &Ctx.Idents.get("_message_ref_t"));
   RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), SourceLocation(), 0,
                                 Ctx.VoidPtrTy, 0, 0, false));
index 5433108867be2d54a98b84d5f0852c3bbd54b7b3..bd91b9be4d4f7799dfff48d3d48578d404328d4f 100644 (file)
@@ -1426,7 +1426,8 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
       RecName += "_IMPL";
       IdentifierInfo *II = &Context->Idents.get(RecName);
       RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                          SourceLocation(), II);
+                                          SourceLocation(), SourceLocation(),
+                                          II);
       assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
       CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, castT,
@@ -1472,7 +1473,8 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
       RecName += "_IMPL";
       IdentifierInfo *II = &Context->Idents.get(RecName);
       RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                          SourceLocation(), II);
+                                          SourceLocation(), SourceLocation(),
+                                          II);
       assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
       CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, castT,
@@ -2490,7 +2492,7 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() {
   IdentifierInfo *msgSendIdent = &Context->Idents.get("objc_msgSendSuper");
   llvm::SmallVector<QualType, 16> ArgTys;
   RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                      SourceLocation(),
+                                      SourceLocation(), SourceLocation(),
                                       &Context->Idents.get("objc_super"));
   QualType argT = Context->getPointerType(Context->getTagDeclType(RD));
   assert(!argT.isNull() && "Can't build 'struct objc_super *' type");
@@ -2537,7 +2539,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() {
     &Context->Idents.get("objc_msgSendSuper_stret");
   llvm::SmallVector<QualType, 16> ArgTys;
   RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                      SourceLocation(),
+                                      SourceLocation(), SourceLocation(),
                                       &Context->Idents.get("objc_super"));
   QualType argT = Context->getPointerType(Context->getTagDeclType(RD));
   assert(!argT.isNull() && "Can't build 'struct objc_super *' type");
@@ -2675,7 +2677,7 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
 QualType RewriteObjC::getSuperStructType() {
   if (!SuperStructDecl) {
     SuperStructDecl = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                         SourceLocation(),
+                                         SourceLocation(), SourceLocation(),
                                          &Context->Idents.get("objc_super"));
     QualType FieldTypes[2];
 
@@ -2702,7 +2704,7 @@ QualType RewriteObjC::getSuperStructType() {
 QualType RewriteObjC::getConstantStringStructType() {
   if (!ConstantStringDecl) {
     ConstantStringDecl = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                            SourceLocation(),
+                                            SourceLocation(), SourceLocation(),
                          &Context->Idents.get("__NSConstantStringImpl"));
     QualType FieldTypes[4];
 
@@ -4684,7 +4686,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
   // FTP will be null for closures that don't take arguments.
 
   RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                      SourceLocation(),
+                                      SourceLocation(), SourceLocation(),
                                       &Context->Idents.get("__block_impl"));
   QualType PtrBlock = Context->getPointerType(Context->getTagDeclType(RD));
 
@@ -5423,7 +5425,8 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
       IdentifierInfo *II = &Context->Idents.get(RecName.c_str() 
                                                 + sizeof("struct"));
       RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
-                                          SourceLocation(), II);
+                                          SourceLocation(), SourceLocation(),
+                                          II);
       assert(RD && "SynthBlockInitExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
       
index 4bc5c3bfe7d7d0e70c99946244e66c0b48b14b81..dab4bf7fbe36a9176f1af429c3a8bbeb189a49aa 100644 (file)
@@ -6502,7 +6502,7 @@ CreateNewDecl:
   if (Kind == TTK_Enum) {
     // FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.:
     // enum X { A, B, C } D;    D should chain to X.
-    New = EnumDecl::Create(Context, SearchDC, Loc, Name, KWLoc,
+    New = EnumDecl::Create(Context, SearchDC, KWLoc, Loc, Name,
                            cast_or_null<EnumDecl>(PrevDecl), ScopedEnum,
                            ScopedEnumUsesClassTag, !EnumUnderlying.isNull());
     // If this is an undefined enum, warn.
@@ -6548,13 +6548,13 @@ CreateNewDecl:
     // struct X { int A; } D;    D should chain to X.
     if (getLangOptions().CPlusPlus) {
       // FIXME: Look for a way to use RecordDecl for simple structs.
-      New = CXXRecordDecl::Create(Context, Kind, SearchDC, Loc, Name, KWLoc,
+      New = CXXRecordDecl::Create(Context, Kind, SearchDC, KWLoc, Loc, Name,
                                   cast_or_null<CXXRecordDecl>(PrevDecl));
-      
+
       if (isStdBadAlloc && (!StdBadAlloc || getStdBadAlloc()->isImplicit()))
         StdBadAlloc = cast<CXXRecordDecl>(New);
     } else
-      New = RecordDecl::Create(Context, Kind, SearchDC, Loc, Name, KWLoc,
+      New = RecordDecl::Create(Context, Kind, SearchDC, KWLoc, Loc, Name,
                                cast_or_null<RecordDecl>(PrevDecl));
   }
 
@@ -6679,10 +6679,9 @@ void Sema::ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagD,
   //   purposes of access checking, the injected-class-name is treated
   //   as if it were a public member name.
   CXXRecordDecl *InjectedClassName
-    = CXXRecordDecl::Create(Context, Record->getTagKind(),
-                            CurContext, Record->getLocation(),
+    = CXXRecordDecl::Create(Context, Record->getTagKind(), CurContext,
+                            Record->getLocStart(), Record->getLocation(),
                             Record->getIdentifier(),
-                            Record->getLocStart(),
                             /*PrevDecl=*/0,
                             /*DelayTypeCreation=*/true);
   Context.getTypeDeclType(InjectedClassName, Record);
index 3fac3a9a49431c7afc8210a9d690f5438c73aba7..25f042c4739009f9a5a734d4bc72c04f8f9e35fe 100644 (file)
@@ -1437,9 +1437,9 @@ void Sema::DeclareGlobalNewDelete() {
     // implicitly.
     StdBadAlloc = CXXRecordDecl::Create(Context, TTK_Class,
                                         getOrCreateStdNamespace(),
-                                        SourceLocation(),
+                                        SourceLocation(), SourceLocation(),
                                       &PP.getIdentifierTable().get("bad_alloc"),
-                                        SourceLocation(), 0);
+                                        0);
     getStdBadAlloc()->setImplicit(true);
   }
 
index cd5573b2f1af0668930a221e2748eb9974f5c3ad..172e45a345e001423fdea7231047ae8a32457a6a 100644 (file)
@@ -963,7 +963,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
   }
 
   CXXRecordDecl *NewClass =
-    CXXRecordDecl::Create(Context, Kind, SemanticContext, NameLoc, Name, KWLoc,
+    CXXRecordDecl::Create(Context, Kind, SemanticContext, KWLoc, NameLoc, Name,
                           PrevClassTemplate?
                             PrevClassTemplate->getTemplatedDecl() : 0,
                           /*DelayTypeCreation=*/true);
@@ -1756,6 +1756,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
       Decl = ClassTemplateSpecializationDecl::Create(Context,
                             ClassTemplate->getTemplatedDecl()->getTagKind(),
                                                 ClassTemplate->getDeclContext(),
+                                                ClassTemplate->getLocation(),
                                                 ClassTemplate->getLocation(),
                                                      ClassTemplate,
                                                      Converted.data(),
@@ -4596,7 +4597,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
     ClassTemplatePartialSpecializationDecl *Partial
       = ClassTemplatePartialSpecializationDecl::Create(Context, Kind,
                                              ClassTemplate->getDeclContext(),
-                                                       TemplateNameLoc,
+                                                       KWLoc, TemplateNameLoc,
                                                        TemplateParams,
                                                        ClassTemplate,
                                                        Converted.data(),
@@ -4659,7 +4660,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
     Specialization
       = ClassTemplateSpecializationDecl::Create(Context, Kind,
                                              ClassTemplate->getDeclContext(),
-                                                TemplateNameLoc,
+                                                KWLoc, TemplateNameLoc,
                                                 ClassTemplate,
                                                 Converted.data(),
                                                 Converted.size(),
@@ -5522,7 +5523,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
     Specialization
       = ClassTemplateSpecializationDecl::Create(Context, Kind,
                                              ClassTemplate->getDeclContext(),
-                                                TemplateNameLoc,
+                                                KWLoc, TemplateNameLoc,
                                                 ClassTemplate,
                                                 Converted.data(),
                                                 Converted.size(),
index 8d8cda115d16a7adf025cd83dcad46078ed1764b..e60882d6cba842af80be3abfad56eed8a3cddde4 100644 (file)
@@ -533,9 +533,8 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) {
 }
 
 Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
-  EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner,
+  EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner, D->getLocStart(),
                                     D->getLocation(), D->getIdentifier(),
-                                    D->getLocStart(),
                                     /*PrevDecl=*/0, D->isScoped(),
                                     D->isScopedUsingClassTag(), D->isFixed());
   if (D->isFixed()) {
@@ -760,8 +759,8 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
 
   CXXRecordDecl *RecordInst
     = CXXRecordDecl::Create(SemaRef.Context, Pattern->getTagKind(), DC,
-                            Pattern->getLocation(), Pattern->getIdentifier(),
-                            Pattern->getLocStart(), PrevDecl,
+                            Pattern->getLocStart(), Pattern->getLocation(),
+                            Pattern->getIdentifier(), PrevDecl,
                             /*DelayTypeCreation=*/true);
 
   if (QualifierLoc)
@@ -902,8 +901,8 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) {
 
   CXXRecordDecl *Record
     = CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner,
-                            D->getLocation(), D->getIdentifier(),
-                            D->getLocStart(), PrevDecl);
+                            D->getLocStart(), D->getLocation(),
+                            D->getIdentifier(), PrevDecl);
 
   // Substitute the nested name specifier, if any.
   if (SubstQualifier(D, Record))
@@ -1958,7 +1957,8 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(
     = ClassTemplatePartialSpecializationDecl::Create(SemaRef.Context, 
                                                      PartialSpec->getTagKind(),
                                                      Owner, 
-                                                     PartialSpec->getLocation(), 
+                                                     PartialSpec->getLocStart(),
+                                                     PartialSpec->getLocation(),
                                                      InstParams,
                                                      ClassTemplate, 
                                                      Converted.data(),