Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first. This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59948 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 8cd223f..99fdbdb 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -223,7 +223,7 @@
return true;
} else if (!condType->isScalarType()) // C99 6.8.4.1p1
return Diag(IfLoc, diag::err_typecheck_statement_requires_scalar)
- << condType.getAsString() << condExpr->getSourceRange();
+ << condType << condExpr->getSourceRange();
// Warn if the if block has a null body without an else value.
// this helps prevent bugs due to typos, such as
@@ -362,7 +362,7 @@
if (!CondType->isIntegerType()) { // C99 6.8.4.2p1
Diag(SwitchLoc, diag::err_typecheck_statement_requires_integer)
- << CondType.getAsString() << CondExpr->getSourceRange();
+ << CondType << CondExpr->getSourceRange();
return true;
}
@@ -549,7 +549,7 @@
return true;
} else if (!condType->isScalarType()) // C99 6.8.5p2
return Diag(WhileLoc, diag::err_typecheck_statement_requires_scalar)
- << condType.getAsString() << condExpr->getSourceRange();
+ << condType << condExpr->getSourceRange();
return new WhileStmt(condExpr, (Stmt*)Body, WhileLoc);
}
@@ -568,7 +568,7 @@
return true;
} else if (!condType->isScalarType()) // C99 6.8.5p2
return Diag(DoLoc, diag::err_typecheck_statement_requires_scalar)
- << condType.getAsString() << condExpr->getSourceRange();
+ << condType << condExpr->getSourceRange();
return new DoStmt((Stmt*)Body, condExpr, DoLoc);
}
@@ -607,7 +607,7 @@
return true;
} else if (!SecondType->isScalarType()) // C99 6.8.5p2
return Diag(ForLoc, diag::err_typecheck_statement_requires_scalar)
- << SecondType.getAsString() << Second->getSourceRange();
+ << SecondType << Second->getSourceRange();
}
return new ForStmt(First, Second, Third, Body, ForLoc);
}
@@ -646,14 +646,14 @@
}
if (!Context.isObjCObjectPointerType(FirstType))
Diag(ForLoc, diag::err_selector_element_type)
- << FirstType.getAsString() << First->getSourceRange();
+ << FirstType << First->getSourceRange();
}
if (Second) {
DefaultFunctionArrayConversion(Second);
QualType SecondType = Second->getType();
if (!Context.isObjCObjectPointerType(SecondType))
Diag(ForLoc, diag::err_collection_expr_type)
- << SecondType.getAsString() << Second->getSourceRange();
+ << SecondType << Second->getSourceRange();
}
return new ObjCForCollectionStmt(First, Second, Body, ForLoc, RParenLoc);
}
@@ -888,7 +888,7 @@
// FIXME: We currently leak memory here.
return Diag(InputExpr->getSubExpr()->getLocStart(),
diag::err_asm_invalid_type_in_input)
- << InputExpr->getType().getAsString() << InputConstraint
+ << InputExpr->getType() << InputConstraint
<< InputExpr->getSubExpr()->getSourceRange();
}
}