[cfe-commits] r121013 - in /cfe/trunk: include/clang/Sema/AttributeList.h lib/Sema/SemaDeclAttr.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Dec 6 09:51:50 PST 2010
Author: akirtzidis
Date: Mon Dec 6 11:51:50 2010
New Revision: 121013
URL: http://llvm.org/viewvc/llvm-project?rev=121013&view=rev
Log:
Use the source location of the parameter, when it makes sense, for diagnostics in HandleCleanupAttr.
Modified:
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=121013&r1=121012&r2=121013&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Mon Dec 6 11:51:50 2010
@@ -168,6 +168,7 @@
SourceLocation getScopeLoc() const { return ScopeLoc; }
IdentifierInfo *getParameterName() const { return ParmName; }
+ SourceLocation getParameterLoc() const { return ParmLoc; }
bool isDeclspecAttribute() const { return DeclspecAttribute; }
bool isCXX0XAttribute() const { return CXX0XAttribute; }
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=121013&r1=121012&r2=121013&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Dec 6 11:51:50 2010
@@ -1417,24 +1417,26 @@
// 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 @@
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;
More information about the cfe-commits
mailing list