r216517 - Refactor the diagnostic DeclContext printing. No functionality change.
Richard Trieu
rtrieu at google.com
Tue Aug 26 20:05:19 PDT 2014
Author: rtrieu
Date: Tue Aug 26 22:05:19 2014
New Revision: 216517
URL: http://llvm.org/viewvc/llvm-project?rev=216517&view=rev
Log:
Refactor the diagnostic DeclContext printing. No functionality change.
Modified:
cfe/trunk/lib/AST/ASTDiagnostic.cpp
Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=216517&r1=216516&r2=216517&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
+++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Tue Aug 26 22:05:19 2014
@@ -342,26 +342,22 @@ void clang::FormatASTNodeDiagnosticArgum
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 ";
More information about the cfe-commits
mailing list