summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-19 23:53:20 +0000
committerChris Lattner <sabre@nondot.org>2009-02-19 23:53:20 +0000
commitcf868c458c5dda487684fffac0a6afd528de5505 (patch)
tree44099fdfbac6580614652db2e3cf9f89e93a9b0e /clang/lib/Sema/Sema.cpp
parent68abaa984daa9e298ae0dbc585935bebbd598211 (diff)
downloadbcm5719-llvm-cf868c458c5dda487684fffac0a6afd528de5505.tar.gz
bcm5719-llvm-cf868c458c5dda487684fffac0a6afd528de5505.zip
replace a dirty hack with a clean solution. Too bad we can't
use Blocks for our callbacks ;-) llvm-svn: 65083
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 1ffaf939eff..2bb6a17ac10 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -24,7 +24,9 @@ using namespace clang;
static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
const char *Modifier, unsigned ModLen,
const char *Argument, unsigned ArgLen,
- llvm::SmallVectorImpl<char> &Output) {
+ llvm::SmallVectorImpl<char> &Output,
+ void *Cookie) {
+ ASTContext &Context = *static_cast<ASTContext*>(Cookie);
std::string S;
if (Kind == Diagnostic::ak_qualtype) {
@@ -47,8 +49,14 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
// it will turn into an attribute mess. People want their "vec4".
!isa<VectorType>(DesugaredTy) &&
- // Don't desugar objc types. FIXME: THIS IS A HACK.
- S != "id" && S != "Class") {
+ // Don't desugar magic Objective-C types.
+ Ty.getUnqualifiedType() != Context.getObjCIdType() &&
+ Ty.getUnqualifiedType() != Context.getObjCSelType() &&
+ Ty.getUnqualifiedType() != Context.getObjCProtoType() &&
+ Ty.getUnqualifiedType() != Context.getObjCClassType() &&
+
+ // Not va_list.
+ Ty.getUnqualifiedType() != Context.getBuiltinVaListType()) {
S = "'"+S+"' (aka '";
S += DesugaredTy.getAsString();
S += "')";
@@ -165,7 +173,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
FieldCollector.reset(new CXXFieldCollector());
// Tell diagnostics how to render things from the AST library.
- PP.getDiagnostics().SetArgToStringFn(ConvertArgToStringFn);
+ PP.getDiagnostics().SetArgToStringFn(ConvertArgToStringFn, &Context);
}
/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
OpenPOWER on IntegriCloud