From ab636848c622755e89f221a1b8d0294c1f3c1229 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Wed, 27 Aug 2014 03:05:19 +0000 Subject: [PATCH] Refactor the diagnostic DeclContext printing. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216517 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTDiagnostic.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp index 8c8b1dff0c..5c73a37275 100644 --- a/lib/AST/ASTDiagnostic.cpp +++ b/lib/AST/ASTDiagnostic.cpp @@ -342,26 +342,22 @@ void clang::FormatASTNodeDiagnosticArgument( assert(DC && "Should never have a null declaration context"); NeedQuotes = false; + // FIXME: Get the strings for DeclContext from some localized place if (DC->isTranslationUnit()) { - // FIXME: Get these strings from some localized place if (Context.getLangOpts().CPlusPlus) OS << "the global namespace"; else OS << "the global scope"; + } else if (DC->isClosure()) { + OS << "block literal"; + } else if (isLambdaCallOperator(DC)) { + OS << "lambda expression"; } else if (TypeDecl *Type = dyn_cast(DC)) { OS << ConvertTypeToDiagnosticString(Context, Context.getTypeDeclType(Type), PrevArgs, QualTypeVals); } else { - // FIXME: Get these strings from some localized place - if (isa(DC)) { - OS << "block literal"; - break; - } - if (isLambdaCallOperator(DC)) { - OS << "lambda expression"; - break; - } + assert(isa(DC) && "Expected a NamedDecl"); NamedDecl *ND = cast(DC); if (isa(ND)) OS << "namespace "; -- 2.40.0