Fixed a crash in logging when the name of an

entity imported by the ASTImporter had a NamedDecl
with a name that wasn't a plain string (e.g., a
selector).

llvm-svn: 157488
This commit is contained in:
Sean Callanan 2012-05-25 18:12:26 +00:00
parent 4d78c40825
commit 48e894bdc9
1 changed files with 6 additions and 1 deletions

View File

@ -431,10 +431,15 @@ clang::Decl
{
if (NamedDecl *from_named_decl = dyn_cast<clang::NamedDecl>(from))
{
std::string name_string;
llvm::raw_string_ostream name_stream(name_string);
from_named_decl->printName(name_stream);
name_stream.flush();
log->Printf(" [ClangASTImporter] Imported (%sDecl*)%p, named %s (from (Decl*)%p), metadata 0x%llx",
from->getDeclKindName(),
to,
from_named_decl->getName().str().c_str(),
name_string.c_str(),
from,
m_master.GetDeclMetadata(from));
}