From: Abramo Bagnara Date: Tue, 8 Mar 2011 08:55:46 +0000 (+0000) Subject: Fixed source range for all DeclaratorDecl's. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff676cb48fe8bf7be2feaa251dc7c5fb15af4730;p=clang Fixed source range for all DeclaratorDecl's. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127225 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 2ee330b4f8..2d5c1bf09f 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -532,14 +532,20 @@ class DeclaratorDecl : public ValueDecl { llvm::PointerUnion DeclInfo; + /// InnerLocStart - The start of the source range for this declaration, + /// ignoring outer template declarations. + SourceLocation InnerLocStart; + bool hasExtInfo() const { return DeclInfo.is(); } ExtInfo *getExtInfo() { return DeclInfo.get(); } const ExtInfo *getExtInfo() const { return DeclInfo.get(); } protected: DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L, - DeclarationName N, QualType T, TypeSourceInfo *TInfo) - : ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo) {} + DeclarationName N, QualType T, TypeSourceInfo *TInfo, + SourceLocation StartL) + : ValueDecl(DK, DC, L, N, T), DeclInfo(TInfo), InnerLocStart(StartL) { + } public: TypeSourceInfo *getTypeSourceInfo() const { @@ -556,7 +562,8 @@ public: /// getInnerLocStart - Return SourceLocation representing start of source /// range ignoring outer template declarations. - virtual SourceLocation getInnerLocStart() const { return getLocation(); } + virtual SourceLocation getInnerLocStart() const { return InnerLocStart; } + void setInnerLocStart(SourceLocation L) { InnerLocStart = L; } /// getOuterLocStart - Return SourceLocation representing start of source /// range taking into account any outer template declarations. @@ -684,10 +691,11 @@ private: friend class ASTDeclReader; protected: - VarDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, + VarDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass SC, StorageClass SCAsWritten) - : DeclaratorDecl(DK, DC, L, Id, T, TInfo), Init(), + : DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc), Init(), ThreadSpecified(false), HasCXXDirectInit(false), ExceptionVar(false), NRVOVariable(false) { SClass = SC; @@ -707,11 +715,10 @@ public: } static VarDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation L, IdentifierInfo *Id, - QualType T, TypeSourceInfo *TInfo, StorageClass S, - StorageClass SCAsWritten); + SourceLocation StartLoc, SourceLocation IdLoc, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, + StorageClass S, StorageClass SCAsWritten); - virtual SourceLocation getInnerLocStart() const; virtual SourceRange getSourceRange() const; StorageClass getStorageClass() const { return (StorageClass)SClass; } @@ -1064,12 +1071,12 @@ public: class ImplicitParamDecl : public VarDecl { public: static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation L, IdentifierInfo *Id, + SourceLocation IdLoc, IdentifierInfo *Id, QualType T); - ImplicitParamDecl(DeclContext *DC, SourceLocation loc, - IdentifierInfo *name, QualType type) - : VarDecl(ImplicitParam, DC, loc, name, type, + ImplicitParamDecl(DeclContext *DC, SourceLocation IdLoc, + IdentifierInfo *Id, QualType Type) + : VarDecl(ImplicitParam, DC, IdLoc, IdLoc, Id, Type, /*tinfo*/ 0, SC_None, SC_None) { setImplicit(); } @@ -1089,17 +1096,19 @@ class ParmVarDecl : public VarDecl { bool HasInheritedDefaultArg : 1; protected: - ParmVarDecl(Kind DK, DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, + ParmVarDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, + QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten, Expr *DefArg) - : VarDecl(DK, DC, L, Id, T, TInfo, S, SCAsWritten), + : VarDecl(DK, DC, StartLoc, IdLoc, Id, T, TInfo, S, SCAsWritten), objcDeclQualifier(OBJC_TQ_None), HasInheritedDefaultArg(false) { setDefaultArg(DefArg); } public: static ParmVarDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation L,IdentifierInfo *Id, + SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten, Expr *DefArg); @@ -1318,13 +1327,15 @@ private: void setParams(ASTContext &C, ParmVarDecl **NewParamInfo, unsigned NumParams); protected: - FunctionDecl(Kind DK, DeclContext *DC, const DeclarationNameInfo &NameInfo, + FunctionDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, + const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten, bool isInlineSpecified) - : DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo), + : DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo, + StartLoc), DeclContext(DK), ParamInfo(0), Body(), - SClass(S), SClassAsWritten(SCAsWritten), + SClass(S), SClassAsWritten(SCAsWritten), IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified), IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false), HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false), @@ -1344,22 +1355,25 @@ public: return redeclarable_base::redecls_end(); } - static FunctionDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, + static FunctionDecl *Create(ASTContext &C, DeclContext *DC, + SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, - StorageClass S = SC_None, + StorageClass SC = SC_None, StorageClass SCAsWritten = SC_None, bool isInlineSpecified = false, bool hasWrittenPrototype = true) { - DeclarationNameInfo NameInfo(N, L); - return FunctionDecl::Create(C, DC, NameInfo, T, TInfo, S, SCAsWritten, + DeclarationNameInfo NameInfo(N, NLoc); + return FunctionDecl::Create(C, DC, StartLoc, NameInfo, T, TInfo, + SC, SCAsWritten, isInlineSpecified, hasWrittenPrototype); } static FunctionDecl *Create(ASTContext &C, DeclContext *DC, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, - StorageClass S = SC_None, + StorageClass SC = SC_None, StorageClass SCAsWritten = SC_None, bool isInlineSpecified = false, bool hasWrittenPrototype = true); @@ -1773,16 +1787,17 @@ class FieldDecl : public DeclaratorDecl { Expr *BitWidth; protected: - FieldDecl(Kind DK, DeclContext *DC, SourceLocation L, - IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, - Expr *BW, bool Mutable) - : DeclaratorDecl(DK, DC, L, Id, T, TInfo), + FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, + QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable) + : DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc), Mutable(Mutable), CachedFieldIndex(0), BitWidth(BW) { } public: static FieldDecl *Create(const ASTContext &C, DeclContext *DC, - SourceLocation L, IdentifierInfo *Id, QualType T, + SourceLocation StartLoc, SourceLocation IdLoc, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable); /// getFieldIndex - Returns the index of this field within its record, diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 0473ae0455..3a2a3393b2 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -1034,15 +1034,17 @@ public: /// struct/union/class. class CXXMethodDecl : public FunctionDecl { protected: - CXXMethodDecl(Kind DK, CXXRecordDecl *RD, + CXXMethodDecl(Kind DK, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isStatic, StorageClass SCAsWritten, bool isInline) - : FunctionDecl(DK, RD, NameInfo, T, TInfo, (isStatic ? SC_Static : SC_None), + : FunctionDecl(DK, RD, StartLoc, NameInfo, T, TInfo, + (isStatic ? SC_Static : SC_None), SCAsWritten, isInline) {} public: static CXXMethodDecl *Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isStatic = false, @@ -1395,11 +1397,12 @@ class CXXConstructorDecl : public CXXMethodDecl { CXXCtorInitializer **CtorInitializers; unsigned NumCtorInitializers; - CXXConstructorDecl(CXXRecordDecl *RD, const DeclarationNameInfo &NameInfo, + CXXConstructorDecl(CXXRecordDecl *RD, SourceLocation StartLoc, + const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicitSpecified, bool isInline, bool isImplicitlyDeclared) - : CXXMethodDecl(CXXConstructor, RD, NameInfo, T, TInfo, false, + : CXXMethodDecl(CXXConstructor, RD, StartLoc, NameInfo, T, TInfo, false, SC_None, isInline), IsExplicitSpecified(isExplicitSpecified), ImplicitlyDefined(false), CtorInitializers(0), NumCtorInitializers(0) { @@ -1409,6 +1412,7 @@ class CXXConstructorDecl : public CXXMethodDecl { public: static CXXConstructorDecl *Create(ASTContext &C, EmptyShell Empty); static CXXConstructorDecl *Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, @@ -1589,10 +1593,11 @@ class CXXDestructorDecl : public CXXMethodDecl { FunctionDecl *OperatorDelete; - CXXDestructorDecl(CXXRecordDecl *RD, const DeclarationNameInfo &NameInfo, + CXXDestructorDecl(CXXRecordDecl *RD, SourceLocation StartLoc, + const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isImplicitlyDeclared) - : CXXMethodDecl(CXXDestructor, RD, NameInfo, T, TInfo, false, + : CXXMethodDecl(CXXDestructor, RD, StartLoc, NameInfo, T, TInfo, false, SC_None, isInline), ImplicitlyDefined(false), OperatorDelete(0) { setImplicit(isImplicitlyDeclared); @@ -1601,6 +1606,7 @@ class CXXDestructorDecl : public CXXMethodDecl { public: static CXXDestructorDecl *Create(ASTContext& C, EmptyShell Empty); static CXXDestructorDecl *Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo* TInfo, bool isInline, @@ -1651,16 +1657,18 @@ class CXXConversionDecl : public CXXMethodDecl { /// explicitly wrote a cast. This is a C++0x feature. bool IsExplicitSpecified : 1; - CXXConversionDecl(CXXRecordDecl *RD, const DeclarationNameInfo &NameInfo, + CXXConversionDecl(CXXRecordDecl *RD, SourceLocation StartLoc, + const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicitSpecified) - : CXXMethodDecl(CXXConversion, RD, NameInfo, T, TInfo, false, + : CXXMethodDecl(CXXConversion, RD, StartLoc, NameInfo, T, TInfo, false, SC_None, isInline), IsExplicitSpecified(isExplicitSpecified) { } public: static CXXConversionDecl *Create(ASTContext &C, EmptyShell Empty); static CXXConversionDecl *Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit); diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index c36ab29661..84e7a63b02 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -707,15 +707,18 @@ public: }; private: - ObjCIvarDecl(ObjCContainerDecl *DC, SourceLocation L, IdentifierInfo *Id, + ObjCIvarDecl(ObjCContainerDecl *DC, SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW, bool synthesized) - : FieldDecl(ObjCIvar, DC, L, Id, T, TInfo, BW, /*Mutable=*/false), - NextIvar(0), DeclAccess(ac), Synthesized(synthesized) {} + : FieldDecl(ObjCIvar, DC, StartLoc, IdLoc, Id, T, TInfo, BW, + /*Mutable=*/false), + NextIvar(0), DeclAccess(ac), Synthesized(synthesized) {} public: static ObjCIvarDecl *Create(ASTContext &C, ObjCContainerDecl *DC, - SourceLocation L, IdentifierInfo *Id, QualType T, + SourceLocation StartLoc, SourceLocation IdLoc, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW = NULL, bool synthesized=false); @@ -759,17 +762,18 @@ private: /// @defs(...). class ObjCAtDefsFieldDecl : public FieldDecl { private: - ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, + ObjCAtDefsFieldDecl(DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW) - : FieldDecl(ObjCAtDefsField, DC, L, Id, T, + : FieldDecl(ObjCAtDefsField, DC, StartLoc, IdLoc, Id, T, /*TInfo=*/0, // FIXME: Do ObjCAtDefs have declarators ? BW, /*Mutable=*/false) {} public: static ObjCAtDefsFieldDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation L, - IdentifierInfo *Id, QualType T, - Expr *BW); + SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, + QualType T, Expr *BW); // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 754ce4275b..58186b3a3d 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -1049,17 +1049,19 @@ class NonTypeTemplateParmDecl /// \brief The number of types in an expanded parameter pack. unsigned NumExpandedTypes; - NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D, - unsigned P, IdentifierInfo *Id, QualType T, + NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, unsigned D, unsigned P, + IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo) - : DeclaratorDecl(NonTypeTemplateParm, DC, L, Id, T, TInfo), + : DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc), TemplateParmPosition(D, P), DefaultArgumentAndInherited(0, false), ParameterPack(ParameterPack), ExpandedParameterPack(false), NumExpandedTypes(0) { } - NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D, - unsigned P, IdentifierInfo *Id, QualType T, + NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, unsigned D, unsigned P, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, const QualType *ExpandedTypes, unsigned NumExpandedTypes, @@ -1069,13 +1071,14 @@ class NonTypeTemplateParmDecl public: static NonTypeTemplateParmDecl * - Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, - unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, - TypeSourceInfo *TInfo); + Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, + QualType T, bool ParameterPack, TypeSourceInfo *TInfo); static NonTypeTemplateParmDecl * - Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, - unsigned P, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, + Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, + SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, + QualType T, TypeSourceInfo *TInfo, const QualType *ExpandedTypes, unsigned NumExpandedTypes, TypeSourceInfo **ExpandedTInfos); @@ -1085,7 +1088,6 @@ public: using TemplateParmPosition::setPosition; using TemplateParmPosition::getIndex; - SourceLocation getInnerLocStart() const; SourceRange getSourceRange() const; /// \brief Determine whether this template parameter has a default diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 0a55228494..3d0385b320 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -843,12 +843,10 @@ public: ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T); - ParmVarDecl *CheckParameter(DeclContext *DC, - TypeSourceInfo *TSInfo, QualType T, - IdentifierInfo *Name, - SourceLocation NameLoc, - StorageClass SC, - StorageClass SCAsWritten); + ParmVarDecl *CheckParameter(DeclContext *DC, SourceLocation StartLoc, + SourceLocation NameLoc, IdentifierInfo *Name, + QualType T, TypeSourceInfo *TSInfo, + StorageClass SC, StorageClass SCAsWritten); void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg); @@ -1823,7 +1821,8 @@ public: VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, - IdentifierInfo *Name, SourceLocation NameLoc, + SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, bool Invalid = false); Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D); @@ -1843,10 +1842,10 @@ public: Expr *SynchExpr, Stmt *SynchBody); - VarDecl *BuildExceptionDeclaration(Scope *S, - TypeSourceInfo *TInfo, - IdentifierInfo *Name, - SourceLocation Loc); + VarDecl *BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, + SourceLocation StartLoc, + SourceLocation IdLoc, + IdentifierInfo *Id); Decl *ActOnExceptionDeclarator(Scope *S, Declarator &D); StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 43c65cf7fb..674356245f 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -127,7 +127,8 @@ ASTContext::getCanonicalTemplateTemplateParmDecl( } Param = NonTypeTemplateParmDecl::Create(*this, getTranslationUnitDecl(), - SourceLocation(), + SourceLocation(), + SourceLocation(), NTTP->getDepth(), NTTP->getPosition(), 0, T, @@ -137,7 +138,8 @@ ASTContext::getCanonicalTemplateTemplateParmDecl( ExpandedTInfos.data()); } else { Param = NonTypeTemplateParmDecl::Create(*this, getTranslationUnitDecl(), - SourceLocation(), + SourceLocation(), + SourceLocation(), NTTP->getDepth(), NTTP->getPosition(), 0, T, @@ -3389,6 +3391,7 @@ QualType ASTContext::getCFConstantStringType() const { // Create fields for (unsigned i = 0; i < 4; ++i) { FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTypeDecl, + SourceLocation(), SourceLocation(), 0, FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, @@ -3429,6 +3432,7 @@ QualType ASTContext::getNSConstantStringType() const { // Create fields for (unsigned i = 0; i < 3; ++i) { FieldDecl *Field = FieldDecl::Create(*this, NSConstantStringTypeDecl, + SourceLocation(), SourceLocation(), 0, FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, @@ -3467,6 +3471,7 @@ QualType ASTContext::getObjCFastEnumerationStateType() const { for (size_t i = 0; i < 4; ++i) { FieldDecl *Field = FieldDecl::Create(*this, ObjCFastEnumerationStateTypeDecl, + SourceLocation(), SourceLocation(), 0, FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, @@ -3502,8 +3507,7 @@ QualType ASTContext::getBlockDescriptorType() const { }; for (size_t i = 0; i < 2; ++i) { - FieldDecl *Field = FieldDecl::Create(*this, - T, + FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(), SourceLocation(), &Idents.get(FieldNames[i]), FieldTypes[i], /*TInfo=*/0, @@ -3551,8 +3555,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() const { }; for (size_t i = 0; i < 4; ++i) { - FieldDecl *Field = FieldDecl::Create(*this, - T, + FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(), SourceLocation(), &Idents.get(FieldNames[i]), FieldTypes[i], /*TInfo=*/0, @@ -3640,6 +3643,7 @@ ASTContext::BuildByRefType(llvm::StringRef DeclName, QualType Ty) const { if (!HasCopyAndDispose && i >=4 && i <= 5) continue; FieldDecl *Field = FieldDecl::Create(*this, T, SourceLocation(), + SourceLocation(), &Idents.get(FieldNames[i]), FieldTypes[i], /*TInfo=*/0, /*BitWidth=*/0, /*Mutable=*/false); diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index c1c9736e30..abcb2ef94f 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -2369,6 +2369,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { if (CXXConstructorDecl *FromConstructor = dyn_cast(D)) { ToFunction = CXXConstructorDecl::Create(Importer.getToContext(), cast(DC), + D->getInnerLocStart(), NameInfo, T, TInfo, FromConstructor->isExplicit(), D->isInlineSpecified(), @@ -2376,6 +2377,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { } else if (isa(D)) { ToFunction = CXXDestructorDecl::Create(Importer.getToContext(), cast(DC), + D->getInnerLocStart(), NameInfo, T, TInfo, D->isInlineSpecified(), D->isImplicit()); @@ -2383,18 +2385,21 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { = dyn_cast(D)) { ToFunction = CXXConversionDecl::Create(Importer.getToContext(), cast(DC), + D->getInnerLocStart(), NameInfo, T, TInfo, D->isInlineSpecified(), FromConversion->isExplicit()); } else if (CXXMethodDecl *Method = dyn_cast(D)) { ToFunction = CXXMethodDecl::Create(Importer.getToContext(), cast(DC), + D->getInnerLocStart(), NameInfo, T, TInfo, Method->isStatic(), Method->getStorageClassAsWritten(), Method->isInlineSpecified()); } else { ToFunction = FunctionDecl::Create(Importer.getToContext(), DC, + D->getInnerLocStart(), NameInfo, T, TInfo, D->getStorageClass(), D->getStorageClassAsWritten(), D->isInlineSpecified(), @@ -2459,7 +2464,8 @@ Decl *ASTNodeImporter::VisitFieldDecl(FieldDecl *D) { if (!BitWidth && D->getBitWidth()) return 0; - FieldDecl *ToField = FieldDecl::Create(Importer.getToContext(), DC, + FieldDecl *ToField = FieldDecl::Create(Importer.getToContext(), DC, + Importer.Import(D->getInnerLocStart()), Loc, Name.getAsIdentifierInfo(), T, TInfo, BitWidth, D->isMutable()); ToField->setAccess(D->getAccess()); @@ -2544,6 +2550,7 @@ Decl *ASTNodeImporter::VisitObjCIvarDecl(ObjCIvarDecl *D) { ObjCIvarDecl *ToIvar = ObjCIvarDecl::Create(Importer.getToContext(), cast(DC), + Importer.Import(D->getInnerLocStart()), Loc, Name.getAsIdentifierInfo(), T, TInfo, D->getAccessControl(), BitWidth, D->getSynthesize()); @@ -2652,8 +2659,10 @@ Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) { // Create the imported variable. TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); - VarDecl *ToVar = VarDecl::Create(Importer.getToContext(), DC, Loc, - Name.getAsIdentifierInfo(), T, TInfo, + VarDecl *ToVar = VarDecl::Create(Importer.getToContext(), DC, + Importer.Import(D->getInnerLocStart()), + Loc, Name.getAsIdentifierInfo(), + T, TInfo, D->getStorageClass(), D->getStorageClassAsWritten()); ToVar->setQualifierInfo(Importer.Import(D->getQualifierLoc())); @@ -2720,6 +2729,7 @@ Decl *ASTNodeImporter::VisitParmVarDecl(ParmVarDecl *D) { // Create the imported parameter. TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); ParmVarDecl *ToParm = ParmVarDecl::Create(Importer.getToContext(), DC, + Importer.Import(D->getInnerLocStart()), Loc, Name.getAsIdentifierInfo(), T, TInfo, D->getStorageClass(), D->getStorageClassAsWritten(), @@ -3479,6 +3489,7 @@ ASTNodeImporter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) { return NonTypeTemplateParmDecl::Create(Importer.getToContext(), Importer.getToContext().getTranslationUnitDecl(), + Importer.Import(D->getInnerLocStart()), Loc, D->getDepth(), D->getPosition(), Name.getAsIdentifierInfo(), T, D->isParameterPack(), TInfo); diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 0fd2c26db3..95f5756402 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1017,10 +1017,11 @@ const char *VarDecl::getStorageClassSpecifierString(StorageClass SC) { return 0; } -VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, +VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, + SourceLocation StartL, SourceLocation IdL, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten) { - return new (C) VarDecl(Var, DC, L, Id, T, TInfo, S, SCAsWritten); + return new (C) VarDecl(Var, DC, StartL, IdL, Id, T, TInfo, S, SCAsWritten); } void VarDecl::setStorageClass(StorageClass SC) { @@ -1031,13 +1032,6 @@ void VarDecl::setStorageClass(StorageClass SC) { SClass = SC; } -SourceLocation VarDecl::getInnerLocStart() const { - SourceLocation Start = getTypeSpecStartLoc(); - if (Start.isInvalid()) - Start = getLocation(); - return Start; -} - SourceRange VarDecl::getSourceRange() const { if (getInit()) return SourceRange(getOuterLocStart(), getInit()->getLocEnd()); @@ -1257,11 +1251,12 @@ void VarDecl::setTemplateSpecializationKind(TemplateSpecializationKind TSK, //===----------------------------------------------------------------------===// ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC, - SourceLocation L, IdentifierInfo *Id, + SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten, Expr *DefArg) { - return new (C) ParmVarDecl(ParmVar, DC, L, Id, T, TInfo, + return new (C) ParmVarDecl(ParmVar, DC, StartLoc, IdLoc, Id, T, TInfo, S, SCAsWritten, DefArg); } @@ -1937,9 +1932,11 @@ bool FunctionDecl::isOutOfLine() const { //===----------------------------------------------------------------------===// FieldDecl *FieldDecl::Create(const ASTContext &C, DeclContext *DC, - SourceLocation L, IdentifierInfo *Id, QualType T, + SourceLocation StartLoc, SourceLocation IdLoc, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable) { - return new (C) FieldDecl(Decl::Field, DC, L, Id, T, TInfo, BW, Mutable); + return new (C) FieldDecl(Decl::Field, DC, StartLoc, IdLoc, Id, T, TInfo, + BW, Mutable); } bool FieldDecl::isAnonymousStructOrUnion() const { @@ -2230,20 +2227,22 @@ NamespaceDecl *NamespaceDecl::getNextNamespace() { } ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC, - SourceLocation loc, - IdentifierInfo *name, - QualType type) { - return new (C) ImplicitParamDecl(DC, loc, name, type); + SourceLocation IdLoc, + IdentifierInfo *Id, + QualType Type) { + return new (C) ImplicitParamDecl(DC, IdLoc, Id, Type); } FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, - StorageClass S, StorageClass SCAsWritten, + StorageClass SC, StorageClass SCAsWritten, bool isInlineSpecified, bool hasWrittenPrototype) { - FunctionDecl *New = new (C) FunctionDecl(Function, DC, NameInfo, T, TInfo, - S, SCAsWritten, isInlineSpecified); + FunctionDecl *New = new (C) FunctionDecl(Function, DC, StartLoc, NameInfo, + T, TInfo, SC, SCAsWritten, + isInlineSpecified); New->HasWrittenPrototype = hasWrittenPrototype; return New; } diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index b6cba0a04c..abed12de2e 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -884,10 +884,11 @@ bool CXXRecordDecl::mayBeAbstract() const { CXXMethodDecl * CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isStatic, StorageClass SCAsWritten, bool isInline) { - return new (C) CXXMethodDecl(CXXMethod, RD, NameInfo, T, TInfo, + return new (C) CXXMethodDecl(CXXMethod, RD, StartLoc, NameInfo, T, TInfo, isStatic, SCAsWritten, isInline); } @@ -1098,12 +1099,13 @@ SourceRange CXXCtorInitializer::getSourceRange() const { CXXConstructorDecl * CXXConstructorDecl::Create(ASTContext &C, EmptyShell Empty) { - return new (C) CXXConstructorDecl(0, DeclarationNameInfo(), + return new (C) CXXConstructorDecl(0, SourceLocation(), DeclarationNameInfo(), QualType(), 0, false, false, false); } CXXConstructorDecl * CXXConstructorDecl::Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, @@ -1112,8 +1114,8 @@ CXXConstructorDecl::Create(ASTContext &C, CXXRecordDecl *RD, assert(NameInfo.getName().getNameKind() == DeclarationName::CXXConstructorName && "Name must refer to a constructor"); - return new (C) CXXConstructorDecl(RD, NameInfo, T, TInfo, isExplicit, - isInline, isImplicitlyDeclared); + return new (C) CXXConstructorDecl(RD, StartLoc, NameInfo, T, TInfo, + isExplicit, isInline, isImplicitlyDeclared); } bool CXXConstructorDecl::isDefaultConstructor() const { @@ -1232,12 +1234,13 @@ CXXConstructorDecl::setInheritedConstructor(const CXXConstructorDecl *BaseCtor){ CXXDestructorDecl * CXXDestructorDecl::Create(ASTContext &C, EmptyShell Empty) { - return new (C) CXXDestructorDecl(0, DeclarationNameInfo(), + return new (C) CXXDestructorDecl(0, SourceLocation(), DeclarationNameInfo(), QualType(), 0, false, false); } CXXDestructorDecl * CXXDestructorDecl::Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, @@ -1245,25 +1248,26 @@ CXXDestructorDecl::Create(ASTContext &C, CXXRecordDecl *RD, assert(NameInfo.getName().getNameKind() == DeclarationName::CXXDestructorName && "Name must refer to a destructor"); - return new (C) CXXDestructorDecl(RD, NameInfo, T, TInfo, isInline, + return new (C) CXXDestructorDecl(RD, StartLoc, NameInfo, T, TInfo, isInline, isImplicitlyDeclared); } CXXConversionDecl * CXXConversionDecl::Create(ASTContext &C, EmptyShell Empty) { - return new (C) CXXConversionDecl(0, DeclarationNameInfo(), + return new (C) CXXConversionDecl(0, SourceLocation(), DeclarationNameInfo(), QualType(), 0, false, false); } CXXConversionDecl * CXXConversionDecl::Create(ASTContext &C, CXXRecordDecl *RD, + SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isInline, bool isExplicit) { assert(NameInfo.getName().getNameKind() == DeclarationName::CXXConversionFunctionName && "Name must refer to a conversion function"); - return new (C) CXXConversionDecl(RD, NameInfo, T, TInfo, + return new (C) CXXConversionDecl(RD, StartLoc, NameInfo, T, TInfo, isInline, isExplicit); } diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 781b96df42..24d281e8b6 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -672,7 +672,8 @@ bool ObjCInterfaceDecl::ClassImplementsProtocol(ObjCProtocolDecl *lProto, //===----------------------------------------------------------------------===// ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, ObjCContainerDecl *DC, - SourceLocation L, IdentifierInfo *Id, + SourceLocation StartLoc, + SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW, bool synthesized) { @@ -709,7 +710,8 @@ ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, ObjCContainerDecl *DC, ID->setIvarList(0); } - return new (C) ObjCIvarDecl(DC, L, Id, T, TInfo, ac, BW, synthesized); + return new (C) ObjCIvarDecl(DC, StartLoc, IdLoc, Id, T, TInfo, + ac, BW, synthesized); } const ObjCInterfaceDecl *ObjCIvarDecl::getContainingInterface() const { @@ -742,9 +744,10 @@ const ObjCInterfaceDecl *ObjCIvarDecl::getContainingInterface() const { //===----------------------------------------------------------------------===// ObjCAtDefsFieldDecl -*ObjCAtDefsFieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, +*ObjCAtDefsFieldDecl::Create(ASTContext &C, DeclContext *DC, + SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW) { - return new (C) ObjCAtDefsFieldDecl(DC, L, Id, T, BW); + return new (C) ObjCAtDefsFieldDecl(DC, StartLoc, IdLoc, Id, T, BW); } //===----------------------------------------------------------------------===// diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp index 78782bc5c7..6fd4d7ec07 100644 --- a/lib/AST/DeclTemplate.cpp +++ b/lib/AST/DeclTemplate.cpp @@ -456,14 +456,16 @@ unsigned TemplateTypeParmDecl::getIndex() const { //===----------------------------------------------------------------------===// NonTypeTemplateParmDecl::NonTypeTemplateParmDecl(DeclContext *DC, - SourceLocation L, unsigned D, - unsigned P, IdentifierInfo *Id, + SourceLocation StartLoc, + SourceLocation IdLoc, + unsigned D, unsigned P, + IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, const QualType *ExpandedTypes, unsigned NumExpandedTypes, TypeSourceInfo **ExpandedTInfos) - : DeclaratorDecl(NonTypeTemplateParm, DC, L, Id, T, TInfo), + : DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc), TemplateParmPosition(D, P), DefaultArgumentAndInherited(0, false), ParameterPack(true), ExpandedParameterPack(true), NumExpandedTypes(NumExpandedTypes) @@ -479,16 +481,18 @@ NonTypeTemplateParmDecl::NonTypeTemplateParmDecl(DeclContext *DC, NonTypeTemplateParmDecl * NonTypeTemplateParmDecl::Create(const ASTContext &C, DeclContext *DC, - SourceLocation L, unsigned D, unsigned P, - IdentifierInfo *Id, QualType T, - bool ParameterPack, TypeSourceInfo *TInfo) { - return new (C) NonTypeTemplateParmDecl(DC, L, D, P, Id, T, ParameterPack, - TInfo); + SourceLocation StartLoc, SourceLocation IdLoc, + unsigned D, unsigned P, IdentifierInfo *Id, + QualType T, bool ParameterPack, + TypeSourceInfo *TInfo) { + return new (C) NonTypeTemplateParmDecl(DC, StartLoc, IdLoc, D, P, Id, + T, ParameterPack, TInfo); } NonTypeTemplateParmDecl * NonTypeTemplateParmDecl::Create(const ASTContext &C, DeclContext *DC, - SourceLocation L, unsigned D, unsigned P, + SourceLocation StartLoc, SourceLocation IdLoc, + unsigned D, unsigned P, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, const QualType *ExpandedTypes, @@ -497,18 +501,12 @@ NonTypeTemplateParmDecl::Create(const ASTContext &C, DeclContext *DC, unsigned Size = sizeof(NonTypeTemplateParmDecl) + NumExpandedTypes * 2 * sizeof(void*); void *Mem = C.Allocate(Size); - return new (Mem) NonTypeTemplateParmDecl(DC, L, D, P, Id, T, TInfo, + return new (Mem) NonTypeTemplateParmDecl(DC, StartLoc, IdLoc, + D, P, Id, T, TInfo, ExpandedTypes, NumExpandedTypes, ExpandedTInfos); } -SourceLocation NonTypeTemplateParmDecl::getInnerLocStart() const { - SourceLocation Start = getTypeSpecStartLoc(); - if (Start.isInvalid()) - Start = getLocation(); - return Start; -} - SourceRange NonTypeTemplateParmDecl::getSourceRange() const { SourceLocation End = getLocation(); if (hasDefaultArgument() && !defaultArgumentWasInherited()) diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index aace5bb6f5..937cece9c0 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -1076,6 +1076,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) { FunctionDecl *FD = FunctionDecl::Create(C, C.getTranslationUnitDecl(), + SourceLocation(), SourceLocation(), II, C.VoidTy, 0, SC_Static, SC_None, @@ -1166,6 +1167,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) { = &CGM.getContext().Idents.get("__destroy_helper_block_"); FunctionDecl *FD = FunctionDecl::Create(C, C.getTranslationUnitDecl(), + SourceLocation(), SourceLocation(), II, C.VoidTy, 0, SC_Static, SC_None, @@ -1269,6 +1271,7 @@ GeneratebyrefCopyHelperFunction(const llvm::Type *T, BlockFieldFlags flags, FunctionDecl *FD = FunctionDecl::Create(getContext(), getContext().getTranslationUnitDecl(), + SourceLocation(), SourceLocation(), II, R, 0, SC_Static, SC_None, @@ -1339,6 +1342,7 @@ CodeGenFunction::GeneratebyrefDestroyHelperFunction(const llvm::Type *T, FunctionDecl *FD = FunctionDecl::Create(getContext(), getContext().getTranslationUnitDecl(), + SourceLocation(), SourceLocation(), II, R, 0, SC_Static, SC_None, diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index bc02ed5b43..9829ae128b 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -4176,9 +4176,9 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm) Ctx.getTranslationUnitDecl(), SourceLocation(), &Ctx.Idents.get("_objc_super")); - RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), SourceLocation(), 0, Ctx.getObjCIdType(), 0, 0, false)); - RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), SourceLocation(), 0, Ctx.getObjCClassType(), 0, 0, false)); RD->completeDefinition(); @@ -4639,9 +4639,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul Ctx.getTranslationUnitDecl(), SourceLocation(), &Ctx.Idents.get("_message_ref_t")); - RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), SourceLocation(), 0, Ctx.VoidPtrTy, 0, 0, false)); - RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), 0, + RD->addDecl(FieldDecl::Create(Ctx, RD, SourceLocation(), SourceLocation(), 0, Ctx.getObjCSelType(), 0, 0, false)); RD->completeDefinition(); diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 464d4c4499..5433108867 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/lib/Rewrite/RewriteObjC.cpp @@ -2360,6 +2360,7 @@ void RewriteObjC::SynthSelGetUidFunctionDecl() { QualType getFuncType = getSimpleFunctionType(Context->getObjCSelType(), &ArgTys[0], ArgTys.size()); SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), SelGetUidIdent, getFuncType, 0, SC_Extern, @@ -2456,6 +2457,7 @@ void RewriteObjC::SynthSuperContructorFunctionDecl() { QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size()); SuperContructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), msgSendIdent, msgSendType, 0, SC_Extern, @@ -2476,6 +2478,7 @@ void RewriteObjC::SynthMsgSendFunctionDecl() { &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), msgSendIdent, msgSendType, 0, SC_Extern, @@ -2499,6 +2502,7 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() { &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), msgSendIdent, msgSendType, 0, SC_Extern, @@ -2519,6 +2523,7 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() { &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), msgSendIdent, msgSendType, 0, SC_Extern, @@ -2545,6 +2550,7 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() { true /*isVariadic*/); MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, SourceLocation(), + SourceLocation(), msgSendIdent, msgSendType, 0, SC_Extern, SC_None, false); @@ -2564,6 +2570,7 @@ void RewriteObjC::SynthMsgSendFpretFunctionDecl() { &ArgTys[0], ArgTys.size(), true /*isVariadic*/); MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), msgSendIdent, msgSendType, 0, SC_Extern, @@ -2578,6 +2585,7 @@ void RewriteObjC::SynthGetClassFunctionDecl() { QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size()); GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), getClassIdent, getClassType, 0, SC_Extern, @@ -2593,6 +2601,7 @@ void RewriteObjC::SynthGetSuperClassFunctionDecl() { QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(), &ArgTys[0], ArgTys.size()); GetSuperClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), getSuperClassIdent, getClassType, 0, @@ -2609,6 +2618,7 @@ void RewriteObjC::SynthGetMetaClassFunctionDecl() { QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(), &ArgTys[0], ArgTys.size()); GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), getClassIdent, getClassType, 0, SC_Extern, @@ -2645,8 +2655,8 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { Preamble += utostr(Exp->getString()->getByteLength()) + "};\n"; VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(), - &Context->Idents.get(S), strType, 0, - SC_Static, SC_None); + SourceLocation(), &Context->Idents.get(S), + strType, 0, SC_Static, SC_None); DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, strType, VK_LValue, SourceLocation()); Expr *Unop = new (Context) UnaryOperator(DRE, UO_AddrOf, @@ -2677,6 +2687,7 @@ QualType RewriteObjC::getSuperStructType() { // Create fields for (unsigned i = 0; i < 2; ++i) { SuperStructDecl->addDecl(FieldDecl::Create(*Context, SuperStructDecl, + SourceLocation(), SourceLocation(), 0, FieldTypes[i], 0, /*BitWidth=*/0, @@ -2708,6 +2719,7 @@ QualType RewriteObjC::getConstantStringStructType() { for (unsigned i = 0; i < 4; ++i) { ConstantStringDecl->addDecl(FieldDecl::Create(*Context, ConstantStringDecl, + SourceLocation(), SourceLocation(), 0, FieldTypes[i], 0, /*BitWidth=*/0, @@ -3164,7 +3176,7 @@ Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) { std::string Name = "_OBJC_PROTOCOL_" + Exp->getProtocol()->getNameAsString(); IdentifierInfo *ID = &Context->Idents.get(Name); VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(), - ID, getProtocolType(), 0, + SourceLocation(), ID, getProtocolType(), 0, SC_Extern, SC_None); DeclRefExpr *DRE = new (Context) DeclRefExpr(VD, getProtocolType(), VK_LValue, SourceLocation()); @@ -4706,7 +4718,9 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) { //PE->dump(); FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(), - &Context->Idents.get("FuncPtr"), Context->VoidPtrTy, 0, + SourceLocation(), + &Context->Idents.get("FuncPtr"), + Context->VoidPtrTy, 0, /*BitWidth=*/0, /*Mutable=*/true); MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(), FD->getType(), VK_LValue, @@ -4758,6 +4772,7 @@ Stmt *RewriteObjC::RewriteBlockDeclRefExpr(Expr *DeclRefExp) { } FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(), + SourceLocation(), &Context->Idents.get("__forwarding"), Context->VoidPtrTy, 0, /*BitWidth=*/0, /*Mutable=*/true); @@ -4767,7 +4782,7 @@ Stmt *RewriteObjC::RewriteBlockDeclRefExpr(Expr *DeclRefExp) { OK_Ordinary); llvm::StringRef Name = VD->getName(); - FD = FieldDecl::Create(*Context, 0, SourceLocation(), + FD = FieldDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), &Context->Idents.get(Name), Context->VoidPtrTy, 0, /*BitWidth=*/0, /*Mutable=*/true); @@ -5263,8 +5278,8 @@ void RewriteObjC::CollectBlockDeclRefInfo(BlockExpr *Exp) { FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(llvm::StringRef name) { IdentifierInfo *ID = &Context->Idents.get(name); QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy); - return FunctionDecl::Create(*Context, TUDecl,SourceLocation(), - ID, FType, 0, SC_Extern, + return FunctionDecl::Create(*Context, TUDecl, SourceLocation(), + SourceLocation(), ID, FType, 0, SC_Extern, SC_None, false, false); } @@ -5345,10 +5360,11 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, // Initialize the block descriptor. std::string DescData = "__" + FuncName + "_block_desc_" + BlockNumber + "_DATA"; - VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(), - &Context->Idents.get(DescData.c_str()), - Context->VoidPtrTy, 0, - SC_Static, SC_None); + VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, + SourceLocation(), SourceLocation(), + &Context->Idents.get(DescData.c_str()), + Context->VoidPtrTy, 0, + SC_Static, SC_None); UnaryOperator *DescRefExpr = new (Context) UnaryOperator(new (Context) DeclRefExpr(NewVD, Context->VoidPtrTy, diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index f957fb7c16..995b2b9ef6 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -865,7 +865,7 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, FunctionDecl *New = FunctionDecl::Create(Context, Context.getTranslationUnitDecl(), - Loc, II, R, /*TInfo=*/0, + Loc, Loc, II, R, /*TInfo=*/0, SC_Extern, SC_None, false, /*hasPrototype=*/true); @@ -876,7 +876,8 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, if (const FunctionProtoType *FT = dyn_cast(R)) { llvm::SmallVector Params; for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) - Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), 0, + Params.push_back(ParmVarDecl::Create(Context, New, SourceLocation(), + SourceLocation(), 0, FT->getArgType(i), /*TInfo=*/0, SC_None, SC_None, 0)); New->setParams(Params.data(), Params.size()); @@ -1394,6 +1395,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { ParamEnd = OldProto->arg_type_end(); ParamType != ParamEnd; ++ParamType) { ParmVarDecl *Param = ParmVarDecl::Create(Context, New, + SourceLocation(), SourceLocation(), 0, *ParamType, /*TInfo=*/0, SC_None, SC_None, @@ -2140,7 +2142,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // Create a declaration for this anonymous struct/union. NamedDecl *Anon = 0; if (RecordDecl *OwningClass = dyn_cast(Owner)) { - Anon = FieldDecl::Create(Context, OwningClass, Record->getLocation(), + Anon = FieldDecl::Create(Context, OwningClass, + DS.getSourceRange().getBegin(), + Record->getLocation(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), TInfo, @@ -2164,8 +2168,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, VarDecl::StorageClass SCAsWritten = StorageClassSpecToVarDeclStorageClass(SCSpec); - Anon = VarDecl::Create(Context, Owner, Record->getLocation(), - /*IdentifierInfo=*/0, + Anon = VarDecl::Create(Context, Owner, + DS.getSourceRange().getBegin(), + Record->getLocation(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), TInfo, SC, SCAsWritten); } @@ -2229,6 +2234,7 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, NamedDecl* Anon = FieldDecl::Create(Context, cast(CurContext), DS.getSourceRange().getBegin(), + DS.getSourceRange().getBegin(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), TInfo, @@ -3031,8 +3037,9 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, bool isExplicitSpecialization = false; VarDecl *NewVD; if (!getLangOptions().CPlusPlus) { - NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(), - II, R, TInfo, SC, SCAsWritten); + NewVD = VarDecl::Create(Context, DC, D.getSourceRange().getBegin(), + D.getIdentifierLoc(), II, + R, TInfo, SC, SCAsWritten); if (D.isInvalidType()) NewVD->setInvalidDecl(); @@ -3101,8 +3108,9 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } - NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(), - II, R, TInfo, SC, SCAsWritten); + NewVD = VarDecl::Create(Context, DC, D.getSourceRange().getBegin(), + D.getIdentifierLoc(), II, + R, TInfo, SC, SCAsWritten); // If this decl has an auto type in need of deduction, make a note of the // Decl so we can diagnose uses of it in its own initializer. @@ -3620,7 +3628,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, (D.isFunctionDeclarator() && D.getFunctionTypeInfo().hasPrototype) || (!isa(R.getTypePtr()) && R->isFunctionProtoType()); - NewFD = FunctionDecl::Create(Context, DC, + NewFD = FunctionDecl::Create(Context, DC, D.getSourceRange().getBegin(), NameInfo, R, TInfo, SC, SCAsWritten, isInline, HasPrototype); if (D.isInvalidType()) @@ -3665,6 +3673,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // Create the new declaration NewFD = CXXConstructorDecl::Create(Context, cast(DC), + D.getSourceRange().getBegin(), NameInfo, R, TInfo, isExplicit, isInline, /*isImplicitlyDeclared=*/false); @@ -3675,6 +3684,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, NewFD = CXXDestructorDecl::Create(Context, cast(DC), + D.getSourceRange().getBegin(), NameInfo, R, TInfo, isInline, /*isImplicitlyDeclared=*/false); @@ -3684,8 +3694,9 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // Create a FunctionDecl to satisfy the function definition parsing // code path. - NewFD = FunctionDecl::Create(Context, DC, D.getIdentifierLoc(), - Name, R, TInfo, SC, SCAsWritten, isInline, + NewFD = FunctionDecl::Create(Context, DC, D.getSourceRange().getBegin(), + D.getIdentifierLoc(), Name, R, TInfo, + SC, SCAsWritten, isInline, /*hasPrototype=*/true); D.setInvalidType(); } @@ -3698,6 +3709,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, CheckConversionDeclarator(D, R, SC); NewFD = CXXConversionDecl::Create(Context, cast(DC), + D.getSourceRange().getBegin(), NameInfo, R, TInfo, isInline, isExplicit); @@ -3733,6 +3745,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // This is a C++ method declaration. NewFD = CXXMethodDecl::Create(Context, cast(DC), + D.getSourceRange().getBegin(), NameInfo, R, TInfo, isStatic, SCAsWritten, isInline); @@ -3741,7 +3754,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // Determine whether the function was written with a // prototype. This true when: // - we're in C++ (where every function has a prototype), - NewFD = FunctionDecl::Create(Context, DC, + NewFD = FunctionDecl::Create(Context, DC, D.getSourceRange().getBegin(), NameInfo, R, TInfo, SC, SCAsWritten, isInline, true/*HasPrototype*/); } @@ -5290,8 +5303,9 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { // the enclosing context. This prevents them from accidentally // looking like class members in C++. ParmVarDecl *New = CheckParameter(Context.getTranslationUnitDecl(), - TInfo, parmDeclType, II, - D.getIdentifierLoc(), + D.getSourceRange().getBegin(), + D.getIdentifierLoc(), II, + parmDeclType, TInfo, StorageClass, StorageClassAsWritten); if (D.isInvalidType()) @@ -5315,7 +5329,10 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { ParmVarDecl *Sema::BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T) { - ParmVarDecl *Param = ParmVarDecl::Create(Context, DC, Loc, 0, + /* FIXME: setting StartLoc == Loc. + Would it be worth to modify callers so as to provide proper source + location for the unnamed parameters, embedding the parameter's type? */ + ParmVarDecl *Param = ParmVarDecl::Create(Context, DC, Loc, Loc, 0, T, Context.getTrivialTypeSourceInfo(T, Loc), SC_None, SC_None, 0); Param->setImplicit(); @@ -5367,14 +5384,13 @@ void Sema::DiagnoseSizeOfParametersAndReturnValue(ParmVarDecl * const *Param, } } -ParmVarDecl *Sema::CheckParameter(DeclContext *DC, - TypeSourceInfo *TSInfo, QualType T, - IdentifierInfo *Name, - SourceLocation NameLoc, +ParmVarDecl *Sema::CheckParameter(DeclContext *DC, SourceLocation StartLoc, + SourceLocation NameLoc, IdentifierInfo *Name, + QualType T, TypeSourceInfo *TSInfo, VarDecl::StorageClass StorageClass, VarDecl::StorageClass StorageClassAsWritten) { - ParmVarDecl *New = ParmVarDecl::Create(Context, DC, NameLoc, Name, - adjustParameterType(T), TSInfo, + ParmVarDecl *New = ParmVarDecl::Create(Context, DC, StartLoc, NameLoc, Name, + adjustParameterType(T), TSInfo, StorageClass, StorageClassAsWritten, 0); @@ -6950,7 +6966,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, } } - FieldDecl *NewFD = FieldDecl::Create(Context, Record, Loc, II, T, TInfo, + FieldDecl *NewFD = FieldDecl::Create(Context, Record, TSSL, Loc, II, T, TInfo, BitWidth, Mutable); if (InvalidDecl) NewFD->setInvalidDecl(); @@ -7250,8 +7266,8 @@ Decl *Sema::ActOnIvar(Scope *S, } // Construct the decl. - ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context, - EnclosingContext, Loc, II, T, + ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context, EnclosingContext, + DeclStart, Loc, II, T, TInfo, ac, (Expr *)BitfieldWidth); if (II) { @@ -7314,7 +7330,7 @@ void Sema::ActOnLastBitfield(SourceLocation DeclLoc, Decl *EnclosingDecl, Expr * BW = IntegerLiteral::Create(Context, Zero, Context.CharTy, DeclLoc); Ivar = ObjCIvarDecl::Create(Context, cast(EnclosingDecl), - DeclLoc, 0, + DeclLoc, DeclLoc, 0, Context.CharTy, Context.CreateTypeSourceInfo(Context.CharTy), ObjCIvarDecl::Private, BW, diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index bdf8cb9096..5f6de1409e 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -2900,6 +2900,7 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II) { NamedDecl *NewD = 0; if (FunctionDecl *FD = dyn_cast(ND)) { NewD = FunctionDecl::Create(FD->getASTContext(), FD->getDeclContext(), + FD->getInnerLocStart(), FD->getLocation(), DeclarationName(II), FD->getType(), FD->getTypeSourceInfo()); if (FD->getQualifier()) { @@ -2908,7 +2909,7 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II) { } } else if (VarDecl *VD = dyn_cast(ND)) { NewD = VarDecl::Create(VD->getASTContext(), VD->getDeclContext(), - VD->getLocation(), II, + VD->getInnerLocStart(), VD->getLocation(), II, VD->getType(), VD->getTypeSourceInfo(), VD->getStorageClass(), VD->getStorageClassAsWritten()); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index ba929587ae..9199fc3d6c 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1826,7 +1826,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, IterationVarName = &SemaRef.Context.Idents.get(OS.str()); } VarDecl *IterationVar - = VarDecl::Create(SemaRef.Context, SemaRef.CurContext, Loc, + = VarDecl::Create(SemaRef.Context, SemaRef.CurContext, Loc, Loc, IterationVarName, SizeType, SemaRef.Context.getTrivialTypeSourceInfo(SizeType, Loc), SC_None, SC_None); @@ -4721,11 +4721,12 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor( // Create the actual constructor declaration. CanQualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl)); + SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationName Name = Context.DeclarationNames.getCXXConstructorName(ClassType); - DeclarationNameInfo NameInfo(Name, ClassDecl->getLocation()); + DeclarationNameInfo NameInfo(Name, ClassLoc); CXXConstructorDecl *DefaultCon - = CXXConstructorDecl::Create(Context, ClassDecl, NameInfo, + = CXXConstructorDecl::Create(Context, ClassDecl, ClassLoc, NameInfo, Context.getFunctionType(Context.VoidTy, 0, 0, EPI), /*TInfo=*/0, @@ -4921,15 +4922,16 @@ void Sema::DeclareInheritedConstructors(CXXRecordDecl *ClassDecl) { // user-writtern inline constructor [...] DeclarationNameInfo DNI(CreatedCtorName, UsingLoc); CXXConstructorDecl *NewCtor = CXXConstructorDecl::Create( - Context, ClassDecl, DNI, QualType(NewCtorType, 0), /*TInfo=*/0, - BaseCtor->isExplicit(), /*Inline=*/true, + Context, ClassDecl, UsingLoc, DNI, QualType(NewCtorType, 0), + /*TInfo=*/0, BaseCtor->isExplicit(), /*Inline=*/true, /*ImplicitlyDeclared=*/true); NewCtor->setAccess(BaseCtor->getAccess()); // Build up the parameter decls and add them. llvm::SmallVector ParamDecls; for (unsigned i = 0; i < params; ++i) { - ParamDecls.push_back(ParmVarDecl::Create(Context, NewCtor, UsingLoc, + ParamDecls.push_back(ParmVarDecl::Create(Context, NewCtor, + UsingLoc, UsingLoc, /*IdentifierInfo=*/0, BaseCtorType->getArgType(i), /*TInfo=*/0, SC_None, @@ -4999,11 +5001,12 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) { CanQualType ClassType = Context.getCanonicalType(Context.getTypeDeclType(ClassDecl)); + SourceLocation ClassLoc = ClassDecl->getLocation(); DeclarationName Name = Context.DeclarationNames.getCXXDestructorName(ClassType); - DeclarationNameInfo NameInfo(Name, ClassDecl->getLocation()); + DeclarationNameInfo NameInfo(Name, ClassLoc); CXXDestructorDecl *Destructor - = CXXDestructorDecl::Create(Context, ClassDecl, NameInfo, Ty, 0, + = CXXDestructorDecl::Create(Context, ClassDecl, ClassLoc, NameInfo, Ty, 0, /*isInline=*/true, /*isImplicitlyDeclared=*/true); Destructor->setAccess(AS_public); @@ -5190,7 +5193,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T, OS << "__i" << Depth; IterationVarName = &S.Context.Idents.get(OS.str()); } - VarDecl *IterationVar = VarDecl::Create(S.Context, S.CurContext, Loc, + VarDecl *IterationVar = VarDecl::Create(S.Context, S.CurContext, Loc, Loc, IterationVarName, SizeType, S.Context.getTrivialTypeSourceInfo(SizeType, Loc), SC_None, SC_None); @@ -5395,9 +5398,10 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { EPI.NumExceptions = ExceptSpec.size(); EPI.Exceptions = ExceptSpec.data(); DeclarationName Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal); - DeclarationNameInfo NameInfo(Name, ClassDecl->getLocation()); + SourceLocation ClassLoc = ClassDecl->getLocation(); + DeclarationNameInfo NameInfo(Name, ClassLoc); CXXMethodDecl *CopyAssignment - = CXXMethodDecl::Create(Context, ClassDecl, NameInfo, + = CXXMethodDecl::Create(Context, ClassDecl, ClassLoc, NameInfo, Context.getFunctionType(RetType, &ArgType, 1, EPI), /*TInfo=*/0, /*isStatic=*/false, /*StorageClassAsWritten=*/SC_None, @@ -5408,8 +5412,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { // Add the parameter to the operator. ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment, - ClassDecl->getLocation(), - /*Id=*/0, + ClassLoc, ClassLoc, /*Id=*/0, ArgType, /*TInfo=*/0, SC_None, SC_None, 0); @@ -5860,9 +5863,10 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( DeclarationName Name = Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(ClassType)); - DeclarationNameInfo NameInfo(Name, ClassDecl->getLocation()); + SourceLocation ClassLoc = ClassDecl->getLocation(); + DeclarationNameInfo NameInfo(Name, ClassLoc); CXXConstructorDecl *CopyConstructor - = CXXConstructorDecl::Create(Context, ClassDecl, NameInfo, + = CXXConstructorDecl::Create(Context, ClassDecl, ClassLoc, NameInfo, Context.getFunctionType(Context.VoidTy, &ArgType, 1, EPI), /*TInfo=*/0, @@ -5877,7 +5881,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( // Add the parameter to the constructor. ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor, - ClassDecl->getLocation(), + ClassLoc, ClassLoc, /*IdentifierInfo=*/0, ArgType, /*TInfo=*/0, SC_None, @@ -6608,10 +6612,11 @@ Decl *Sema::ActOnFinishLinkageSpecification(Scope *S, /// \brief Perform semantic analysis for the variable declaration that /// occurs within a C++ catch clause, returning the newly-created /// variable. -VarDecl *Sema::BuildExceptionDeclaration(Scope *S, +VarDecl *Sema::BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, - IdentifierInfo *Name, - SourceLocation Loc) { + SourceLocation StartLoc, + SourceLocation Loc, + IdentifierInfo *Name) { bool Invalid = false; QualType ExDeclType = TInfo->getType(); @@ -6681,9 +6686,8 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, } } - VarDecl *ExDecl = VarDecl::Create(Context, CurContext, Loc, - Name, ExDeclType, TInfo, SC_None, - SC_None); + VarDecl *ExDecl = VarDecl::Create(Context, CurContext, StartLoc, Loc, Name, + ExDeclType, TInfo, SC_None, SC_None); ExDecl->setExceptionVariable(true); if (!Invalid) { @@ -6766,9 +6770,9 @@ Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { } VarDecl *ExDecl = BuildExceptionDeclaration(S, TInfo, - D.getIdentifier(), - D.getIdentifierLoc()); - + D.getSourceRange().getBegin(), + D.getIdentifierLoc(), + D.getIdentifier()); if (Invalid) ExDecl->setInvalidDecl(); diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 24ca4e6164..d34b00031d 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1797,10 +1797,14 @@ Decl *Sema::ActOnMethodDeclaration( } } + SourceLocation StartLoc = DI + ? DI->getTypeLoc().getBeginLoc() + : ArgInfo[i].NameLoc; + ParmVarDecl* Param - = ParmVarDecl::Create(Context, ObjCMethod, ArgInfo[i].NameLoc, - ArgInfo[i].Name, ArgType, DI, - SC_None, SC_None, 0); + = ParmVarDecl::Create(Context, ObjCMethod, + StartLoc, ArgInfo[i].NameLoc, ArgInfo[i].Name, + ArgType, DI, SC_None, SC_None, 0); if (ArgType->isObjCObjectType()) { Diag(ArgInfo[i].NameLoc, @@ -1928,7 +1932,9 @@ void Sema::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, for (unsigned i = 0; i < Ivars.size(); i++) { FieldDecl* ID = cast(Ivars[i]); RecordDecl *Record = dyn_cast(TagD); - Decl *FD = ObjCAtDefsFieldDecl::Create(Context, Record, ID->getLocation(), + Decl *FD = ObjCAtDefsFieldDecl::Create(Context, Record, + /*FIXME: StartL=*/ID->getLocation(), + ID->getLocation(), ID->getIdentifier(), ID->getType(), ID->getBitWidth()); Decls.push_back(FD); @@ -1946,17 +1952,17 @@ void Sema::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, } /// \brief Build a type-check a new Objective-C exception variable declaration. -VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, - QualType T, - IdentifierInfo *Name, - SourceLocation NameLoc, +VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T, + SourceLocation StartLoc, + SourceLocation IdLoc, + IdentifierInfo *Id, bool Invalid) { // ISO/IEC TR 18037 S6.7.3: "The type of an object with automatic storage // duration shall not be qualified by an address-space qualifier." // Since all parameters have automatic store duration, they can not have // an address space. if (T.getAddressSpace() != 0) { - Diag(NameLoc, diag::err_arg_with_address_space); + Diag(IdLoc, diag::err_arg_with_address_space); Invalid = true; } @@ -1968,14 +1974,14 @@ VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, // Okay: we don't know what this type will instantiate to. } else if (!T->isObjCObjectPointerType()) { Invalid = true; - Diag(NameLoc ,diag::err_catch_param_not_objc_type); + Diag(IdLoc ,diag::err_catch_param_not_objc_type); } else if (T->isObjCQualifiedIdType()) { Invalid = true; - Diag(NameLoc, diag::err_illegal_qualifiers_on_catch_parm); + Diag(IdLoc, diag::err_illegal_qualifiers_on_catch_parm); } - VarDecl *New = VarDecl::Create(Context, CurContext, NameLoc, Name, T, TInfo, - SC_None, SC_None); + VarDecl *New = VarDecl::Create(Context, CurContext, StartLoc, IdLoc, Id, + T, TInfo, SC_None, SC_None); New->setExceptionVariable(true); if (Invalid) @@ -2016,8 +2022,10 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) { << Context.getTypeDeclType(OwnedDecl); } - VarDecl *New = BuildObjCExceptionDecl(TInfo, ExceptionType, D.getIdentifier(), - D.getIdentifierLoc(), + VarDecl *New = BuildObjCExceptionDecl(TInfo, ExceptionType, + D.getSourceRange().getBegin(), + D.getIdentifierLoc(), + D.getIdentifier(), D.isInvalidType()); // Parameter declarators cannot be qualified (C++ [dcl.meaning]p1). diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 8f79428eae..96b37935d2 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1519,7 +1519,7 @@ static ObjCIvarDecl *SynthesizeProvisionalIvar(Sema &SemaRef, if (!DynamicImplSeen) { QualType PropType = SemaRef.Context.getCanonicalType(property->getType()); ObjCIvarDecl *Ivar = ObjCIvarDecl::Create(SemaRef.Context, ClassImpDecl, - NameLoc, + NameLoc, NameLoc, II, PropType, /*Dinfo=*/0, ObjCIvarDecl::Private, (Expr *)0, true); diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index baa1597062..3fac3a9a49 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1509,7 +1509,8 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, QualType FnType = Context.getFunctionType(Return, &Argument, 1, EPI); FunctionDecl *Alloc = - FunctionDecl::Create(Context, GlobalCtx, SourceLocation(), Name, + FunctionDecl::Create(Context, GlobalCtx, SourceLocation(), + SourceLocation(), Name, FnType, /*TInfo=*/0, SC_None, SC_None, false, true); Alloc->setImplicit(); @@ -1518,9 +1519,9 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, Alloc->addAttr(::new (Context) MallocAttr(SourceLocation(), Context)); ParmVarDecl *Param = ParmVarDecl::Create(Context, Alloc, SourceLocation(), - 0, Argument, /*TInfo=*/0, - SC_None, - SC_None, 0); + SourceLocation(), 0, + Argument, /*TInfo=*/0, + SC_None, SC_None, 0); Alloc->setParams(&Param, 1); // FIXME: Also add this declaration to the IdentifierResolver, but diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index b086ca7514..91de095ac7 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -408,8 +408,9 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, ObjCInterfaceDecl *ClassDeclared; Ivar = IDecl->lookupInstanceVariable(PropertyIvar, ClassDeclared); if (!Ivar) { - Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl, PropertyLoc, - PropertyIvar, PropType, /*Dinfo=*/0, + Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl, + PropertyLoc, PropertyLoc, PropertyIvar, + PropType, /*Dinfo=*/0, ObjCIvarDecl::Private, (Expr *)0, true); ClassImpDecl->addDecl(Ivar); @@ -1235,7 +1236,8 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, // Invent the arguments for the setter. We don't bother making a // nice name for the argument. - ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterMethod, Loc, + ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterMethod, + Loc, Loc, property->getIdentifier(), property->getType(), /*TInfo=*/0, diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index e60a1c418b..cd5573b2f1 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -650,6 +650,7 @@ Decl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, bool IsParameterPack = D.hasEllipsis(); NonTypeTemplateParmDecl *Param = NonTypeTemplateParmDecl::Create(Context, Context.getTranslationUnitDecl(), + D.getSourceRange().getBegin(), D.getIdentifierLoc(), Depth, Position, ParamName, T, IsParameterPack, TInfo); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 6fb6ea270b..c951b2573a 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -724,8 +724,9 @@ namespace { /// as an instantiated local. VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, TypeSourceInfo *Declarator, - IdentifierInfo *Name, - SourceLocation Loc); + SourceLocation StartLoc, + SourceLocation NameLoc, + IdentifierInfo *Name); /// \brief Rebuild the Objective-C exception declaration and register the /// declaration as an instantiated local. @@ -880,10 +881,11 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D, VarDecl * TemplateInstantiator::RebuildExceptionDecl(VarDecl *ExceptionDecl, TypeSourceInfo *Declarator, - IdentifierInfo *Name, - SourceLocation Loc) { + SourceLocation StartLoc, + SourceLocation NameLoc, + IdentifierInfo *Name) { VarDecl *Var = inherited::RebuildExceptionDecl(ExceptionDecl, Declarator, - Name, Loc); + StartLoc, NameLoc, Name); if (Var) getSema().CurrentInstantiationScope->InstantiatedLocal(ExceptionDecl, Var); return Var; @@ -1451,9 +1453,10 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm, } ParmVarDecl *NewParm = CheckParameter(Context.getTranslationUnitDecl(), - NewDI, NewDI->getType(), - OldParm->getIdentifier(), + OldParm->getInnerLocStart(), OldParm->getLocation(), + OldParm->getIdentifier(), + NewDI->getType(), NewDI, OldParm->getStorageClass(), OldParm->getStorageClassAsWritten()); if (!NewParm) diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 102ef51808..d3672689fa 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -264,6 +264,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { // Build the instantiated declaration VarDecl *Var = VarDecl::Create(SemaRef.Context, Owner, + D->getInnerLocStart(), D->getLocation(), D->getIdentifier(), DI->getType(), DI, D->getStorageClass(), @@ -999,8 +1000,8 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, } FunctionDecl *Function = - FunctionDecl::Create(SemaRef.Context, DC, D->getLocation(), - D->getDeclName(), T, TInfo, + FunctionDecl::Create(SemaRef.Context, DC, D->getInnerLocStart(), + D->getLocation(), D->getDeclName(), T, TInfo, D->getStorageClass(), D->getStorageClassAsWritten(), D->isInlineSpecified(), D->hasWrittenPrototype()); @@ -1296,27 +1297,28 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D, CXXRecordDecl *Record = cast(DC); CXXMethodDecl *Method = 0; + SourceLocation StartLoc = D->getInnerLocStart(); DeclarationNameInfo NameInfo = SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs); if (CXXConstructorDecl *Constructor = dyn_cast(D)) { Method = CXXConstructorDecl::Create(SemaRef.Context, Record, - NameInfo, T, TInfo, + StartLoc, NameInfo, T, TInfo, Constructor->isExplicit(), Constructor->isInlineSpecified(), false); } else if (CXXDestructorDecl *Destructor = dyn_cast(D)) { Method = CXXDestructorDecl::Create(SemaRef.Context, Record, - NameInfo, T, TInfo, + StartLoc, NameInfo, T, TInfo, Destructor->isInlineSpecified(), false); } else if (CXXConversionDecl *Conversion = dyn_cast(D)) { Method = CXXConversionDecl::Create(SemaRef.Context, Record, - NameInfo, T, TInfo, + StartLoc, NameInfo, T, TInfo, Conversion->isInlineSpecified(), Conversion->isExplicit()); } else { Method = CXXMethodDecl::Create(SemaRef.Context, Record, - NameInfo, T, TInfo, + StartLoc, NameInfo, T, TInfo, D->isStatic(), D->getStorageClassAsWritten(), D->isInlineSpecified()); @@ -1589,7 +1591,8 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl( NonTypeTemplateParmDecl *Param; if (IsExpandedParameterPack) Param = NonTypeTemplateParmDecl::Create(SemaRef.Context, Owner, - D->getLocation(), + D->getInnerLocStart(), + D->getLocation(), D->getDepth() - TemplateArgs.getNumLevels(), D->getPosition(), D->getIdentifier(), T, @@ -1599,6 +1602,7 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl( ExpandedParameterPackTypesAsWritten.data()); else Param = NonTypeTemplateParmDecl::Create(SemaRef.Context, Owner, + D->getInnerLocStart(), D->getLocation(), D->getDepth() - TemplateArgs.getNumLevels(), D->getPosition(), diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 7f055c08cc..835b2f875e 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -1130,9 +1130,10 @@ public: /// Subclasses may override this routine to provide different behavior. VarDecl *RebuildObjCExceptionDecl(VarDecl *ExceptionDecl, TypeSourceInfo *TInfo, QualType T) { - return getSema().BuildObjCExceptionDecl(TInfo, T, - ExceptionDecl->getIdentifier(), - ExceptionDecl->getLocation()); + return getSema().BuildObjCExceptionDecl(TInfo, T, + ExceptionDecl->getInnerLocStart(), + ExceptionDecl->getLocation(), + ExceptionDecl->getIdentifier()); } /// \brief Build a new Objective-C @catch statement. @@ -1197,11 +1198,13 @@ public: /// /// By default, performs semantic analysis to build the new decaration. /// Subclasses may override this routine to provide different behavior. - VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, + VarDecl *RebuildExceptionDecl(VarDecl *ExceptionDecl, TypeSourceInfo *Declarator, - IdentifierInfo *Name, - SourceLocation Loc) { - return getSema().BuildExceptionDeclaration(0, Declarator, Name, Loc); + SourceLocation StartLoc, + SourceLocation IdLoc, + IdentifierInfo *Id) { + return getSema().BuildExceptionDeclaration(0, Declarator, + StartLoc, IdLoc, Id); } /// \brief Build a new C++ catch statement. @@ -3628,6 +3631,7 @@ TreeTransform::TransformFunctionTypeParam(ParmVarDecl *OldParm, else return ParmVarDecl::Create(SemaRef.Context, OldParm->getDeclContext(), + OldParm->getInnerLocStart(), OldParm->getLocation(), OldParm->getIdentifier(), NewDI->getType(), @@ -5288,8 +5292,9 @@ TreeTransform::TransformCXXCatchStmt(CXXCatchStmt *S) { return StmtError(); Var = getDerived().RebuildExceptionDecl(ExceptionDecl, T, - ExceptionDecl->getIdentifier(), - ExceptionDecl->getLocation()); + ExceptionDecl->getInnerLocStart(), + ExceptionDecl->getLocation(), + ExceptionDecl->getIdentifier()); if (!Var || Var->isInvalidDecl()) return StmtError(); } diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index b145d5b3e7..1c14c8451a 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -294,6 +294,7 @@ void ASTDeclReader::VisitEnumConstantDecl(EnumConstantDecl *ECD) { void ASTDeclReader::VisitDeclaratorDecl(DeclaratorDecl *DD) { VisitValueDecl(DD); + DD->setInnerLocStart(ReadSourceLocation(Record, Idx)); if (Record[Idx++]) { // hasExtInfo DeclaratorDecl::ExtInfo *Info = new (*Reader.getContext()) DeclaratorDecl::ExtInfo(); @@ -1435,8 +1436,8 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) { 0, llvm::APSInt()); break; case DECL_FUNCTION: - D = FunctionDecl::Create(*Context, 0, SourceLocation(), DeclarationName(), - QualType(), 0); + D = FunctionDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), + DeclarationName(), QualType(), 0); break; case DECL_LINKAGE_SPEC: D = LinkageSpecDecl::Create(*Context, 0, SourceLocation(), @@ -1484,8 +1485,8 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) { D = CXXRecordDecl::Create(*Context, Decl::EmptyShell()); break; case DECL_CXX_METHOD: - D = CXXMethodDecl::Create(*Context, 0, DeclarationNameInfo(), - QualType(), 0); + D = CXXMethodDecl::Create(*Context, 0, SourceLocation(), + DeclarationNameInfo(), QualType(), 0); break; case DECL_CXX_CONSTRUCTOR: D = CXXConstructorDecl::Create(*Context, Decl::EmptyShell()); @@ -1522,13 +1523,14 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) { D = TemplateTypeParmDecl::Create(*Context, Decl::EmptyShell()); break; case DECL_NON_TYPE_TEMPLATE_PARM: - D = NonTypeTemplateParmDecl::Create(*Context, 0, SourceLocation(), 0,0,0, - QualType(), false, 0); + D = NonTypeTemplateParmDecl::Create(*Context, 0, SourceLocation(), + SourceLocation(), 0, 0, 0, QualType(), + false, 0); break; case DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK: - D = NonTypeTemplateParmDecl::Create(*Context, 0, SourceLocation(), 0, 0, - 0, QualType(), 0, 0, Record[Idx++], - 0); + D = NonTypeTemplateParmDecl::Create(*Context, 0, SourceLocation(), + SourceLocation(), 0, 0, 0, QualType(), + 0, 0, Record[Idx++], 0); break; case DECL_TEMPLATE_TEMPLATE_PARM: D = TemplateTemplateParmDecl::Create(*Context, 0, SourceLocation(), 0, 0, @@ -1546,15 +1548,15 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) { D = ObjCInterfaceDecl::Create(*Context, 0, SourceLocation(), 0); break; case DECL_OBJC_IVAR: - D = ObjCIvarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, - ObjCIvarDecl::None); + D = ObjCIvarDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), + 0, QualType(), 0, ObjCIvarDecl::None); break; case DECL_OBJC_PROTOCOL: D = ObjCProtocolDecl::Create(*Context, 0, SourceLocation(), 0); break; case DECL_OBJC_AT_DEFS_FIELD: - D = ObjCAtDefsFieldDecl::Create(*Context, 0, SourceLocation(), 0, - QualType(), 0); + D = ObjCAtDefsFieldDecl::Create(*Context, 0, SourceLocation(), + SourceLocation(), 0, QualType(), 0); break; case DECL_OBJC_CLASS: D = ObjCClassDecl::Create(*Context, 0, SourceLocation()); @@ -1586,16 +1588,16 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) { SourceLocation()); break; case DECL_FIELD: - D = FieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, 0, - false); + D = FieldDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), 0, + QualType(), 0, 0, false); break; case DECL_INDIRECTFIELD: D = IndirectFieldDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, 0); break; case DECL_VAR: - D = VarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, - SC_None, SC_None); + D = VarDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), 0, + QualType(), 0, SC_None, SC_None); break; case DECL_IMPLICIT_PARAM: @@ -1603,8 +1605,8 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) { break; case DECL_PARM_VAR: - D = ParmVarDecl::Create(*Context, 0, SourceLocation(), 0, QualType(), 0, - SC_None, SC_None, 0); + D = ParmVarDecl::Create(*Context, 0, SourceLocation(), SourceLocation(), 0, + QualType(), 0, SC_None, SC_None, 0); break; case DECL_FILE_SCOPE_ASM: D = FileScopeAsmDecl::Create(*Context, 0, 0, SourceLocation(), diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 96b26e8bf7..b1f6b45799 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -221,6 +221,7 @@ void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) { void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) { VisitValueDecl(D); + Writer.AddSourceLocation(D->getInnerLocStart(), Record); Record.push_back(D->hasExtInfo()); if (D->hasExtInfo()) Writer.AddQualifierInfo(*D->getExtInfo(), Record); @@ -1129,6 +1130,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() { // ValueDecl Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type // DeclaratorDecl + Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo Abv->Add(BitCodeAbbrevOp(serialization::PREDEF_TYPE_NULL_ID)); // InfoType // VarDecl diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m index 1aa26ac77c..2e11191dca 100644 --- a/test/Index/TestClassDecl.m +++ b/test/Index/TestClassDecl.m @@ -28,6 +28,6 @@ void function(Foo * arg) // CHECK-scan: [14:1 - 16:2] UnexposedStmt= // CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:12 Extent=[10:1 - 11:5] -// CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:6 - 16:2] +// CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:1 - 16:2] // CHECK-load: TestClassDecl.m:13:21: ParmDecl=arg:13:21 (Definition) Extent=[13:15 - 13:24] diff --git a/test/Index/blocks.c b/test/Index/blocks.c index a8965d2aa6..633e171ffa 100644 --- a/test/Index/blocks.c +++ b/test/Index/blocks.c @@ -9,17 +9,17 @@ void test() { ^ int_t(struct foo *foo) { return (int_t) foo->x + i; }(&_foo); } -// CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:6 - 10:2] +// CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:1 - 10:2] // CHECK: blocks.c:6:13: UnexposedStmt= Extent=[6:13 - 10:2] // CHECK: blocks.c:7:3: UnexposedStmt= Extent=[7:3 - 7:26] -// CHECK: blocks.c:7:21: VarDecl=_foo:7:21 (Definition) Extent=[7:17 - 7:25] +// CHECK: blocks.c:7:21: VarDecl=_foo:7:21 (Definition) Extent=[7:3 - 7:25] // CHECK: blocks.c:7:17: TypeRef=struct foo:4:8 Extent=[7:17 - 7:20] -// CHECK: blocks.c:8:11: VarDecl=i:8:11 (Definition) Extent=[8:11 - 8:16] +// CHECK: blocks.c:8:11: VarDecl=i:8:11 (Definition) Extent=[8:3 - 8:16] // CHECK: blocks.c:8:15: UnexposedExpr= Extent=[8:15 - 8:16] // CHECK: blocks.c:9:3: CallExpr= Extent=[9:3 - 9:65] // CHECK: blocks.c:9:3: UnexposedExpr= Extent=[9:3 - 9:58] // CHECK: blocks.c:9:5: TypeRef=int_t:3:13 Extent=[9:5 - 9:10] -// CHECK: blocks.c:9:23: ParmDecl=foo:9:23 (Definition) Extent=[9:18 - 9:26] +// CHECK: blocks.c:9:23: ParmDecl=foo:9:23 (Definition) Extent=[9:11 - 9:26] // CHECK: blocks.c:9:18: TypeRef=struct foo:4:8 Extent=[9:18 - 9:21] // CHECK: blocks.c:9:28: UnexposedStmt= Extent=[9:28 - 9:58] // CHECK: blocks.c:9:30: UnexposedStmt= Extent=[9:30 - 9:55] diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index 901b9a3f09..64cffb2f63 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -71,7 +71,7 @@ struct X0; struct X0 {}; // CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 12:5] -// CHECK: c-index-api-loadTU-test.m:6:32: ObjCIvarDecl=myoutlet:6:32 (Definition) Extent=[6:32 - 6:40] +// CHECK: c-index-api-loadTU-test.m:6:32: ObjCIvarDecl=myoutlet:6:32 (Definition) Extent=[6:3 - 6:40] // CHECK: :0:0: attribute(iboutlet)= // CHECK: c-index-api-loadTU-test.m:6:29: TypeRef=id:0:0 Extent=[6:29 - 6:31] // CHECK: c-index-api-loadTU-test.m:8:1: ObjCInstanceMethodDecl=myMessage::8:1 Extent=[8:1 - 8:54] @@ -95,14 +95,14 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:33:12: ObjCInterfaceDecl=Baz:33:12 Extent=[33:1 - 40:5] // CHECK: c-index-api-loadTU-test.m:33:18: ObjCSuperClassRef=Bar:14:12 Extent=[33:18 - 33:21] // CHECK: c-index-api-loadTU-test.m:33:23: ObjCProtocolRef=SubP:29:1 Extent=[33:23 - 33:27] -// CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:9 - 35:16] +// CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:5 - 35:16] // CHECK: c-index-api-loadTU-test.m:38:1: ObjCInstanceMethodDecl=bazMethod:38:1 Extent=[38:1 - 38:21] // CHECK: c-index-api-loadTU-test.m:38:4: ObjCClassRef=Foo:4:12 Extent=[38:4 - 38:7] // CHECK: c-index-api-loadTU-test.m:42:1: EnumDecl=:42:1 (Definition) Extent=[42:1 - 44:2] // CHECK: c-index-api-loadTU-test.m:43:3: EnumConstantDecl=someEnum:43:3 (Definition) Extent=[43:3 - 43:11] -// CHECK: c-index-api-loadTU-test.m:46:5: FunctionDecl=main:46:5 (Definition) Extent=[46:5 - 55:2] +// CHECK: c-index-api-loadTU-test.m:46:5: FunctionDecl=main:46:5 (Definition) Extent=[46:1 - 55:2] // CHECK: c-index-api-loadTU-test.m:46:15: ParmDecl=argc:46:15 (Definition) Extent=[46:11 - 46:19] -// CHECK: c-index-api-loadTU-test.m:46:34: ParmDecl=argv:46:34 (Definition) Extent=[46:27 - 46:38] +// CHECK: c-index-api-loadTU-test.m:46:34: ParmDecl=argv:46:34 (Definition) Extent=[46:21 - 46:38] // CHECK: c-index-api-loadTU-test.m:47:8: VarDecl=bee:47:8 (Definition) Extent=[47:2 - 47:11] // CHECK: c-index-api-loadTU-test.m:47:2: ObjCClassRef=Baz:33:12 Extent=[47:2 - 47:5] // CHECK: c-index-api-loadTU-test.m:48:5: VarDecl=a:48:5 (Definition) Extent=[48:2 - 48:18] @@ -135,9 +135,9 @@ struct X0 {}; // CHECK: c-index-api-loadTU-test.m:54:18: UnexposedExpr=bee:47:8 Extent=[54:18 - 54:36] // CHECK: c-index-api-loadTU-test.m:54:33: DeclRefExpr=bee:47:8 Extent=[54:33 - 54:36] // CHECK: c-index-api-loadTU-test.m:62:12: ObjCInterfaceDecl=TestAttributes:62:12 Extent=[62:1 - 67:5] -// CHECK: c-index-api-loadTU-test.m:63:19: ObjCIvarDecl=anOutlet:63:19 (Definition) Extent=[63:19 - 63:27] +// CHECK: c-index-api-loadTU-test.m:63:19: ObjCIvarDecl=anOutlet:63:19 (Definition) Extent=[58:18 - 63:27] // CHECK: :0:0: attribute(iboutlet)= -// CHECK: c-index-api-loadTU-test.m:64:29: ObjCIvarDecl=anOutletCollection:64:29 (Definition) Extent=[64:29 - 64:47] +// CHECK: c-index-api-loadTU-test.m:64:29: ObjCIvarDecl=anOutletCollection:64:29 (Definition) Extent=[59:39 - 64:47] // CHECK: :0:0: attribute(iboutletcollection)= [IBOutletCollection=ObjCObjectPointer] // CHECK: c-index-api-loadTU-test.m:64:26: TypeRef=id:0:0 Extent=[64:26 - 64:28] // CHECK: c-index-api-loadTU-test.m:66:1: ObjCInstanceMethodDecl=actionMethod::66:1 Extent=[66:1 - 66:35] diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index 91482eb798..651a1e5fe4 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -108,8 +108,8 @@ void f() { // CHECK: [42:2 - 44:1] Invalid Cursor => NoDeclFound // CHECK: [44:1 - 44:11] FunctionDecl=main:44:5 (Definition) // CHECK: [44:11 - 44:19] ParmDecl=argc:44:15 (Definition) -// CHECK: [44:19 - 44:27] FunctionDecl=main:44:5 (Definition) -// CHECK: [44:27 - 44:38] ParmDecl=argv:44:34 (Definition) +// CHECK: [44:19 - 44:21] FunctionDecl=main:44:5 (Definition) +// CHECK: [44:21 - 44:38] ParmDecl=argv:44:34 (Definition) // CHECK: [44:38 - 44:42] FunctionDecl=main:44:5 (Definition) // CHECK: [44:42 - 45:2] UnexposedStmt= // CHECK: [45:2 - 45:5] ObjCClassRef=Baz:31:12 diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp index 6778ec8e69..abc95545c5 100644 --- a/test/Index/index-templates.cpp +++ b/test/Index/index-templates.cpp @@ -116,7 +116,7 @@ struct SuperPair : Pair, Pair { }; // CHECK-LOAD: index-templates.cpp:8:19: TemplateTypeParameter=T:8:19 (Definition) Extent=[8:10 - 8:20] // CHECK-LOAD: index-templates.cpp:8:31: TemplateTypeParameter=Alloc:8:31 (Definition) Extent=[8:22 - 8:51] // CHECK-LOAD: index-templates.cpp:8:39: TemplateRef=allocator:6:28 Extent=[8:39 - 8:48] -// CHECK-LOAD: index-templates.cpp:10:8: CXXMethod=clear:10:8 Extent=[10:8 - 10:15] +// CHECK-LOAD: index-templates.cpp:10:8: CXXMethod=clear:10:8 Extent=[10:3 - 10:15] // CHECK-LOAD: index-templates.cpp:14:7: ClassTemplatePartialSpecialization=vector:14:7 (Definition) [Specialization of vector:9:7] Extent=[13:1 - 14:21] // CHECK-LOAD: index-templates.cpp:13:19: TemplateTypeParameter=T:13:19 (Definition) Extent=[13:10 - 13:20] // CHECK-LOAD: index-templates.cpp:16:8: StructDecl=Z1:16:8 (Definition) Extent=[16:1 - 16:14] @@ -126,14 +126,14 @@ struct SuperPair : Pair, Pair { }; // CHECK-LOAD: index-templates.cpp:20:8: StructDecl=Z2:20:8 (Definition) Extent=[20:1 - 20:14] // CHECK-LOAD: index-templates.cpp:23:7: ClassDecl=vector:23:7 (Definition) [Specialization of vector:9:7] Extent=[22:1 - 25:2] // CHECK-LOAD: index-templates.cpp:23:14: TypeRef=struct Z2:20:8 Extent=[23:14 - 23:16] -// CHECK-LOAD: index-templates.cpp:24:8: CXXMethod=clear:24:8 Extent=[24:8 - 24:15] +// CHECK-LOAD: index-templates.cpp:24:8: CXXMethod=clear:24:8 Extent=[24:3 - 24:15] // CHECK-LOAD: index-templates.cpp:28:8: ClassTemplate=Y:28:8 (Definition) Extent=[27:1 - 31:2] // CHECK-LOAD: index-templates.cpp:27:19: TemplateTypeParameter=T:27:19 (Definition) Extent=[27:10 - 27:20] // CHECK-LOAD: index-templates.cpp:27:31: TemplateTypeParameter=U:27:31 (Definition) Extent=[27:22 - 27:32] // CHECK-LOAD: index-templates.cpp:29:21: UsingDeclaration=type:29:21 Extent=[29:3 - 29:25] // CHECK-LOAD: index-templates.cpp:30:12: UsingDeclaration=operator Z2:30:12 Extent=[30:3 - 30:23] // CHECK-LOAD: index-templates.cpp:30:21: TypeRef=struct Z2:20:8 Extent=[30:21 - 30:23] -// CHECK-LOAD: index-templates.cpp:35:16: VarDecl=OneDimension:35:16 (Definition) Extent=[35:7 - 35:32] +// CHECK-LOAD: index-templates.cpp:35:16: VarDecl=OneDimension:35:16 (Definition) Extent=[35:1 - 35:32] // CHECK-LOAD: index-templates.cpp:35:31: UnexposedExpr= Extent=[35:31 - 35:32] // CHECK-LOAD: index-templates.cpp:35:31: UnexposedExpr= Extent=[35:31 - 35:32] // CHECK-LOAD: index-templates.cpp:37:8: ClassTemplate=array:37:8 (Definition) Extent=[36:1 - 37:17] @@ -191,14 +191,14 @@ struct SuperPair : Pair, Pair { }; // CHECK-USRS: index-templates.cpp c:@CT>2#T#T@vector Extent=[8:1 - 11:2] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@201 Extent=[8:10 - 8:20] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@213 Extent=[8:22 - 8:51] -// CHECK-USRS: index-templates.cpp c:@CT>2#T#T@vector@F@clear# Extent=[10:8 - 10:15] +// CHECK-USRS: index-templates.cpp c:@CT>2#T#T@vector@F@clear# Extent=[10:3 - 10:15] // CHECK-USRS: index-templates.cpp c:@CP>1#T@vector>#*t0.0#>@CT>1#T@allocator1S0_ Extent=[13:1 - 14:21] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@289 Extent=[13:10 - 13:20] // CHECK-USRS: index-templates.cpp c:@S@Z1 Extent=[16:1 - 16:14] // CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z1#$@C@allocator>#S0_ Extent=[18:1 - 18:26] // CHECK-USRS: index-templates.cpp c:@S@Z2 Extent=[20:1 - 20:14] // CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z2#$@C@allocator>#S0_ Extent=[22:1 - 25:2] -// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z2#$@C@allocator>#S0_@F@clear# Extent=[24:8 - 24:15] +// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z2#$@C@allocator>#S0_@F@clear# Extent=[24:3 - 24:15] // CHECK-USRS: index-templates.cpp c:@ST>2#T#T@Y Extent=[27:1 - 31:2] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@443 Extent=[27:10 - 27:20] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@455 Extent=[27:22 - 27:32] diff --git a/test/Index/invalid-rdar-8236270.cpp b/test/Index/invalid-rdar-8236270.cpp index 6fd088dcc8..4593b512ee 100644 --- a/test/Index/invalid-rdar-8236270.cpp +++ b/test/Index/invalid-rdar-8236270.cpp @@ -6,6 +6,6 @@ struct abc *P; int main( // CHECK: StructDecl=abc:5:8 Extent=[5:1 - 5:11] -// CHECK: VarDecl=P:5:13 (Definition) Extent=[5:8 - 5:14] +// CHECK: VarDecl=P:5:13 (Definition) Extent=[5:1 - 5:14] // CHECK: VarDecl=main:6:5 (Definition) Extent=[6:1 - 6:9] diff --git a/test/Index/load-classes.cpp b/test/Index/load-classes.cpp index 349ebdecd7..58770191ea 100644 --- a/test/Index/load-classes.cpp +++ b/test/Index/load-classes.cpp @@ -17,12 +17,12 @@ X::X(int value) { // CHECK: load-classes.cpp:4:9: ParmDecl=value:4:9 (Definition) Extent=[4:5 - 4:14] // CHECK: load-classes.cpp:5:3: CXXConstructor=X:5:3 Extent=[5:3 - 5:16] // FIXME: missing TypeRef in the constructor name -// CHECK: load-classes.cpp:5:14: ParmDecl=x:5:14 (Definition) Extent=[5:11 - 5:15] +// CHECK: load-classes.cpp:5:14: ParmDecl=x:5:14 (Definition) Extent=[5:5 - 5:15] // CHECK: load-classes.cpp:5:11: TypeRef=struct X:3:8 Extent=[5:11 - 5:12] // CHECK: load-classes.cpp:6:3: CXXDestructor=~X:6:3 Extent=[6:3 - 6:7] // FIXME: missing TypeRef in the destructor name // CHECK: load-classes.cpp:7:3: CXXConversion=operator struct X *:7:3 Extent=[7:3 - 7:16] // CHECK: load-classes.cpp:7:12: TypeRef=struct X:3:8 Extent=[7:12 - 7:13] -// CHECK: load-classes.cpp:10:4: CXXConstructor=X:10:4 (Definition) Extent=[10:4 - 11:2] +// CHECK: load-classes.cpp:10:4: CXXConstructor=X:10:4 (Definition) Extent=[10:1 - 11:2] // CHECK: load-classes.cpp:10:1: TypeRef=struct X:3:8 Extent=[10:1 - 10:2] // CHECK: load-classes.cpp:10:10: ParmDecl=value:10:10 (Definition) Extent=[10:6 - 10:15] diff --git a/test/Index/load-exprs.c b/test/Index/load-exprs.c index 65c353a79c..62df2a7c5d 100644 --- a/test/Index/load-exprs.c +++ b/test/Index/load-exprs.c @@ -35,27 +35,27 @@ void test_members(int aval, int bval) { // CHECK: load-exprs.c:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:1 - 1:14] // CHECK: load-exprs.c:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23] -// CHECK: load-exprs.c:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:16 - 2:17] -// CHECK: load-exprs.c:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:19 - 2:20] -// CHECK: load-exprs.c:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:6 - 8:2] +// CHECK: load-exprs.c:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:12 - 2:17] +// CHECK: load-exprs.c:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:12 - 2:20] +// CHECK: load-exprs.c:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:1 - 8:2] // CHECK: load-exprs.c:3:14: ParmDecl=ptr:3:14 (Definition) Extent=[3:8 - 3:17] // CHECK: load-exprs.c:4:6: VarDecl=t_ptr:4:6 (Definition) Extent=[4:3 - 4:22] // CHECK: load-exprs.c:4:3: TypeRef=T:1:13 Extent=[4:3 - 4:4] // CHECK: load-exprs.c:4:15: TypeRef=T:1:13 Extent=[4:15 - 4:16] // CHECK: load-exprs.c:4:19: DeclRefExpr=ptr:3:14 Extent=[4:19 - 4:22] // CHECK: load-exprs.c:5:16: TypeRef=T:1:13 Extent=[5:16 - 5:17] -// CHECK: load-exprs.c:6:12: VarDecl=x:6:12 (Definition) Extent=[6:10 - 6:32] +// CHECK: load-exprs.c:6:12: VarDecl=x:6:12 (Definition) Extent=[6:3 - 6:32] // CHECK: load-exprs.c:6:10: TypeRef=struct X:2:8 Extent=[6:10 - 6:11] // CHECK: load-exprs.c:6:24: TypeRef=struct X:2:8 Extent=[6:24 - 6:25] // CHECK: load-exprs.c:7:9: VarDecl=xx:7:9 (Definition) Extent=[7:3 - 7:24] // CHECK: load-exprs.c:7:14: DeclRefExpr=ptr:3:14 Extent=[7:14 - 7:17] // CHECK: load-exprs.c:7:23: DeclRefExpr=x:6:12 Extent=[7:23 - 7:24] -// CHECK: load-exprs.c:10:5: FunctionDecl=test_blocks:10:5 (Definition) Extent=[10:5 - 21:2] +// CHECK: load-exprs.c:10:5: FunctionDecl=test_blocks:10:5 (Definition) Extent=[10:1 - 21:2] // CHECK: load-exprs.c:10:21: ParmDecl=x:10:21 (Definition) Extent=[10:17 - 10:22] -// CHECK: load-exprs.c:11:15: VarDecl=y:11:15 (Definition) Extent=[11:11 - 11:20] +// CHECK: load-exprs.c:11:15: VarDecl=y:11:15 (Definition) Extent=[11:3 - 11:20] // CHECK: load-exprs.c:11:19: DeclRefExpr=x:10:21 Extent=[11:19 - 11:20] // CHECK: load-exprs.c:12:3: CallExpr= Extent=[12:3 - 19:7] -// CHECK: load-exprs.c:13:17: VarDecl=z:13:17 (Definition) Extent=[13:13 - 13:22] +// CHECK: load-exprs.c:13:17: VarDecl=z:13:17 (Definition) Extent=[13:6 - 13:22] // CHECK: load-exprs.c:14:6: DeclRefExpr=y:11:15 Extent=[14:6 - 14:7] // CHECK: load-exprs.c:14:13: DeclRefExpr=z:13:17 Extent=[14:13 - 14:14] // CHECK: load-exprs.c:14:18: DeclRefExpr=x:10:21 Extent=[14:18 - 14:19] @@ -64,7 +64,7 @@ void test_members(int aval, int bval) { // CHECK: load-exprs.c:17:10: DeclRefExpr=y:11:15 Extent=[17:10 - 17:11] // CHECK: load-exprs.c:20:10: DeclRefExpr=y:11:15 Extent=[20:10 - 20:11] // CHECK: load-exprs.c:29:6: FunctionDecl=test_members:29:6 (Definition) -// CHECK: load-exprs.c:30:12: VarDecl=y0:30:12 (Definition) Extent=[30:10 - 30:77] +// CHECK: load-exprs.c:30:12: VarDecl=y0:30:12 (Definition) Extent=[30:3 - 30:77] // CHECK: load-exprs.c:30:10: TypeRef=struct Y:23:8 Extent=[30:10 - 30:11] // CHECK: load-exprs.c:30:20: MemberRef=array:24:12 Extent=[30:20 - 30:25] // CHECK: load-exprs.c:30:26: DeclRefExpr=StartIndex:27:8 Extent=[30:26 - 30:36] diff --git a/test/Index/load-namespaces.cpp b/test/Index/load-namespaces.cpp index 931a1dc79d..577941c3d1 100644 --- a/test/Index/load-namespaces.cpp +++ b/test/Index/load-namespaces.cpp @@ -29,9 +29,9 @@ namespace my_rel_ops = std::rel_ops; // RUN: c-index-test -test-load-source all %s | FileCheck %s // CHECK: load-namespaces.cpp:3:11: Namespace=std:3:11 (Definition) Extent=[3:11 - 7:2] // CHECK: load-namespaces.cpp:4:13: Namespace=rel_ops:4:13 (Definition) Extent=[4:13 - 6:4] -// CHECK: load-namespaces.cpp:5:10: FunctionDecl=f:5:10 Extent=[5:10 - 5:13] +// CHECK: load-namespaces.cpp:5:10: FunctionDecl=f:5:10 Extent=[5:5 - 5:13] // CHECK: load-namespaces.cpp:9:11: Namespace=std:9:11 (Definition) Extent=[9:11 - 11:2] -// CHECK: load-namespaces.cpp:10:8: FunctionDecl=g:10:8 Extent=[10:8 - 10:11] +// CHECK: load-namespaces.cpp:10:8: FunctionDecl=g:10:8 Extent=[10:3 - 10:11] // CHECK: load-namespaces.cpp:13:11: NamespaceAlias=std98:13:11 Extent=[13:1 - 13:22] // CHECK: load-namespaces.cpp:13:19: NamespaceRef=std:3:11 Extent=[13:19 - 13:22] // CHECK: load-namespaces.cpp:14:11: NamespaceAlias=std0x:14:11 Extent=[14:1 - 14:24] @@ -39,11 +39,11 @@ namespace my_rel_ops = std::rel_ops; // CHECK: load-namespaces.cpp:16:17: UsingDirective=:16:17 Extent=[16:1 - 16:22] // CHECK: load-namespaces.cpp:16:17: NamespaceRef=std0x:14:11 Extent=[16:17 - 16:22] // CHECK: load-namespaces.cpp:18:11: Namespace=std:18:11 (Definition) Extent=[18:11 - 20:2] -// CHECK: load-namespaces.cpp:19:7: FunctionDecl=g:19:7 Extent=[19:7 - 19:13] +// CHECK: load-namespaces.cpp:19:7: FunctionDecl=g:19:7 Extent=[19:3 - 19:13] // CHECK: load-namespaces.cpp:19:12: ParmDecl=:19:12 (Definition) Extent=[19:9 - 19:13] // CHECK: load-namespaces.cpp:22:12: UsingDeclaration=g[19:7, 10:8] Extent=[22:1 - 22:13] // CHECK: load-namespaces.cpp:22:7: NamespaceRef=std:18:11 Extent=[22:7 - 22:10] -// CHECK: load-namespaces.cpp:24:11: FunctionDecl=g:24:11 (Definition) Extent=[24:11 - 25:2] +// CHECK: load-namespaces.cpp:24:11: FunctionDecl=g:24:11 (Definition) Extent=[24:1 - 25:2] // CHECK: load-namespaces.cpp:24:6: NamespaceRef=std:18:11 Extent=[24:6 - 24:9] // CHECK: load-namespaces.cpp:27:11: NamespaceAlias=my_rel_ops:27:11 Extent=[27:1 - 27:36] // CHECK: load-namespaces.cpp:27:24: NamespaceRef=std:18:11 Extent=[27:24 - 27:27] diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp index 8dacc02984..cb9d3f2b60 100644 --- a/test/Index/load-stmts.cpp +++ b/test/Index/load-stmts.cpp @@ -120,9 +120,9 @@ void casts(int *ip) { // RUN: c-index-test -test-load-source all %s | FileCheck %s // CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:1 - 1:14] // CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23] -// CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:16 - 2:17] -// CHECK: load-stmts.cpp:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:19 - 2:20] -// CHECK: load-stmts.cpp:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:6 - 11:2] +// CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:12 - 2:17] +// CHECK: load-stmts.cpp:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:12 - 2:20] +// CHECK: load-stmts.cpp:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:1 - 11:2] // CHECK: load-stmts.cpp:3:12: ParmDecl=x:3:12 (Definition) Extent=[3:8 - 3:13] // CHECK: load-stmts.cpp:4:10: VarDecl=y:4:10 (Definition) Extent=[4:8 - 4:15] // CHECK: load-stmts.cpp:4:8: TypeRef=T:1:13 Extent=[4:8 - 4:9] @@ -152,13 +152,13 @@ void casts(int *ip) { // CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:15] // CHECK: load-stmts.cpp:9:8: UnexposedExpr= Extent=[9:8 - 9:10] // CHECK: load-stmts.cpp:14:7: ClassDecl=A:14:7 (Definition) Extent=[14:1 - 16:2] -// CHECK: load-stmts.cpp:15:8: CXXMethod=doA:15:8 Extent=[15:8 - 15:13] +// CHECK: load-stmts.cpp:15:8: CXXMethod=doA:15:8 Extent=[15:3 - 15:13] // CHECK: load-stmts.cpp:18:7: ClassDecl=B:18:7 (Definition) Extent=[18:1 - 20:2] -// CHECK: load-stmts.cpp:19:8: CXXMethod=doB:19:8 Extent=[19:8 - 19:13] +// CHECK: load-stmts.cpp:19:8: CXXMethod=doB:19:8 Extent=[19:3 - 19:13] // CHECK: load-stmts.cpp:22:7: ClassDecl=C:22:7 (Definition) Extent=[22:1 - 24:2] // CHECK: load-stmts.cpp:22:18: C++ base class specifier=class A:14:7 [access=public isVirtual=false] // CHECK: load-stmts.cpp:22:29: C++ base class specifier=class B:18:7 [access=private isVirtual=false] -// CHECK: load-stmts.cpp:23:8: CXXMethod=doC:23:8 Extent=[23:8 - 23:13] +// CHECK: load-stmts.cpp:23:8: CXXMethod=doC:23:8 Extent=[23:3 - 23:13] // CHECK: load-stmts.cpp:26:7: ClassDecl=D:26:7 (Definition) Extent=[26:1 - 26:49] // CHECK: load-stmts.cpp:26:26: C++ base class specifier=class C:22:7 [access=public isVirtual=true] // CHECK: load-stmts.cpp:26:45: C++ base class specifier=class A:14:7 [access=private isVirtual=true] diff --git a/test/Index/local-symbols.m b/test/Index/local-symbols.m index af3b601465..3a47952294 100644 --- a/test/Index/local-symbols.m +++ b/test/Index/local-symbols.m @@ -27,7 +27,7 @@ @end // CHECK: local-symbols.m:6:12: ObjCInterfaceDecl=Foo:6:12 Extent=[6:1 - 10:5] -// CHECK: local-symbols.m:7:6: ObjCIvarDecl=x:7:6 (Definition) Extent=[7:6 - 7:7] +// CHECK: local-symbols.m:7:6: ObjCIvarDecl=x:7:6 (Definition) Extent=[7:3 - 7:7] // CHECK: local-symbols.m:7:3: TypeRef=id:0:0 Extent=[7:3 - 7:5] // CHECK: local-symbols.m:9:1: ObjCInstanceMethodDecl=bar:9:1 Extent=[9:1 - 9:12] // CHECK: local-symbols.m:9:4: TypeRef=id:0:0 Extent=[9:4 - 9:6] diff --git a/test/Index/nested-binaryoperators.cpp b/test/Index/nested-binaryoperators.cpp index 14d5ec5394..db5efe2cc8 100644 --- a/test/Index/nested-binaryoperators.cpp +++ b/test/Index/nested-binaryoperators.cpp @@ -162,7 +162,7 @@ int foo(uint c) { // RUN: c-index-test -test-load-source all %s | FileCheck %s // CHECK: 1:22: TypedefDecl=uint:1:22 (Definition) Extent=[1:1 - 1:26] -// CHECK: 2:5: FunctionDecl=foo:2:5 (Definition) Extent=[2:5 - 161:2] +// CHECK: 2:5: FunctionDecl=foo:2:5 (Definition) Extent=[2:1 - 161:2] // CHECK: 2:14: ParmDecl=c:2:14 (Definition) Extent=[2:9 - 2:15] // CHECK: 2:9: TypeRef=uint:1:22 Extent=[2:9 - 2:13] // CHECK: 2:17: UnexposedStmt= Extent=[2:17 - 161:2] diff --git a/test/Index/overrides.cpp b/test/Index/overrides.cpp index 3dee607e43..ed24cc5cf5 100644 --- a/test/Index/overrides.cpp +++ b/test/Index/overrides.cpp @@ -16,5 +16,5 @@ struct D : C { }; // RUN: c-index-test -test-load-source local %s | FileCheck %s -// CHECK: overrides.cpp:11:16: CXXMethod=g:11:16 [Overrides @7:16] Extent=[11:16 - 11:19] -// CHECK: overrides.cpp:15:16: CXXMethod=f:15:16 [Overrides @2:16, @6:16] Extent=[15:16 - 15:22] +// CHECK: overrides.cpp:11:16: CXXMethod=g:11:16 [Overrides @7:16] Extent=[11:3 - 11:19] +// CHECK: overrides.cpp:15:16: CXXMethod=f:15:16 [Overrides @2:16, @6:16] Extent=[15:3 - 15:22] diff --git a/test/Index/preamble.c b/test/Index/preamble.c index fb784b389d..119bdb58e7 100644 --- a/test/Index/preamble.c +++ b/test/Index/preamble.c @@ -8,13 +8,13 @@ void f(int x) { // RUN: c-index-test -write-pch %t.pch -x c-header %S/Inputs/prefix.h // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -I %S/Inputs -include %t %s 2> %t.stderr.txt | FileCheck %s // RUN: FileCheck -check-prefix CHECK-DIAG %s < %t.stderr.txt -// CHECK: preamble.h:1:12: FunctionDecl=bar:1:12 (Definition) Extent=[1:12 - 6:2] +// CHECK: preamble.h:1:12: FunctionDecl=bar:1:12 (Definition) Extent=[1:1 - 6:2] // CHECK: preamble.h:4:3: UnexposedExpr= Extent=[4:3 - 4:13] // CHECK: preamble.h:4:3: DeclRefExpr=ptr:2:8 Extent=[4:3 - 4:6] // CHECK: preamble.h:4:9: UnexposedExpr=ptr1:3:10 Extent=[4:9 - 4:13] // CHECK: preamble.h:4:9: DeclRefExpr=ptr1:3:10 Extent=[4:9 - 4:13] // CHECK: preamble.h:5:10: UnexposedExpr= Extent=[5:10 - 5:11] -// CHECK: preamble.c:3:5: FunctionDecl=wibble:3:5 Extent=[3:5 - 3:16] +// CHECK: preamble.c:3:5: FunctionDecl=wibble:3:5 Extent=[3:1 - 3:16] // CHECK: preamble.c:3:15: ParmDecl=:3:15 (Definition) Extent=[3:12 - 3:16] // CHECK-DIAG: preamble.h:4:7:{4:9-4:13}: warning: incompatible pointer types assigning to 'int *' from 'float *' // RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:6:1 -I %S/Inputs -include %t %s 2> %t.stderr.txt | FileCheck -check-prefix CHECK-CC %s diff --git a/test/Index/recursive-cxx-member-calls.cpp b/test/Index/recursive-cxx-member-calls.cpp index 1fc1acb035..0f39c7472b 100644 --- a/test/Index/recursive-cxx-member-calls.cpp +++ b/test/Index/recursive-cxx-member-calls.cpp @@ -823,7 +823,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK-tokens: Punctuation: ";" [85:18 - 85:19] ClassTemplate=StringSwitch:83:47 (Definition) // CHECK-tokens: Keyword: "public" [86:1 - 86:7] UnexposedDecl=:86:1 (Definition) // CHECK-tokens: Punctuation: ":" [86:7 - 86:8] UnexposedDecl=:86:1 (Definition) -// CHECK-tokens: Keyword: "explicit" [87:3 - 87:11] ClassTemplate=StringSwitch:83:47 (Definition) +// CHECK-tokens: Keyword: "explicit" [87:3 - 87:11] CXXConstructor=StringSwitch:87:12 (Definition) // CHECK-tokens: Identifier: "StringSwitch" [87:12 - 87:24] CXXConstructor=StringSwitch:87:12 (Definition) // CHECK-tokens: Punctuation: "(" [87:24 - 87:25] CXXConstructor=StringSwitch:87:12 (Definition) // CHECK-tokens: Identifier: "StringRef" [87:25 - 87:34] TypeRef=class llvm::StringRef:38:7 @@ -1531,16 +1531,16 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 4:44: ClassTemplate=pair:4:44 (Definition) Extent=[4:3 - 4:64] // CHECK: 4:20: TemplateTypeParameter=_T1:4:20 (Definition) Extent=[4:14 - 4:23] // CHECK: 4:31: TemplateTypeParameter=_T2:4:31 (Definition) Extent=[4:25 - 4:34] -// CHECK: 4:55: FieldDecl=second:4:55 (Definition) Extent=[4:55 - 4:61] +// CHECK: 4:55: FieldDecl=second:4:55 (Definition) Extent=[4:51 - 4:61] // CHECK: 6:8: UnexposedDecl=:6:8 (Definition) Extent=[6:8 - 9:2] -// CHECK: 7:7: FunctionDecl=memcmp:7:7 Extent=[7:7 - 7:49] -// CHECK: 7:26: ParmDecl=:7:26 (Definition) Extent=[7:20 - 7:27] -// CHECK: 7:40: ParmDecl=:7:40 (Definition) Extent=[7:34 - 7:41] +// CHECK: 7:7: FunctionDecl=memcmp:7:7 Extent=[7:3 - 7:49] +// CHECK: 7:26: ParmDecl=:7:26 (Definition) Extent=[7:14 - 7:27] +// CHECK: 7:40: ParmDecl=:7:40 (Definition) Extent=[7:28 - 7:41] // CHECK: 7:48: ParmDecl=:7:48 (Definition) Extent=[7:42 - 7:49] // CHECK: 7:42: TypeRef=size_t:2:25 Extent=[7:42 - 7:48] -// CHECK: 8:10: FunctionDecl=strlen:8:10 Extent=[8:10 - 8:30] +// CHECK: 8:10: FunctionDecl=strlen:8:10 Extent=[8:3 - 8:30] // CHECK: 8:3: TypeRef=size_t:2:25 Extent=[8:3 - 8:9] -// CHECK: 8:29: ParmDecl=:8:29 (Definition) Extent=[8:23 - 8:30] +// CHECK: 8:29: ParmDecl=:8:29 (Definition) Extent=[8:17 - 8:30] // CHECK: 10:17: Namespace=clang:10:17 (Definition) Extent=[10:17 - 35:2] // CHECK: 11:9: ClassDecl=IdentifierInfo:11:9 Extent=[11:3 - 11:23] // CHECK: 12:9: ClassDecl=AttributeList:12:9 (Definition) Extent=[12:3 - 34:4] @@ -1616,18 +1616,18 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 30:40: EnumConstantDecl=AT_init_priority:30:40 (Definition) Extent=[30:40 - 30:56] // CHECK: 31:7: EnumConstantDecl=IgnoredAttribute:31:7 (Definition) Extent=[31:7 - 31:23] // CHECK: 31:25: EnumConstantDecl=UnknownAttribute:31:25 (Definition) Extent=[31:25 - 31:41] -// CHECK: 33:17: CXXMethod=getKind:33:17 Extent=[33:17 - 33:53] +// CHECK: 33:17: CXXMethod=getKind:33:17 Extent=[33:5 - 33:53] // CHECK: 33:12: TypeRef=enum clang::AttributeList::Kind:13:10 Extent=[33:12 - 33:16] -// CHECK: 33:48: ParmDecl=Name:33:48 (Definition) Extent=[33:31 - 33:52] +// CHECK: 33:48: ParmDecl=Name:33:48 (Definition) Extent=[33:25 - 33:52] // CHECK: 33:31: TypeRef=class clang::IdentifierInfo:66:7 Extent=[33:31 - 33:45] -// CHECK: 36:8: FunctionDecl=magic_length:36:8 Extent=[36:8 - 36:35] +// CHECK: 36:8: FunctionDecl=magic_length:36:8 Extent=[36:1 - 36:35] // CHECK: 36:1: TypeRef=size_t:2:25 Extent=[36:1 - 36:7] -// CHECK: 36:33: ParmDecl=s:36:33 (Definition) Extent=[36:27 - 36:34] +// CHECK: 36:33: ParmDecl=s:36:33 (Definition) Extent=[36:21 - 36:34] // CHECK: 37:11: Namespace=llvm:37:11 (Definition) Extent=[37:11 - 64:2] // CHECK: 38:7: ClassDecl=StringRef:38:7 (Definition) Extent=[38:1 - 63:2] // CHECK: 39:1: UnexposedDecl=:39:1 (Definition) Extent=[39:1 - 39:8] // CHECK: 40:23: TypedefDecl=iterator:40:23 (Definition) Extent=[40:3 - 40:31] -// CHECK: 41:23: VarDecl=npos:41:23 Extent=[41:16 - 41:40] +// CHECK: 41:23: VarDecl=npos:41:23 Extent=[41:3 - 41:40] // CHECK: 41:16: TypeRef=size_t:2:25 Extent=[41:16 - 41:22] // CHECK: 41:30: UnexposedExpr= Extent=[41:30 - 41:40] // CHECK: 41:31: UnexposedExpr= Extent=[41:31 - 41:40] @@ -1635,10 +1635,10 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 41:38: UnexposedExpr= Extent=[41:38 - 41:39] // CHECK: 41:38: UnexposedExpr= Extent=[41:38 - 41:39] // CHECK: 42:1: UnexposedDecl=:42:1 (Definition) Extent=[42:1 - 42:9] -// CHECK: 43:15: FieldDecl=Data:43:15 (Definition) Extent=[43:15 - 43:19] -// CHECK: 44:10: FieldDecl=Length:44:10 (Definition) Extent=[44:10 - 44:16] +// CHECK: 43:15: FieldDecl=Data:43:15 (Definition) Extent=[43:3 - 43:19] +// CHECK: 44:10: FieldDecl=Length:44:10 (Definition) Extent=[44:3 - 44:16] // CHECK: 44:3: TypeRef=size_t:2:25 Extent=[44:3 - 44:9] -// CHECK: 45:17: CXXMethod=min:45:17 (Definition) Extent=[45:17 - 45:66] +// CHECK: 45:17: CXXMethod=min:45:17 (Definition) Extent=[45:3 - 45:66] // CHECK: 45:10: TypeRef=size_t:2:25 Extent=[45:10 - 45:16] // CHECK: 45:28: ParmDecl=a:45:28 (Definition) Extent=[45:21 - 45:29] // CHECK: 45:21: TypeRef=size_t:2:25 Extent=[45:21 - 45:27] @@ -1662,7 +1662,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 47:32: UnexposedExpr= Extent=[47:32 - 47:33] // CHECK: 47:35: UnexposedStmt= Extent=[47:35 - 47:37] // CHECK: 48:3: CXXConstructor=StringRef:48:3 (Definition) Extent=[48:3 - 48:71] -// CHECK: 48:25: ParmDecl=Str:48:25 (Definition) Extent=[48:19 - 48:28] +// CHECK: 48:25: ParmDecl=Str:48:25 (Definition) Extent=[48:13 - 48:28] // CHECK: 48:32: MemberRef=Data:43:15 Extent=[48:32 - 48:36] // CHECK: 48:37: DeclRefExpr=Str:48:25 Extent=[48:37 - 48:40] // CHECK: 48:43: MemberRef=Length:44:10 Extent=[48:43 - 48:49] @@ -1672,7 +1672,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 48:63: DeclRefExpr=Str:48:25 Extent=[48:63 - 48:66] // CHECK: 48:69: UnexposedStmt= Extent=[48:69 - 48:71] // CHECK: 49:3: CXXConstructor=StringRef:49:3 (Definition) Extent=[49:3 - 49:77] -// CHECK: 49:25: ParmDecl=data:49:25 (Definition) Extent=[49:19 - 49:29] +// CHECK: 49:25: ParmDecl=data:49:25 (Definition) Extent=[49:13 - 49:29] // CHECK: 49:38: ParmDecl=length:49:38 (Definition) Extent=[49:31 - 49:44] // CHECK: 49:31: TypeRef=size_t:2:25 Extent=[49:31 - 49:37] // CHECK: 49:48: MemberRef=Data:43:15 Extent=[49:48 - 49:52] @@ -1680,17 +1680,17 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 49:60: MemberRef=Length:44:10 Extent=[49:60 - 49:66] // CHECK: 49:67: DeclRefExpr=length:49:38 Extent=[49:67 - 49:73] // CHECK: 49:75: UnexposedStmt= Extent=[49:75 - 49:77] -// CHECK: 50:12: CXXMethod=end:50:12 (Definition) Extent=[50:12 - 50:40] +// CHECK: 50:12: CXXMethod=end:50:12 (Definition) Extent=[50:3 - 50:40] // CHECK: 50:3: TypeRef=iterator:40:23 Extent=[50:3 - 50:11] // CHECK: 50:24: UnexposedStmt= Extent=[50:24 - 50:40] // CHECK: 50:26: UnexposedStmt= Extent=[50:26 - 50:37] // CHECK: 50:33: MemberRefExpr=Data:43:15 Extent=[50:33 - 50:37] -// CHECK: 51:10: CXXMethod=size:51:10 (Definition) Extent=[51:10 - 51:41] +// CHECK: 51:10: CXXMethod=size:51:10 (Definition) Extent=[51:3 - 51:41] // CHECK: 51:3: TypeRef=size_t:2:25 Extent=[51:3 - 51:9] // CHECK: 51:23: UnexposedStmt= Extent=[51:23 - 51:41] // CHECK: 51:25: UnexposedStmt= Extent=[51:25 - 51:38] // CHECK: 51:32: MemberRefExpr=Length:44:10 Extent=[51:32 - 51:38] -// CHECK: 52:8: CXXMethod=startswith:52:8 (Definition) Extent=[52:8 - 55:4] +// CHECK: 52:8: CXXMethod=startswith:52:8 (Definition) Extent=[52:3 - 55:4] // CHECK: 52:29: ParmDecl=Prefix:52:29 (Definition) Extent=[52:19 - 52:35] // CHECK: 52:19: TypeRef=class llvm::StringRef:38:7 Extent=[52:19 - 52:28] // CHECK: 52:43: UnexposedStmt= Extent=[52:43 - 55:4] @@ -1713,7 +1713,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 54:44: MemberRefExpr=Length:44:10 Extent=[54:37 - 54:50] // CHECK: 54:37: DeclRefExpr=Prefix:52:29 Extent=[54:37 - 54:43] // CHECK: 54:55: UnexposedExpr= Extent=[54:55 - 54:56] -// CHECK: 56:8: CXXMethod=endswith:56:8 (Definition) Extent=[56:8 - 59:4] +// CHECK: 56:8: CXXMethod=endswith:56:8 (Definition) Extent=[56:3 - 59:4] // CHECK: 56:27: ParmDecl=Suffix:56:27 (Definition) Extent=[56:17 - 56:33] // CHECK: 56:17: TypeRef=class llvm::StringRef:38:7 Extent=[56:17 - 56:26] // CHECK: 56:41: UnexposedStmt= Extent=[56:41 - 59:4] @@ -1740,7 +1740,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 58:57: MemberRefExpr=Length:44:10 Extent=[58:50 - 58:63] // CHECK: 58:50: DeclRefExpr=Suffix:56:27 Extent=[58:50 - 58:56] // CHECK: 58:68: UnexposedExpr= Extent=[58:68 - 58:69] -// CHECK: 60:13: CXXMethod=substr:60:13 (Definition) Extent=[60:13 - 62:4] +// CHECK: 60:13: CXXMethod=substr:60:13 (Definition) Extent=[60:3 - 62:4] // CHECK: 60:3: TypeRef=class llvm::StringRef:38:7 Extent=[60:3 - 60:12] // CHECK: 60:27: ParmDecl=Start:60:27 (Definition) Extent=[60:20 - 60:32] // CHECK: 60:20: TypeRef=size_t:2:25 Extent=[60:20 - 60:26] @@ -1769,7 +1769,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 66:7: ClassDecl=IdentifierInfo:66:7 (Definition) Extent=[66:1 - 80:2] // CHECK: 67:1: UnexposedDecl=:67:1 (Definition) Extent=[67:1 - 67:8] // CHECK: 67:8: CXXConstructor=IdentifierInfo:67:8 Extent=[67:8 - 67:24] -// CHECK: 68:15: CXXMethod=getNameStart:68:15 (Definition) Extent=[68:15 - 71:4] +// CHECK: 68:15: CXXMethod=getNameStart:68:15 (Definition) Extent=[68:3 - 71:4] // CHECK: 68:36: UnexposedStmt= Extent=[68:36 - 71:4] // CHECK: 69:5: UnexposedStmt= Extent=[69:5 - 69:65] // CHECK: 69:54: TypedefDecl=actualtype:69:54 (Definition) Extent=[69:5 - 69:64] @@ -1781,14 +1781,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 70:13: UnexposedExpr= Extent=[70:13 - 70:38] // CHECK: 70:20: TypeRef=actualtype:69:54 Extent=[70:20 - 70:30] // CHECK: 70:34: UnexposedExpr= Extent=[70:34 - 70:38] -// CHECK: 72:12: CXXMethod=getLength:72:12 (Definition) Extent=[72:12 - 76:4] +// CHECK: 72:12: CXXMethod=getLength:72:12 (Definition) Extent=[72:3 - 76:4] // CHECK: 72:30: UnexposedStmt= Extent=[72:30 - 76:4] // CHECK: 73:5: UnexposedStmt= Extent=[73:5 - 73:65] // CHECK: 73:54: TypedefDecl=actualtype:73:54 (Definition) Extent=[73:5 - 73:64] // CHECK: 73:18: TemplateRef=pair:4:44 Extent=[73:18 - 73:22] // CHECK: 73:25: TypeRef=class clang::IdentifierInfo:66:7 Extent=[73:25 - 73:39] // CHECK: 74:5: UnexposedStmt= Extent=[74:5 - 74:61] -// CHECK: 74:17: VarDecl=p:74:17 (Definition) Extent=[74:11 - 74:60] +// CHECK: 74:17: VarDecl=p:74:17 (Definition) Extent=[74:5 - 74:60] // CHECK: 74:21: UnexposedExpr= Extent=[74:21 - 74:60] // CHECK: 74:21: UnexposedExpr=second:4:55 Extent=[74:21 - 74:56] // CHECK: 74:50: MemberRefExpr=second:4:55 Extent=[74:21 - 74:56] @@ -1820,7 +1820,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 75:55: UnexposedExpr= Extent=[75:55 - 75:56] // CHECK: 75:61: UnexposedExpr= Extent=[75:61 - 75:62] // CHECK: 75:61: UnexposedExpr= Extent=[75:61 - 75:62] -// CHECK: 77:19: CXXMethod=getName:77:19 (Definition) Extent=[77:19 - 79:4] +// CHECK: 77:19: CXXMethod=getName:77:19 (Definition) Extent=[77:3 - 79:4] // CHECK: 77:35: UnexposedStmt= Extent=[77:35 - 79:4] // CHECK: 78:5: UnexposedStmt= Extent=[78:5 - 78:56] // CHECK: 78:12: CallExpr= Extent=[78:12 - 78:56] @@ -1835,11 +1835,11 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 83:47: ClassTemplate=StringSwitch:83:47 (Definition) Extent=[83:1 - 95:2] // CHECK: 83:21: TemplateTypeParameter=T:83:21 (Definition) Extent=[83:12 - 83:22] // CHECK: 83:33: TemplateTypeParameter=R:83:33 (Definition) Extent=[83:24 - 83:38] -// CHECK: 84:13: FieldDecl=Str:84:13 (Definition) Extent=[84:13 - 84:16] +// CHECK: 84:13: FieldDecl=Str:84:13 (Definition) Extent=[84:3 - 84:16] // CHECK: 84:3: TypeRef=class llvm::StringRef:38:7 Extent=[84:3 - 84:12] -// CHECK: 85:12: FieldDecl=Result:85:12 (Definition) Extent=[85:12 - 85:18] +// CHECK: 85:12: FieldDecl=Result:85:12 (Definition) Extent=[85:3 - 85:18] // CHECK: 86:1: UnexposedDecl=:86:1 (Definition) Extent=[86:1 - 86:8] -// CHECK: 87:12: CXXConstructor=StringSwitch:87:12 (Definition) Extent=[87:12 - 87:64] +// CHECK: 87:12: CXXConstructor=StringSwitch:87:12 (Definition) Extent=[87:3 - 87:64] // CHECK: 87:35: ParmDecl=Str:87:35 (Definition) Extent=[87:25 - 87:38] // CHECK: 87:25: TypeRef=class llvm::StringRef:38:7 Extent=[87:25 - 87:34] // CHECK: 87:42: MemberRef=Str:84:13 Extent=[87:42 - 87:45] @@ -1851,23 +1851,23 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // CHECK: 87:62: UnexposedStmt= Extent=[87:62 - 87:64] // CHECK: 88:42: FunctionTemplate=Case:88:42 (Definition) Extent=[88:3 - 91:4] // CHECK: 88:23: NonTypeTemplateParameter=N:88:23 (Definition) Extent=[88:14 - 88:24] -// CHECK: 88:60: ParmDecl=S:88:60 (Definition) Extent=[88:53 - 88:61] +// CHECK: 88:60: ParmDecl=S:88:60 (Definition) Extent=[88:47 - 88:61] // CHECK: 88:63: DeclRefExpr=N:88:23 Extent=[88:63 - 88:64] -// CHECK: 89:57: ParmDecl=Value:89:57 (Definition) Extent=[89:53 - 89:62] +// CHECK: 89:57: ParmDecl=Value:89:57 (Definition) Extent=[89:47 - 89:62] // CHECK: 89:64: UnexposedStmt= Extent=[89:64 - 91:4] // CHECK: 90:5: UnexposedStmt= Extent=[90:5 - 90:17] // CHECK: 90:12: UnexposedExpr= Extent=[90:12 - 90:17] // CHECK: 90:13: UnexposedExpr= Extent=[90:13 - 90:17] -// CHECK: 92:5: CXXMethod=Default:92:5 (Definition) Extent=[92:5 - 94:4] -// CHECK: 92:23: ParmDecl=Value:92:23 (Definition) Extent=[92:19 - 92:28] +// CHECK: 92:5: CXXMethod=Default:92:5 (Definition) Extent=[92:3 - 94:4] +// CHECK: 92:23: ParmDecl=Value:92:23 (Definition) Extent=[92:13 - 92:28] // CHECK: 92:36: UnexposedStmt= Extent=[92:36 - 94:4] // CHECK: 93:5: UnexposedStmt= Extent=[93:5 - 93:17] // CHECK: 93:12: DeclRefExpr=Value:92:23 Extent=[93:12 - 93:17] // CHECK: 98:17: UsingDirective=:98:17 Extent=[98:1 - 98:22] // CHECK: 98:17: NamespaceRef=clang:10:17 Extent=[98:17 - 98:22] -// CHECK: 100:36: CXXMethod=getKind:100:36 (Definition) Extent=[100:36 - 186:2] +// CHECK: 100:36: CXXMethod=getKind:100:36 (Definition) Extent=[100:1 - 186:2] // CHECK: 100:21: TypeRef=class clang::AttributeList:12:9 Extent=[100:21 - 100:34] -// CHECK: 100:67: ParmDecl=Name:100:67 (Definition) Extent=[100:50 - 100:71] +// CHECK: 100:67: ParmDecl=Name:100:67 (Definition) Extent=[100:44 - 100:71] // CHECK: 100:50: TypeRef=class clang::IdentifierInfo:66:7 Extent=[100:50 - 100:64] // CHECK: 100:73: UnexposedStmt= Extent=[100:73 - 186:2] // CHECK: 101:3: UnexposedStmt= Extent=[101:3 - 101:46] diff --git a/test/Index/recursive-member-access.c b/test/Index/recursive-member-access.c index c76fa0e504..6e95efe9b2 100644 --- a/test/Index/recursive-member-access.c +++ b/test/Index/recursive-member-access.c @@ -125,11 +125,11 @@ int test_rdar8650865(struct rdar8650865 *s) { // RUN: c-index-test -test-load-source all %s | FileCheck %s // CHECK: 1:8: StructDecl=rdar8650865:1:8 (Definition) Extent=[1:1 - 4:2] -// CHECK: 2:23: FieldDecl=first:2:23 (Definition) Extent=[2:23 - 2:28] +// CHECK: 2:23: FieldDecl=first:2:23 (Definition) Extent=[2:3 - 2:28] // CHECK: 2:10: TypeRef=struct rdar8650865:1:8 Extent=[2:10 - 2:21] -// CHECK: 3:7: FieldDecl=x:3:7 (Definition) Extent=[3:7 - 3:8] -// CHECK: 6:5: FunctionDecl=test_rdar8650865:6:5 (Definition) Extent=[6:5 - 124:2] -// CHECK: 6:42: ParmDecl=s:6:42 (Definition) Extent=[6:29 - 6:43] +// CHECK: 3:7: FieldDecl=x:3:7 (Definition) Extent=[3:3 - 3:8] +// CHECK: 6:5: FunctionDecl=test_rdar8650865:6:5 (Definition) Extent=[6:1 - 124:2] +// CHECK: 6:42: ParmDecl=s:6:42 (Definition) Extent=[6:22 - 6:43] // CHECK: 6:29: TypeRef=struct rdar8650865:1:8 Extent=[6:29 - 6:40] // CHECK: 6:45: UnexposedStmt= Extent=[6:45 - 124:2] // CHECK: 7:3: UnexposedStmt= Extent=[7:3 - 123:8] diff --git a/test/Index/remap-load.c b/test/Index/remap-load.c index d54c3a1076..5a8f46b7f3 100644 --- a/test/Index/remap-load.c +++ b/test/Index/remap-load.c @@ -1,6 +1,6 @@ // RUN: c-index-test -test-load-source all -remap-file="%s;%S/Inputs/remap-load-to.c" %s | FileCheck -check-prefix=CHECK %s -// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:5 - 3:2] +// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:1 - 3:2] // CHECK: remap-load.c:1:13: ParmDecl=parm1:1:13 (Definition) Extent=[1:9 - 1:18] // CHECK: remap-load.c:1:26: ParmDecl=parm2:1:26 (Definition) Extent=[1:20 - 1:31] // CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23] diff --git a/test/Index/usrs-cxx0x.cpp b/test/Index/usrs-cxx0x.cpp index a0ea6ba69c..50aee09688 100644 --- a/test/Index/usrs-cxx0x.cpp +++ b/test/Index/usrs-cxx0x.cpp @@ -5,4 +5,4 @@ void f(tuple); // RUN: c-index-test -test-load-source-usrs all -std=c++0x %s | FileCheck %s // CHECK: usrs-cxx0x.cpp c:@ST>1#pT@tuple Extent=[1:1 - 2:17] -// CHECK: usrs-cxx0x.cpp c:@F@f#$@S@tuple>#p3Ifd# Extent=[4:6 - 4:34] +// CHECK: usrs-cxx0x.cpp c:@F@f#$@S@tuple>#p3Ifd# Extent=[4:1 - 4:34] diff --git a/test/Index/usrs.cpp b/test/Index/usrs.cpp index 6fff81706e..868bc1bb3b 100644 --- a/test/Index/usrs.cpp +++ b/test/Index/usrs.cpp @@ -68,16 +68,16 @@ namespace foo_alias3 = foo; // RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s // CHECK: usrs.cpp c:@N@foo Extent=[1:11 - 4:2] // CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8] -// CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:8 - 3:18] +// CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:3 - 3:18] // CHECK: usrs.cpp c:usrs.cpp@36@N@foo@F@bar#I#@z Extent=[3:12 - 3:17] // CHECK: usrs.cpp c:@N@bar Extent=[5:11 - 8:2] // CHECK: usrs.cpp c:usrs.cpp@64@N@bar@T@QType Extent=[6:3 - 6:20] -// CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:8 - 7:20] +// CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:3 - 7:20] // CHECK: usrs.cpp c:usrs.cpp@94@N@bar@F@bar#I#@z Extent=[7:12 - 7:19] // CHECK: usrs.cpp c:@C@ClsA Extent=[10:1 - 14:2] // CHECK: usrs.cpp c: Extent=[11:1 - 11:8] -// CHECK: usrs.cpp c:@C@ClsA@FI@a Extent=[12:7 - 12:8] -// CHECK: usrs.cpp c:@C@ClsA@FI@b Extent=[12:10 - 12:11] +// CHECK: usrs.cpp c:@C@ClsA@FI@a Extent=[12:3 - 12:8] +// CHECK: usrs.cpp c:@C@ClsA@FI@b Extent=[12:3 - 12:11] // CHECK: usrs.cpp c:@C@ClsA@F@ClsA#I#I# Extent=[13:3 - 13:37] // CHECK: usrs.cpp c:usrs.cpp@147@C@ClsA@F@ClsA#I#I#@A Extent=[13:8 - 13:13] // CHECK: usrs.cpp c:usrs.cpp@154@C@ClsA@F@ClsA#I#I#@B Extent=[13:15 - 13:20] @@ -85,36 +85,36 @@ namespace foo_alias3 = foo; // CHECK: usrs.cpp c:@N@foo@C@ClsB Extent=[17:3 - 21:4] // CHECK: usrs.cpp c: Extent=[18:3 - 18:10] // CHECK: usrs.cpp c:@N@foo@C@ClsB@F@ClsB# Extent=[19:5 - 19:27] -// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:9 - 20:17] -// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:16 - 26:2] +// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:5 - 20:17] +// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:1 - 26:2] // CHECK: usrs.cpp c:@aN@C@ClsC Extent=[29:3 - 29:35] // CHECK: usrs.cpp c:@aN@w Extent=[30:3 - 30:8] // CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6] // CHECK: usrs.cpp c:@N@foo Extent=[35:11 - 40:2] // CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:27 - 39:2] // CHECK: usrs.cpp c:@N@foo@N@taz@x Extent=[36:3 - 36:8] -// CHECK: usrs.cpp c:usrs.cpp@475@N@foo@N@taz@F@add#I#I# Extent=[37:21 - 37:56] +// CHECK: usrs.cpp c:usrs.cpp@457@N@foo@N@taz@F@add#I#I# Extent=[37:3 - 37:56] // CHECK: usrs.cpp c:usrs.cpp@479@N@foo@N@taz@F@add#I#I#@a Extent=[37:25 - 37:30] // CHECK: usrs.cpp c:usrs.cpp@486@N@foo@N@taz@F@add#I#I#@b Extent=[37:32 - 37:37] -// CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:8 - 38:25] +// CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:3 - 38:25] // CHECK: usrs.cpp c:usrs.cpp@522@N@foo@N@taz@F@sub#I#I#@a Extent=[38:12 - 38:17] // CHECK: usrs.cpp c:usrs.cpp@529@N@foo@N@taz@F@sub#I#I#@b Extent=[38:19 - 38:24] // CHECK: usrs.cpp c:@N@foo Extent=[42:11 - 52:3] // CHECK: usrs.cpp c:@N@foo@N@taz Extent=[42:27 - 52:2] // CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD Extent=[43:3 - 51:4] // CHECK: usrs.cpp c: Extent=[44:3 - 44:10] -// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#I# Extent=[45:11 - 45:52] +// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#I# Extent=[45:5 - 45:52] // CHECK: usrs.cpp c:usrs.cpp@638@N@foo@N@taz@C@ClsD@F@operator=#I#@x Extent=[45:21 - 45:26] -// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#d# Extent=[46:11 - 46:61] +// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#d# Extent=[46:5 - 46:61] // CHECK: usrs.cpp c:usrs.cpp@690@N@foo@N@taz@C@ClsD@F@operator=#d#@x Extent=[46:21 - 46:29] -// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD# Extent=[47:11 - 47:62] -// CHECK: usrs.cpp c:usrs.cpp@757@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD#@x Extent=[47:27 - 47:34] -// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@qux#S Extent=[48:16 - 48:21] -// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@uz#I.#S Extent=[49:16 - 49:30] +// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD# Extent=[47:5 - 47:62] +// CHECK: usrs.cpp c:usrs.cpp@751@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD#@x Extent=[47:21 - 47:34] +// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@qux#S Extent=[48:5 - 48:21] +// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@uz#I.#S Extent=[49:5 - 49:30] // CHECK: usrs.cpp c:usrs.cpp@833@N@foo@N@taz@C@ClsD@F@uz#I.#S@z Extent=[49:19 - 49:24] -// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1 Extent=[50:10 - 50:62] -// CHECK: usrs.cpp c:usrs.cpp@872@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1@x Extent=[50:27 - 50:34] -// CHECK: usrs.cpp c:@F@rez Extent=[55:8 - 55:25] +// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1 Extent=[50:5 - 50:62] +// CHECK: usrs.cpp c:usrs.cpp@866@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1@x Extent=[50:21 - 50:34] +// CHECK: usrs.cpp c:@F@rez Extent=[55:3 - 55:25] // CHECK: usrs.cpp c:usrs.cpp@941@F@rez@a Extent=[55:12 - 55:17] // CHECK: usrs.cpp c:usrs.cpp@948@F@rez@b Extent=[55:19 - 55:24] // CHECK: usrs.cpp c:@NA@foo_alias diff --git a/test/Index/usrs.m b/test/Index/usrs.m index 84321a16e1..4b79fdcbba 100644 --- a/test/Index/usrs.m +++ b/test/Index/usrs.m @@ -80,7 +80,7 @@ int test_multi_declaration(void) { - (void)method; @end -// CHECK: usrs.m c:usrs.m@85@F@my_helper Extent=[3:19 - 3:60] +// CHECK: usrs.m c:usrs.m@67@F@my_helper Extent=[3:1 - 3:60] // CHECK: usrs.m c:usrs.m@95@F@my_helper@x Extent=[3:29 - 3:34] // CHECK: usrs.m c:usrs.m@102@F@my_helper@y Extent=[3:36 - 3:41] // CHECK: usrs.m c:usrs.m@128@Ea Extent=[5:1 - 8:2] @@ -90,15 +90,15 @@ int test_multi_declaration(void) { // CHECK: usrs.m c:usrs.m@155@Ea@FOO Extent=[11:3 - 11:6] // CHECK: usrs.m c:usrs.m@155@Ea@BAR Extent=[12:3 - 12:6] // CHECK: usrs.m c:@SA@MyStruct Extent=[15:9 - 18:2] -// CHECK: usrs.m c:@SA@MyStruct@FI@wa Extent=[16:7 - 16:9] -// CHECK: usrs.m c:@SA@MyStruct@FI@moo Extent=[17:7 - 17:10] +// CHECK: usrs.m c:@SA@MyStruct@FI@wa Extent=[16:3 - 16:9] +// CHECK: usrs.m c:@SA@MyStruct@FI@moo Extent=[17:3 - 17:10] // CHECK: usrs.m c:usrs.m@179@T@MyStruct Extent=[15:1 - 18:11] // CHECK: usrs.m c:@E@Pizza Extent=[20:1 - 23:2] // CHECK: usrs.m c:@E@Pizza@CHEESE Extent=[21:3 - 21:9] // CHECK: usrs.m c:@E@Pizza@MUSHROOMS Extent=[22:3 - 22:12] // CHECK: usrs.m c:objc(cs)Foo Extent=[25:1 - 32:5] -// CHECK: usrs.m c:objc(cs)Foo@x Extent=[26:6 - 26:7] -// CHECK: usrs.m c:objc(cs)Foo@y Extent=[27:6 - 27:7] +// CHECK: usrs.m c:objc(cs)Foo@x Extent=[26:3 - 26:7] +// CHECK: usrs.m c:objc(cs)Foo@y Extent=[27:3 - 27:7] // CHECK: usrs.m c:objc(cs)Foo(im)godzilla Extent=[29:1 - 29:17] // CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[30:1 - 30:17] // CHECK: usrs.m c:objc(cs)Foo(py)d1 Extent=[31:1 - 31:17] @@ -107,14 +107,14 @@ int test_multi_declaration(void) { // CHECK: usrs.m c:usrs.m@352objc(cs)Foo(im)setD1:@d1 Extent=[31:15 - 31:17] // CHECK: usrs.m c:objc(cs)Foo Extent=[34:1 - 45:2] // CHECK: usrs.m c:objc(cs)Foo(im)godzilla Extent=[35:1 - 39:2] -// CHECK: usrs.m c:usrs.m@409objc(cs)Foo(im)godzilla@a Extent=[36:10 - 36:19] -// CHECK: usrs.m c:objc(cs)Foo(im)godzilla@z Extent=[37:10 - 37:15] +// CHECK: usrs.m c:usrs.m@402objc(cs)Foo(im)godzilla@a Extent=[36:3 - 36:19] +// CHECK: usrs.m c:objc(cs)Foo(im)godzilla@z Extent=[37:3 - 37:15] // CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[40:1 - 43:2] // CHECK: usrs.m c:usrs.m@470objc(cs)Foo(cm)kingkong@local_var Extent=[41:3 - 41:16] // CHECK: usrs.m c:objc(cs)Foo@d1 Extent=[44:13 - 44:15] // CHECK: usrs.m c:objc(cs)Foo(py)d1 Extent=[44:1 - 44:15] // CHECK: usrs.m c:@z Extent=[47:1 - 47:6] -// CHECK: usrs.m c:usrs.m@540@F@local_func Extent=[49:12 - 49:43] +// CHECK: usrs.m c:usrs.m@529@F@local_func Extent=[49:1 - 49:43] // CHECK: usrs.m c:usrs.m@551@F@local_func@x Extent=[49:23 - 49:28] // CHECK: usrs.m c:objc(cs)CWithExt Extent=[51:1 - 53:5] // CHECK: usrs.m c:objc(cs)CWithExt(im)meth1 Extent=[52:1 - 52:14] @@ -130,8 +130,8 @@ int test_multi_declaration(void) { // CHECK: usrs.m c:objc(cs)CWithExt(im)meth3 Extent=[66:1 - 66:27] // CHECK: usrs.m c:objc(cy)CWithExt@Bar Extent=[68:1 - 70:2] // CHECK: usrs.m c:objc(cs)CWithExt(im)meth4 Extent=[69:1 - 69:27] -// CHECK: usrs.m c:@F@aux_1 Extent=[72:6 - 72:26] -// CHECK: usrs.m c:@F@test_multi_declaration Extent=[73:5 - 77:2] +// CHECK: usrs.m c:@F@aux_1 Extent=[72:1 - 72:26] +// CHECK: usrs.m c:@F@test_multi_declaration Extent=[73:1 - 77:2] // CHECK: usrs.m c:usrs.m@980@F@test_multi_declaration@foo Extent=[74:3 - 74:14] // CHECK: usrs.m c:usrs.m@980@F@test_multi_declaration@bar Extent=[74:16 - 74:23] // CHECK: usrs.m c:usrs.m@980@F@test_multi_declaration@baz Extent=[74:25 - 74:32] @@ -139,7 +139,7 @@ int test_multi_declaration(void) { // CHECK: usrs.m c:objc(pl)P1(im)method Extent=[80:1 - 80:16] // RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-source %s -// CHECK-source: usrs.m:3:19: FunctionDecl=my_helper:3:19 (Definition) Extent=[3:19 - 3:60] +// CHECK-source: usrs.m:3:19: FunctionDecl=my_helper:3:19 (Definition) Extent=[3:1 - 3:60] // CHECK-source: usrs.m:3:33: ParmDecl=x:3:33 (Definition) Extent=[3:29 - 3:34] // CHECK-source: usrs.m:3:40: ParmDecl=y:3:40 (Definition) Extent=[3:36 - 3:41] // CHECK-source: usrs.m:3:43: UnexposedStmt= Extent=[3:43 - 3:60] @@ -154,17 +154,17 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:11:3: EnumConstantDecl=FOO:11:3 (Definition) Extent=[11:3 - 11:6] // CHECK-source: usrs.m:12:3: EnumConstantDecl=BAR:12:3 (Definition) Extent=[12:3 - 12:6] // CHECK-source: usrs.m:15:9: StructDecl=:15:9 (Definition) Extent=[15:9 - 18:2] -// CHECK-source: usrs.m:16:7: FieldDecl=wa:16:7 (Definition) Extent=[16:7 - 16:9] -// CHECK-source: usrs.m:17:7: FieldDecl=moo:17:7 (Definition) Extent=[17:7 - 17:10] +// CHECK-source: usrs.m:16:7: FieldDecl=wa:16:7 (Definition) Extent=[16:3 - 16:9] +// CHECK-source: usrs.m:17:7: FieldDecl=moo:17:7 (Definition) Extent=[17:3 - 17:10] // CHECK-source: usrs.m:18:3: TypedefDecl=MyStruct:18:3 (Definition) Extent=[15:1 - 18:11] // CHECK-source: usrs.m:15:9: TypeRef=MyStruct:15:9 Extent=[15:9 - 15:15] // CHECK-source: usrs.m:20:6: EnumDecl=Pizza:20:6 (Definition) Extent=[20:1 - 23:2] // CHECK-source: usrs.m:21:3: EnumConstantDecl=CHEESE:21:3 (Definition) Extent=[21:3 - 21:9] // CHECK-source: usrs.m:22:3: EnumConstantDecl=MUSHROOMS:22:3 (Definition) Extent=[22:3 - 22:12] // CHECK-source: usrs.m:25:12: ObjCInterfaceDecl=Foo:25:12 Extent=[25:1 - 32:5] -// CHECK-source: usrs.m:26:6: ObjCIvarDecl=x:26:6 (Definition) Extent=[26:6 - 26:7] +// CHECK-source: usrs.m:26:6: ObjCIvarDecl=x:26:6 (Definition) Extent=[26:3 - 26:7] // CHECK-source: usrs.m:26:3: TypeRef=id:0:0 Extent=[26:3 - 26:5] -// CHECK-source: usrs.m:27:6: ObjCIvarDecl=y:27:6 (Definition) Extent=[27:6 - 27:7] +// CHECK-source: usrs.m:27:6: ObjCIvarDecl=y:27:6 (Definition) Extent=[27:3 - 27:7] // CHECK-source: usrs.m:27:3: TypeRef=id:0:0 Extent=[27:3 - 27:5] // CHECK-source: usrs.m:29:1: ObjCInstanceMethodDecl=godzilla:29:1 Extent=[29:1 - 29:17] // CHECK-source: usrs.m:29:4: TypeRef=id:0:0 Extent=[29:4 - 29:6] @@ -179,10 +179,10 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:35:4: TypeRef=id:0:0 Extent=[35:4 - 35:6] // CHECK-source: usrs.m:35:17: UnexposedStmt= Extent=[35:17 - 39:2] // CHECK-source: usrs.m:36:3: UnexposedStmt= Extent=[36:3 - 36:20] -// CHECK-source: usrs.m:36:14: VarDecl=a:36:14 (Definition) Extent=[36:10 - 36:19] +// CHECK-source: usrs.m:36:14: VarDecl=a:36:14 (Definition) Extent=[36:3 - 36:19] // CHECK-source: usrs.m:36:18: UnexposedExpr= Extent=[36:18 - 36:19] // CHECK-source: usrs.m:37:3: UnexposedStmt= Extent=[37:3 - 37:16] -// CHECK-source: usrs.m:37:14: VarDecl=z:37:14 Extent=[37:10 - 37:15] +// CHECK-source: usrs.m:37:14: VarDecl=z:37:14 Extent=[37:3 - 37:15] // CHECK-source: usrs.m:38:3: UnexposedStmt= Extent=[38:3 - 38:11] // CHECK-source: usrs.m:38:10: UnexposedExpr= Extent=[38:10 - 38:11] // CHECK-source: usrs.m:38:10: UnexposedExpr= Extent=[38:10 - 38:11] @@ -197,7 +197,7 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:44:13: ObjCIvarDecl=d1:44:13 (Definition) Extent=[44:13 - 44:15] // CHECK-source: usrs.m:44:13: UnexposedDecl=d1:31:15 (Definition) Extent=[44:1 - 44:15] // CHECK-source: usrs.m:47:5: VarDecl=z:47:5 Extent=[47:1 - 47:6] -// CHECK-source: usrs.m:49:12: FunctionDecl=local_func:49:12 (Definition) Extent=[49:12 - 49:43] +// CHECK-source: usrs.m:49:12: FunctionDecl=local_func:49:12 (Definition) Extent=[49:1 - 49:43] // CHECK-source: usrs.m:49:27: ParmDecl=x:49:27 (Definition) Extent=[49:23 - 49:28] // CHECK-source: usrs.m:49:30: UnexposedStmt= Extent=[49:30 - 49:43] // CHECK-source: usrs.m:49:32: UnexposedStmt= Extent=[49:32 - 49:40] @@ -244,11 +244,11 @@ int test_multi_declaration(void) { // CHECK-source: usrs.m:69:16: UnexposedStmt= Extent=[69:16 - 69:24] // CHECK-source: usrs.m:69:23: UnexposedExpr= Extent=[69:23 - 69:24] // CHECK-source: usrs.m:69:23: UnexposedExpr= Extent=[69:23 - 69:24] -// CHECK-source: usrs.m:72:6: FunctionDecl=aux_1:72:6 Extent=[72:6 - 72:26] +// CHECK-source: usrs.m:72:6: FunctionDecl=aux_1:72:6 Extent=[72:1 - 72:26] // CHECK-source: usrs.m:72:15: ParmDecl=:72:15 (Definition) Extent=[72:12 - 72:16] // CHECK-source: usrs.m:72:20: ParmDecl=:72:20 (Definition) Extent=[72:17 - 72:21] // CHECK-source: usrs.m:72:25: ParmDecl=:72:25 (Definition) Extent=[72:22 - 72:26] -// CHECK-source: usrs.m:73:5: FunctionDecl=test_multi_declaration:73:5 (Definition) Extent=[73:5 - 77:2] +// CHECK-source: usrs.m:73:5: FunctionDecl=test_multi_declaration:73:5 (Definition) Extent=[73:1 - 77:2] // CHECK-source: usrs.m:73:34: UnexposedStmt= Extent=[73:34 - 77:2] // CHECK-source: usrs.m:74:3: UnexposedStmt= Extent=[74:3 - 74:33] // CHECK-source: usrs.m:74:7: VarDecl=foo:74:7 (Definition) Extent=[74:3 - 74:14]