Improved logging for FindExternalLexicalDecls to

make it easier to track down which members belong
to which structs (and which call to 
FindExternalLexicalDecls is doing the reporting).

llvm-svn: 141930
This commit is contained in:
Sean Callanan 2011-10-14 01:15:27 +00:00
parent d9444d455e
commit 187de46132
1 changed files with 14 additions and 4 deletions

View File

@ -2512,19 +2512,25 @@ ClangExpressionDeclMap::FindExternalLexicalDecls (const DeclContext *decl_contex
ASTContext *ast_context = &context_decl->getASTContext();
static unsigned int invocation_id = 0;
unsigned int current_id = invocation_id++;
if (log)
{
if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
log->Printf("FindExternalLexicalDecls in '%s' (a %s) with %s predicate",
log->Printf("FindExternalLexicalDecls[%u] in '%s' (a %s) with %s predicate",
current_id,
context_named_decl->getNameAsString().c_str(),
context_decl->getDeclKindName(),
(predicate ? "non-null" : "null"));
else if(context_decl)
log->Printf("FindExternalLexicalDecls in a %s with %s predicate",
log->Printf("FindExternalLexicalDecls[%u] in a %s with %s predicate",
current_id,
context_decl->getDeclKindName(),
(predicate ? "non-null" : "null"));
else
log->Printf("FindExternalLexicalDecls in a NULL context with %s predicate",
log->Printf("FindExternalLexicalDecls[%u] in a NULL context with %s predicate",
current_id,
(predicate ? "non-null" : "null"));
}
@ -2575,7 +2581,11 @@ ClangExpressionDeclMap::FindExternalLexicalDecls (const DeclContext *decl_contex
llvm::raw_string_ostream decl_print_stream(decl_print_string);
decl->print(decl_print_stream);
decl_print_stream.flush();
log->Printf(" Adding lexical decl %s", decl_print_string.c_str());
if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
log->Printf(" [%d] Adding [to %s] lexical decl %s", current_id, context_named_decl->getNameAsString().c_str(), decl_print_string.c_str());
else
log->Printf(" [%d] Adding lexical decl %s", current_id, decl_print_string.c_str());
}
Decl *copied_decl = ast_importer->CopyDecl(original_ctx, decl);