Check whether DependentScopeDeclRefExpr's NestedNameSpecifier exists before accessing it, both for consistency (see StmtPrinter::VisitDeclRefExpr()) and for other use cases of dependent types.

llvm-svn: 124119
This commit is contained in:
Axel Naumann 2011-01-24 15:44:00 +00:00
parent fa69024463
commit 20b2786524
1 changed files with 2 additions and 1 deletions

View File

@ -481,7 +481,8 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
void StmtPrinter::VisitDependentScopeDeclRefExpr( void StmtPrinter::VisitDependentScopeDeclRefExpr(
DependentScopeDeclRefExpr *Node) { DependentScopeDeclRefExpr *Node) {
Node->getQualifier()->print(OS, Policy); if (NestedNameSpecifier *Qualifier = Node->getQualifier())
Qualifier->print(OS, Policy);
OS << Node->getNameInfo(); OS << Node->getNameInfo();
if (Node->hasExplicitTemplateArgs()) if (Node->hasExplicitTemplateArgs())
OS << TemplateSpecializationType::PrintTemplateArgumentList( OS << TemplateSpecializationType::PrintTemplateArgumentList(