diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-12-06 17:51:50 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-12-06 17:51:50 +0000 |
commit | f0b0ccce127857e7e4fb829e017dbcb7487884c4 (patch) | |
tree | 4490e843a5d5f9ee5d25a1bf268cea1e24c73f56 /lib/Sema/SemaDeclAttr.cpp | |
parent | b5f35bae05f1ce3ae62ca52b266a086fd019e89b (diff) |
Use the source location of the parameter, when it makes sense, for diagnostics in HandleCleanupAttr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index c429fd37dd..d53fd6822d 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1417,24 +1417,26 @@ static void HandleCleanupAttr(Decl *d, const AttributeList &Attr, Sema &S) { // FIXME: The lookup source location should be in the attribute, not the // start of the attribute. NamedDecl *CleanupDecl - = S.LookupSingleName(S.TUScope, Attr.getParameterName(), Attr.getLoc(), - Sema::LookupOrdinaryName); + = S.LookupSingleName(S.TUScope, Attr.getParameterName(), + Attr.getParameterLoc(), Sema::LookupOrdinaryName); if (!CleanupDecl) { - S.Diag(Attr.getLoc(), diag::err_attribute_cleanup_arg_not_found) << + S.Diag(Attr.getParameterLoc(), diag::err_attribute_cleanup_arg_not_found) << Attr.getParameterName(); return; } FunctionDecl *FD = dyn_cast<FunctionDecl>(CleanupDecl); if (!FD) { - S.Diag(Attr.getLoc(), diag::err_attribute_cleanup_arg_not_function) << - Attr.getParameterName(); + S.Diag(Attr.getParameterLoc(), + diag::err_attribute_cleanup_arg_not_function) + << Attr.getParameterName(); return; } if (FD->getNumParams() != 1) { - S.Diag(Attr.getLoc(), diag::err_attribute_cleanup_func_must_take_one_arg) << - Attr.getParameterName(); + S.Diag(Attr.getParameterLoc(), + diag::err_attribute_cleanup_func_must_take_one_arg) + << Attr.getParameterName(); return; } @@ -1443,7 +1445,7 @@ static void HandleCleanupAttr(Decl *d, const AttributeList &Attr, Sema &S) { QualType Ty = S.Context.getPointerType(VD->getType()); QualType ParamTy = FD->getParamDecl(0)->getType(); if (S.CheckAssignmentConstraints(ParamTy, Ty) != Sema::Compatible) { - S.Diag(Attr.getLoc(), + S.Diag(Attr.getParameterLoc(), diag::err_attribute_cleanup_func_arg_incompatible_type) << Attr.getParameterName() << ParamTy << Ty; return; |