[cfe-commits] r39450 - in /cfe/cfe/trunk: AST/Sema.cpp AST/Sema.h AST/SemaDecl.cpp AST/SemaExpr.cpp Sema/Sema.cpp Sema/Sema.h Sema/SemaDecl.cpp Sema/SemaExpr.cpp
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:44:34 PDT 2007
Author: clattner
Date: Wed Jul 11 11:44:34 2007
New Revision: 39450
URL: http://llvm.org/viewvc/llvm-project?rev=39450&view=rev
Log:
Remove the Sema::Diag helper that takes a type. Convert clients to use
the version that takes a string.
Modified:
cfe/cfe/trunk/AST/Sema.cpp
cfe/cfe/trunk/AST/Sema.h
cfe/cfe/trunk/AST/SemaDecl.cpp
cfe/cfe/trunk/AST/SemaExpr.cpp
cfe/cfe/trunk/Sema/Sema.cpp
cfe/cfe/trunk/Sema/Sema.h
cfe/cfe/trunk/Sema/SemaDecl.cpp
cfe/cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/cfe/trunk/AST/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.cpp?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Sema.cpp (original)
+++ cfe/cfe/trunk/AST/Sema.cpp Wed Jul 11 11:44:34 2007
@@ -44,12 +44,6 @@
return true;
}
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, QualType t) {
- std::string Name = t.getAsString();
- PP.getDiagnostics().Report(Loc, DiagID, &Name, 1);
- return true;
-}
-
bool Sema::Diag(const LexerToken &Tok, unsigned DiagID) {
PP.getDiagnostics().Report(Tok.getLocation(), DiagID);
return true;
Modified: cfe/cfe/trunk/AST/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.h?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Sema.h (original)
+++ cfe/cfe/trunk/AST/Sema.h Wed Jul 11 11:44:34 2007
@@ -62,7 +62,6 @@
const std::string &Msg2);
bool Diag(const LexerToken &Tok, unsigned DiagID);
bool Diag(const LexerToken &Tok, unsigned DiagID, const std::string &M);
- bool Diag(SourceLocation Loc, unsigned DiagID, QualType t);
//===--------------------------------------------------------------------===//
// Type Analysis / Processing: SemaType.cpp.
Modified: cfe/cfe/trunk/AST/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaDecl.cpp?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/AST/SemaDecl.cpp Wed Jul 11 11:44:34 2007
@@ -36,7 +36,7 @@
return false;
}
if (!size->getType()->isIntegerType()) {
- Diag(loc, diag::err_array_size_non_int, size->getType());
+ Diag(loc, diag::err_array_size_non_int, size->getType().getAsString());
return false;
}
// We have a constant expression with an integer type, now make sure
@@ -282,7 +282,8 @@
default: assert(0 && "Unknown storage class!");
case DeclSpec::SCS_auto:
case DeclSpec::SCS_register:
- Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func,
+ R.getAsString());
return 0;
case DeclSpec::SCS_unspecified: SC = FunctionDecl::None; break;
case DeclSpec::SCS_extern: SC = FunctionDecl::Extern; break;
@@ -322,13 +323,15 @@
// a tentative definition and has internal linkage (C99 6.2.2p3), the
// declared type shall not be an incomplete type.
if (R->isIncompleteType()) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type,
+ R.getAsString());
return 0;
}
}
// FIXME: Find C99 spec reference
if (SC == VarDecl::Auto || SC == VarDecl::Register) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope,
+ R.getAsString());
return 0;
}
// C99 6.7.5.2p2: If an identifier is declared to be an object with
@@ -343,7 +346,8 @@
// no linkage (C99 6.2.2p6), the type for the object shall be complete...
if (SC != VarDecl::Extern) {
if (R->isIncompleteType()) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type,
+ R.getAsString());
return 0;
}
}
Modified: cfe/cfe/trunk/AST/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaExpr.cpp?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/AST/SemaExpr.cpp Wed Jul 11 11:44:34 2007
@@ -261,7 +261,8 @@
// in practice, the following check catches trying to index a pointer
// to a function (e.g. void (*)(int)). Functions are not objects in c99.
if (!resultType->isObjectType())
- return Diag(LLoc, diag::err_typecheck_subscript_not_object, baseType);
+ return Diag(LLoc, diag::err_typecheck_subscript_not_object,
+ baseType.getAsString());
}
return new ArraySubscriptExpr((Expr*)Base, (Expr*)Idx, resultType);
}
@@ -753,12 +754,14 @@
// C99 6.5.2.4p1
if (const PointerType *pt = dyn_cast<PointerType>(resType)) {
if (!pt->getPointeeType()->isObjectType()) { // C99 6.5.2.4p2, 6.5.6p2
- Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type, resType);
+ Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type,
+ resType.getAsString());
return QualType();
}
} else if (!resType->isRealType()) {
// FIXME: Allow Complex as a GCC extension.
- Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement, resType);
+ Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement,
+ resType.getAsString());
return QualType();
}
// At this point, we know we have a real or pointer type. Now make sure
@@ -832,7 +835,7 @@
if (PointerType *PT = dyn_cast<PointerType>(qType))
return PT->getPointeeType();
- Diag(OpLoc, diag::err_typecheck_unary_expr, qType);
+ Diag(OpLoc, diag::err_typecheck_unary_expr, qType.getAsString());
return QualType();
}
@@ -1022,17 +1025,20 @@
case UnaryOperator::Minus:
resultType = UsualUnaryConversion(((Expr *)Input)->getType());
if (!resultType->isArithmeticType()) // C99 6.5.3.3p1
- return Diag(OpLoc, diag::err_typecheck_unary_expr, resultType);
+ return Diag(OpLoc, diag::err_typecheck_unary_expr,
+ resultType.getAsString());
break;
case UnaryOperator::Not: // bitwise complement
resultType = UsualUnaryConversion(((Expr *)Input)->getType());
if (!resultType->isIntegerType()) // C99 6.5.3.3p1
- return Diag(OpLoc, diag::err_typecheck_unary_expr, resultType);
+ return Diag(OpLoc, diag::err_typecheck_unary_expr,
+ resultType.getAsString());
break;
case UnaryOperator::LNot: // logical negation
resultType = UsualUnaryConversion(((Expr *)Input)->getType());
if (!resultType->isScalarType()) // C99 6.5.3.3p1
- return Diag(OpLoc, diag::err_typecheck_unary_expr, resultType);
+ return Diag(OpLoc, diag::err_typecheck_unary_expr,
+ resultType.getAsString());
break;
case UnaryOperator::SizeOf:
resultType = CheckSizeOfAlignOfOperand(((Expr *)Input)->getType(), OpLoc,
Modified: cfe/cfe/trunk/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.cpp?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/cfe/trunk/Sema/Sema.cpp Wed Jul 11 11:44:34 2007
@@ -44,12 +44,6 @@
return true;
}
-bool Sema::Diag(SourceLocation Loc, unsigned DiagID, QualType t) {
- std::string Name = t.getAsString();
- PP.getDiagnostics().Report(Loc, DiagID, &Name, 1);
- return true;
-}
-
bool Sema::Diag(const LexerToken &Tok, unsigned DiagID) {
PP.getDiagnostics().Report(Tok.getLocation(), DiagID);
return true;
Modified: cfe/cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.h?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:44:34 2007
@@ -62,7 +62,6 @@
const std::string &Msg2);
bool Diag(const LexerToken &Tok, unsigned DiagID);
bool Diag(const LexerToken &Tok, unsigned DiagID, const std::string &M);
- bool Diag(SourceLocation Loc, unsigned DiagID, QualType t);
//===--------------------------------------------------------------------===//
// Type Analysis / Processing: SemaType.cpp.
Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:44:34 2007
@@ -36,7 +36,7 @@
return false;
}
if (!size->getType()->isIntegerType()) {
- Diag(loc, diag::err_array_size_non_int, size->getType());
+ Diag(loc, diag::err_array_size_non_int, size->getType().getAsString());
return false;
}
// We have a constant expression with an integer type, now make sure
@@ -282,7 +282,8 @@
default: assert(0 && "Unknown storage class!");
case DeclSpec::SCS_auto:
case DeclSpec::SCS_register:
- Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_func,
+ R.getAsString());
return 0;
case DeclSpec::SCS_unspecified: SC = FunctionDecl::None; break;
case DeclSpec::SCS_extern: SC = FunctionDecl::Extern; break;
@@ -322,13 +323,15 @@
// a tentative definition and has internal linkage (C99 6.2.2p3), the
// declared type shall not be an incomplete type.
if (R->isIncompleteType()) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type,
+ R.getAsString());
return 0;
}
}
// FIXME: Find C99 spec reference
if (SC == VarDecl::Auto || SC == VarDecl::Register) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope,
+ R.getAsString());
return 0;
}
// C99 6.7.5.2p2: If an identifier is declared to be an object with
@@ -343,7 +346,8 @@
// no linkage (C99 6.2.2p6), the type for the object shall be complete...
if (SC != VarDecl::Extern) {
if (R->isIncompleteType()) {
- Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type, R);
+ Diag(D.getIdentifierLoc(), diag::err_typecheck_decl_incomplete_type,
+ R.getAsString());
return 0;
}
}
Modified: cfe/cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExpr.cpp?rev=39450&r1=39449&r2=39450&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:44:34 2007
@@ -261,7 +261,8 @@
// in practice, the following check catches trying to index a pointer
// to a function (e.g. void (*)(int)). Functions are not objects in c99.
if (!resultType->isObjectType())
- return Diag(LLoc, diag::err_typecheck_subscript_not_object, baseType);
+ return Diag(LLoc, diag::err_typecheck_subscript_not_object,
+ baseType.getAsString());
}
return new ArraySubscriptExpr((Expr*)Base, (Expr*)Idx, resultType);
}
@@ -753,12 +754,14 @@
// C99 6.5.2.4p1
if (const PointerType *pt = dyn_cast<PointerType>(resType)) {
if (!pt->getPointeeType()->isObjectType()) { // C99 6.5.2.4p2, 6.5.6p2
- Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type, resType);
+ Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type,
+ resType.getAsString());
return QualType();
}
} else if (!resType->isRealType()) {
// FIXME: Allow Complex as a GCC extension.
- Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement, resType);
+ Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement,
+ resType.getAsString());
return QualType();
}
// At this point, we know we have a real or pointer type. Now make sure
@@ -832,7 +835,7 @@
if (PointerType *PT = dyn_cast<PointerType>(qType))
return PT->getPointeeType();
- Diag(OpLoc, diag::err_typecheck_unary_expr, qType);
+ Diag(OpLoc, diag::err_typecheck_unary_expr, qType.getAsString());
return QualType();
}
@@ -1022,17 +1025,20 @@
case UnaryOperator::Minus:
resultType = UsualUnaryConversion(((Expr *)Input)->getType());
if (!resultType->isArithmeticType()) // C99 6.5.3.3p1
- return Diag(OpLoc, diag::err_typecheck_unary_expr, resultType);
+ return Diag(OpLoc, diag::err_typecheck_unary_expr,
+ resultType.getAsString());
break;
case UnaryOperator::Not: // bitwise complement
resultType = UsualUnaryConversion(((Expr *)Input)->getType());
if (!resultType->isIntegerType()) // C99 6.5.3.3p1
- return Diag(OpLoc, diag::err_typecheck_unary_expr, resultType);
+ return Diag(OpLoc, diag::err_typecheck_unary_expr,
+ resultType.getAsString());
break;
case UnaryOperator::LNot: // logical negation
resultType = UsualUnaryConversion(((Expr *)Input)->getType());
if (!resultType->isScalarType()) // C99 6.5.3.3p1
- return Diag(OpLoc, diag::err_typecheck_unary_expr, resultType);
+ return Diag(OpLoc, diag::err_typecheck_unary_expr,
+ resultType.getAsString());
break;
case UnaryOperator::SizeOf:
resultType = CheckSizeOfAlignOfOperand(((Expr *)Input)->getType(), OpLoc,
More information about the cfe-commits
mailing list