r216691 - Don't create a null reference to NestedNameSpecifier.

Alexey Samsonov vonosmas at gmail.com
Thu Aug 28 15:18:43 PDT 2014


Author: samsonov
Date: Thu Aug 28 17:18:42 2014
New Revision: 216691

URL: http://llvm.org/viewvc/llvm-project?rev=216691&view=rev
Log:
Don't create a null reference to NestedNameSpecifier.

This bug was reported by UBSan.

Modified:
    cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp

Modified: cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp?rev=216691&r1=216690&r2=216691&view=diff
==============================================================================
--- cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/ASTMatchFinder.cpp Thu Aug 28 17:18:42 2014
@@ -731,7 +731,8 @@ bool MatchASTVisitor::TraverseNestedName
   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<MatchASTVisitor>::TraverseNestedNameSpecifierLoc(NNS);
 }





More information about the cfe-commits mailing list