diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2011-03-08 08:55:46 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2011-03-08 08:55:46 +0000 |
commit | ff676cb48fe8bf7be2feaa251dc7c5fb15af4730 (patch) | |
tree | 980c79f4bb390f3c84823e06a04ef25f6a3ff27f /lib/Sema/SemaDeclObjC.cpp | |
parent | 36784e78bcce1dbaf35f94a655394e348b4d9ac7 (diff) |
Fixed source range for all DeclaratorDecl's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127225 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 38 |
1 files changed, 23 insertions, 15 deletions
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<FieldDecl>(Ivars[i]); RecordDecl *Record = dyn_cast<RecordDecl>(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). |