diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-19 23:53:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-19 23:53:20 +0000 |
commit | 92dd386e3f05d176b45a638199d51f536bd9d1c4 (patch) | |
tree | b18ac8c7e53559b65b3e5db89b28def6d4dc1363 /lib/Sema/Sema.cpp | |
parent | 33b6f6352d3c7e4eb026ce129f48a72061a4e129 (diff) |
replace a dirty hack with a clean solution. Too bad we can't
use Blocks for our callbacks ;-)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 1ffaf939ef..2bb6a17ac1 100644 --- a/lib/Sema/Sema.cpp +++ b/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. |