[PATCH] D37978: [analyzer] Fix an assertion fail in VirtualCallChecker

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 21 01:20:42 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL313866: [analyzer] Fix an assertion fail in VirtualCallChecker (authored by xazax).

Changed prior to commit:
  https://reviews.llvm.org/D37978?vs=115656&id=116145#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37978

Files:
  cfe/trunk/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
  cfe/trunk/test/Analysis/virtualcall.cpp


Index: cfe/trunk/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
@@ -146,7 +146,7 @@
     if (CME->getQualifier())
       CallIsNonVirtual = true;
 
-    if (const Expr *Base = CME->getBase()->IgnoreImpCasts()) {
+    if (const Expr *Base = CME->getBase()) {
       // The most derived class is marked final.
       if (Base->getBestDynamicClassType()->hasAttr<FinalAttr>())
         CallIsNonVirtual = true;
Index: cfe/trunk/test/Analysis/virtualcall.cpp
===================================================================
--- cfe/trunk/test/Analysis/virtualcall.cpp
+++ cfe/trunk/test/Analysis/virtualcall.cpp
@@ -271,3 +271,24 @@
 #if !PUREONLY
 	//expected-note-re at -2 2{{{{^}}Calling '~E'}}
 #endif
+
+namespace PR34451 {
+struct a {
+  void b() {
+    a c[1];
+    c->b();
+  }
+};
+
+class e {
+ public:
+  void b() const;
+};
+
+class c {
+  void m_fn2() const;
+  e d[];
+};
+
+void c::m_fn2() const { d->b(); }
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37978.116145.patch
Type: text/x-patch
Size: 1124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170921/e8aa46ba/attachment.bin>


More information about the cfe-commits mailing list