From 20b27865249861812de4ddd6d112779914a56afe Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Mon, 24 Jan 2011 15:44:00 +0000 Subject: [PATCH] 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 --- clang/lib/AST/StmtPrinter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 4c18a526bbf6..cea3173eb68b 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -481,7 +481,8 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) { void StmtPrinter::VisitDependentScopeDeclRefExpr( DependentScopeDeclRefExpr *Node) { - Node->getQualifier()->print(OS, Policy); + if (NestedNameSpecifier *Qualifier = Node->getQualifier()) + Qualifier->print(OS, Policy); OS << Node->getNameInfo(); if (Node->hasExplicitTemplateArgs()) OS << TemplateSpecializationType::PrintTemplateArgumentList(