diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-11-23 09:13:29 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-11-23 09:13:29 +0000 | 
| commit | 6a2ed6f6dcd63ef05bc094195a646f44e6a2a029 (patch) | |
| tree | c2e30875c58541688d3b1c5fe43398b7fe1938fd /clang/lib/Sema/SemaExpr.cpp | |
| parent | 4e2e9f1a5dc76166ec0b1d8e88502ffc99d7073d (diff) | |
| download | bcm5719-llvm-6a2ed6f6dcd63ef05bc094195a646f44e6a2a029.tar.gz bcm5719-llvm-6a2ed6f6dcd63ef05bc094195a646f44e6a2a029.zip | |
Add support for sending QualType's directly into diags and convert two
diags over to use this.  QualTypes implicitly print single quotes around 
them for uniformity and future extension.
Doing this requires a little function pointer dance to prevent libbasic
from depending on libast.
llvm-svn: 59907
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 23 | 
1 files changed, 11 insertions, 12 deletions
| diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index ef3ead4fa2c..bebde38a18b 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -2054,7 +2054,7 @@ Sema::CheckCompoundAssignmentConstraints(QualType lhsType, QualType rhsType) {  QualType Sema::InvalidOperands(SourceLocation Loc, Expr *&lex, Expr *&rex) {    Diag(Loc, diag::err_typecheck_invalid_operands) -    << lex->getType().getAsString() << rex->getType().getAsString() +    << lex->getType() << rex->getType()      << lex->getSourceRange() << rex->getSourceRange();    return QualType();  } @@ -2809,20 +2809,19 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {    return Context.getPointerType(op->getType());  } -QualType Sema::CheckIndirectionOperand(Expr *op, SourceLocation OpLoc) { -  UsualUnaryConversions(op); -  QualType qType = op->getType(); +QualType Sema::CheckIndirectionOperand(Expr *Op, SourceLocation OpLoc) { +  UsualUnaryConversions(Op); +  QualType Ty = Op->getType(); -  if (const PointerType *PT = qType->getAsPointerType()) { -    // Note that per both C89 and C99, this is always legal, even -    // if ptype is an incomplete type or void. -    // It would be possible to warn about dereferencing a -    // void pointer, but it's completely well-defined, -    // and such a warning is unlikely to catch any mistakes. +  // Note that per both C89 and C99, this is always legal, even if ptype is an +  // incomplete type or void.  It would be possible to warn about dereferencing +  // a void pointer, but it's completely well-defined, and such a warning is +  // unlikely to catch any mistakes. +  if (const PointerType *PT = Ty->getAsPointerType())      return PT->getPointeeType(); -  } +      Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer) -    << qType.getAsString() << op->getSourceRange(); +    << Ty << Op->getSourceRange();    return QualType();  } | 

