diff options
author | Richard Trieu <rtrieu@google.com> | 2014-08-27 03:05:19 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2014-08-27 03:05:19 +0000 |
commit | 3af6c10afb2ade27c535bd42cdd975fe2f8b4ec8 (patch) | |
tree | 3712278c43943c332d6246bf63b9b1cd399ab2f4 /clang/lib/AST/ASTDiagnostic.cpp | |
parent | fba9bb7b6e11c3139453762426e7d6b2ebacda5f (diff) | |
download | bcm5719-llvm-3af6c10afb2ade27c535bd42cdd975fe2f8b4ec8.tar.gz bcm5719-llvm-3af6c10afb2ade27c535bd42cdd975fe2f8b4ec8.zip |
Refactor the diagnostic DeclContext printing. No functionality change.
llvm-svn: 216517
Diffstat (limited to 'clang/lib/AST/ASTDiagnostic.cpp')
-rw-r--r-- | clang/lib/AST/ASTDiagnostic.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index 8c8b1dff0cb..5c73a37275a 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/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<TypeDecl>(DC)) { OS << ConvertTypeToDiagnosticString(Context, Context.getTypeDeclType(Type), PrevArgs, QualTypeVals); } else { - // FIXME: Get these strings from some localized place - if (isa<BlockDecl>(DC)) { - OS << "block literal"; - break; - } - if (isLambdaCallOperator(DC)) { - OS << "lambda expression"; - break; - } + assert(isa<NamedDecl>(DC) && "Expected a NamedDecl"); NamedDecl *ND = cast<NamedDecl>(DC); if (isa<NamespaceDecl>(ND)) OS << "namespace "; |