generalize some of the conversion warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45560 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.cpp b/Sema/Sema.cpp
index 7bdcd0a..bca3ec5 100644
--- a/Sema/Sema.cpp
+++ b/Sema/Sema.cpp
@@ -152,6 +152,14 @@
return true;
}
+bool Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
+ const std::string &Msg2, const std::string &Msg3,
+ SourceRange R1) {
+ std::string MsgArr[] = { Msg1, Msg2, Msg3 };
+ PP.getDiagnostics().Report(PP.getFullLoc(Loc), DiagID, MsgArr, 3, &R1, 1);
+ return true;
+}
+
bool Sema::Diag(SourceLocation Loc, unsigned DiagID,
SourceRange R1, SourceRange R2) {
SourceRange RangeArr[] = { R1, R2 };
diff --git a/Sema/Sema.h b/Sema/Sema.h
index 33fd345..8846d15 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -159,6 +159,8 @@
SourceRange R1, SourceRange R2);
bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
const std::string &Msg2, SourceRange R1);
+ bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
+ const std::string &Msg2, const std::string &Msg3, SourceRange R1);
bool Diag(SourceLocation Loc, unsigned DiagID,
const std::string &Msg1, const std::string &Msg2,
SourceRange R1, SourceRange R2);
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index bab7d3d..de642c6 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -2229,38 +2229,35 @@
Args[i] = argExpr; // Make sure we store the converted expression.
SourceLocation l = argExpr->getLocStart();
- // decode the result (notice that AST's are still created for extensions).
+ // Decode the result (notice that AST's are still created for extensions).
+ const char *Kind = "sending";
switch (result) {
case Compatible:
break;
case PointerFromInt:
- Diag(l, diag::ext_typecheck_sending_pointer_int,
- lhsType.getAsString(), rhsType.getAsString(),
- argExpr->getSourceRange());
- break;
case IntFromPointer:
- Diag(l, diag::ext_typecheck_sending_pointer_int,
- lhsType.getAsString(), rhsType.getAsString(),
+ Diag(l, diag::ext_typecheck_convert_pointer_int,
+ lhsType.getAsString(), rhsType.getAsString(), Kind,
argExpr->getSourceRange());
break;
case IncompatiblePointer:
- Diag(l, diag::ext_typecheck_sending_incompatible_pointer,
- rhsType.getAsString(), lhsType.getAsString(),
+ Diag(l, diag::ext_typecheck_convert_incompatible_pointer,
+ lhsType.getAsString(), rhsType.getAsString(), Kind,
argExpr->getSourceRange());
break;
case FunctionVoidPointer:
- Diag(l, diag::ext_typecheck_sending_pointer_void_func,
- rhsType.getAsString(), lhsType.getAsString(),
+ Diag(l, diag::ext_typecheck_convert_pointer_void_func,
+ lhsType.getAsString(), rhsType.getAsString(), Kind,
argExpr->getSourceRange());
break;
case CompatiblePointerDiscardsQualifiers:
- Diag(l, diag::ext_typecheck_sending_discards_qualifiers,
- rhsType.getAsString(), lhsType.getAsString(),
+ Diag(l, diag::ext_typecheck_convert_discards_qualifiers,
+ lhsType.getAsString(), rhsType.getAsString(), Kind,
argExpr->getSourceRange());
break;
case Incompatible:
- Diag(l, diag::err_typecheck_sending_incompatible,
- rhsType.getAsString(), lhsType.getAsString(),
+ Diag(l, diag::err_typecheck_convert_incompatible,
+ lhsType.getAsString(), rhsType.getAsString(), Kind,
argExpr->getSourceRange());
anyIncompatibleArgs = true;
}