Switch several more Sema Diag methods over. This simplifies the
__builtin_prefetch code to only emit one diagnostic per builtin_prefetch.
While this has nothing to do with the rest of the patch, the code seemed
like overkill when I was updating it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59588 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index f6f3202..fff5ae4 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -96,7 +96,7 @@
SourceLocation RParenLoc) {
ObjCProtocolDecl* PDecl = ObjCProtocols[ProtocolId];
if (!PDecl) {
- Diag(ProtoLoc, diag::err_undeclared_protocol, ProtocolId->getName());
+ Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId->getName();
return true;
}
@@ -117,8 +117,8 @@
for (unsigned i = 0; i != NumArgs; i++)
DefaultArgumentPromotion(Args[i]);
- Diag(lbrac, diag::warn_method_not_found, std::string(PrefixStr),
- Sel.getName(), SourceRange(lbrac, rbrac));
+ Diag(lbrac, diag::warn_method_not_found)
+ << PrefixStr << Sel.getName() << SourceRange(lbrac, rbrac);
ReturnType = Context.getObjCIdType();
return false;
} else {
@@ -160,10 +160,10 @@
// Check for extra arguments to non-variadic methods.
if (NumArgs != NumNamedArgs) {
Diag(Args[NumNamedArgs]->getLocStart(),
- diag::err_typecheck_call_too_many_args,
- Method->getSourceRange(),
- SourceRange(Args[NumNamedArgs]->getLocStart(),
- Args[NumArgs-1]->getLocEnd()));
+ diag::err_typecheck_call_too_many_args)
+ << Method->getSourceRange()
+ << SourceRange(Args[NumNamedArgs]->getLocStart(),
+ Args[NumArgs-1]->getLocEnd());
}
}
@@ -188,8 +188,8 @@
isSuper = true;
ClassDecl = getCurMethodDecl()->getClassInterface()->getSuperClass();
if (!ClassDecl)
- return Diag(lbrac, diag::error_no_super_class,
- getCurMethodDecl()->getClassInterface()->getName());
+ return Diag(lbrac, diag::error_no_super_class)
+ << getCurMethodDecl()->getClassInterface()->getName();
if (getCurMethodDecl()->isInstance()) {
QualType superTy = Context.getObjCInterfaceType(ClassDecl);
superTy = Context.getPointerType(superTy);
@@ -344,9 +344,8 @@
break;
}
if (!Method)
- Diag(lbrac, diag::warn_method_not_found_in_protocol,
- std::string("-"), Sel.getName(),
- RExpr->getSourceRange());
+ Diag(lbrac, diag::warn_method_not_found_in_protocol)
+ << "-" << Sel.getName() << RExpr->getSourceRange();
} else if (const ObjCInterfaceType *OCIReceiver =
ReceiverCType->getAsPointerToObjCInterfaceType()) {
// We allow sending a message to a pointer to an interface (an object).
@@ -367,12 +366,11 @@
}
if (!Method && !OCIReceiver->qual_empty())
- Diag(lbrac, diag::warn_method_not_found_in_protocol,
- std::string("-"), Sel.getName(),
- SourceRange(lbrac, rbrac));
+ Diag(lbrac, diag::warn_method_not_found_in_protocol)
+ << "-" << Sel.getName() << SourceRange(lbrac, rbrac);
} else {
- Diag(lbrac, diag::error_bad_receiver_type,
- RExpr->getType().getAsString(), RExpr->getSourceRange());
+ Diag(lbrac, diag::error_bad_receiver_type)
+ << RExpr->getType().getAsString() << RExpr->getSourceRange();
return true;
}