From: Alexey Samsonov Date: Thu, 28 Aug 2014 22:18:42 +0000 (+0000) Subject: Don't create a null reference to NestedNameSpecifier. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=232eaaf3b6e46cf80d992e68b6db8313eff3b694;p=clang Don't create a null reference to NestedNameSpecifier. This bug was reported by UBSan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216691 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index 050630fd4b..6c5bc3c372 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/lib/ASTMatchers/ASTMatchFinder.cpp @@ -731,7 +731,8 @@ bool MatchASTVisitor::TraverseNestedNameSpecifierLoc( match(NNS); // We only match the nested name specifier here (as opposed to traversing it) // because the traversal is already done in the parallel "Loc"-hierarchy. - match(*NNS.getNestedNameSpecifier()); + if (NNS.hasQualifier()) + match(*NNS.getNestedNameSpecifier()); return RecursiveASTVisitor::TraverseNestedNameSpecifierLoc(NNS); }