aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-08-26 22:59:12 +0000
committerAnders Carlsson <andersca@mac.com>2009-08-26 22:59:12 +0000
commitd497ba7ca5e52cd4523822055abd5e89dfec1800 (patch)
tree9602a0d15dae8e59dfbcd6db1ed8a4fc0db799b1
parentbd4c4aebe6035e7a7125470cc9f0f92511230ee3 (diff)
Remove the PrintType argument from RequireCompleteType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80174 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/Sema.h5
-rw-r--r--lib/Sema/SemaExpr.cpp33
-rw-r--r--lib/Sema/SemaExprCXX.cpp16
-rw-r--r--lib/Sema/SemaType.cpp7
4 files changed, 27 insertions, 34 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 324090556f..972f7ad2d3 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -484,9 +484,8 @@ public:
virtual TypeResult ActOnTypeName(Scope *S, Declarator &D);
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag,
- SourceRange Range1 = SourceRange(),
- SourceRange Range2 = SourceRange(),
- QualType PrintType = QualType());
+ SourceRange Range1 = SourceRange(),
+ SourceRange Range2 = SourceRange());
bool RequireCompleteType(SourceLocation Loc, QualType T,
const PartialDiagnostic &PD);
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index e737089818..ef924fee42 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -14,13 +14,14 @@
#include "Sema.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
+#include "clang/AST/DeclTemplate.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
-#include "clang/AST/DeclTemplate.h"
-#include "clang/Lex/Preprocessor.h"
-#include "clang/Lex/LiteralSupport.h"
+#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
+#include "clang/Lex/LiteralSupport.h"
+#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/Designator.h"
#include "clang/Parse/Scope.h"
@@ -3989,9 +3990,9 @@ inline QualType Sema::CheckAdditionOperands( // C99 6.5.6
!PExp->getType()->isDependentType()) ||
PExp->getType()->isObjCObjectPointerType()) &&
RequireCompleteType(Loc, PointeeTy,
- diag::err_typecheck_arithmetic_incomplete_type,
- PExp->getSourceRange(), SourceRange(),
- PExp->getType()))
+ PDiag(diag::err_typecheck_arithmetic_incomplete_type)
+ << PExp->getSourceRange()
+ << PExp->getType()))
return QualType();
}
// Diagnose bad cases where we step over interface counts.
@@ -4065,10 +4066,9 @@ QualType Sema::CheckSubtractionOperands(Expr *&lex, Expr *&rex,
ComplainAboutFunc = lex;
} else if (!lpointee->isDependentType() &&
RequireCompleteType(Loc, lpointee,
- diag::err_typecheck_sub_ptr_object,
- lex->getSourceRange(),
- SourceRange(),
- lex->getType()))
+ PDiag(diag::err_typecheck_sub_ptr_object)
+ << lex->getSourceRange()
+ << lex->getType()))
return QualType();
// Diagnose bad cases where we step over interface counts.
@@ -4118,10 +4118,9 @@ QualType Sema::CheckSubtractionOperands(Expr *&lex, Expr *&rex,
ComplainAboutFunc = rex;
} else if (!rpointee->isDependentType() &&
RequireCompleteType(Loc, rpointee,
- diag::err_typecheck_sub_ptr_object,
- rex->getSourceRange(),
- SourceRange(),
- rex->getType()))
+ PDiag(diag::err_typecheck_sub_ptr_object)
+ << rex->getSourceRange()
+ << rex->getType()))
return QualType();
if (getLangOptions().CPlusPlus) {
@@ -4772,9 +4771,9 @@ QualType Sema::CheckIncrementDecrementOperand(Expr *Op, SourceLocation OpLoc,
Diag(OpLoc, diag::ext_gnu_ptr_func_arith)
<< ResType << Op->getSourceRange();
} else if (RequireCompleteType(OpLoc, PointeeTy,
- diag::err_typecheck_arithmetic_incomplete_type,
- Op->getSourceRange(), SourceRange(),
- ResType))
+ PDiag(diag::err_typecheck_arithmetic_incomplete_type)
+ << Op->getSourceRange()
+ << ResType))
return QualType();
// Diagnose bad cases where we step over interface counts.
else if (PointeeTy->isObjCInterfaceType() && LangOpts.ObjCNonFragileABI) {
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index ae5010cfac..a8eb2cbc7e 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -13,11 +13,12 @@
#include "SemaInherit.h"
#include "Sema.h"
-#include "clang/AST/ExprCXX.h"
#include "clang/AST/ASTContext.h"
-#include "clang/Parse/DeclSpec.h"
-#include "clang/Lex/Preprocessor.h"
+#include "clang/AST/ExprCXX.h"
+#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Parse/DeclSpec.h"
#include "llvm/ADT/STLExtras.h"
using namespace clang;
@@ -147,9 +148,9 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
}
if (!isPointer || !Ty->isVoidType()) {
if (RequireCompleteType(ThrowLoc, Ty,
- isPointer ? diag::err_throw_incomplete_ptr
- : diag::err_throw_incomplete,
- E->getSourceRange(), SourceRange(), QualType()))
+ PDiag(isPointer ? diag::err_throw_incomplete_ptr
+ : diag::err_throw_incomplete)
+ << E->getSourceRange()))
return true;
}
@@ -1081,8 +1082,7 @@ Sema::OwningExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
// to be complete.
if (OTT != UTT_IsClass && OTT != UTT_IsEnum && OTT != UTT_IsUnion) {
if (RequireCompleteType(KWLoc, T,
- diag::err_incomplete_type_used_in_type_trait_expr,
- SourceRange(), SourceRange(), T))
+ diag::err_incomplete_type_used_in_type_trait_expr))
return ExprError();
}
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 7775c25142..2a74a874fa 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1771,12 +1771,7 @@ void Sema::ProcessTypeAttributeList(QualType &Result, const AttributeList *AL) {
/// @returns @c true if @p T is incomplete and a diagnostic was emitted,
/// @c false otherwise.
bool Sema::RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag,
- SourceRange Range1, SourceRange Range2,
- QualType PrintType) {
- if (!PrintType.isNull())
- return RequireCompleteType(Loc, T,
- PDiag(diag) << Range1 << Range2 << PrintType);
-
+ SourceRange Range1, SourceRange Range2) {
return RequireCompleteType(Loc, T,
PDiag(diag) << Range1 << Range2);
}