This revision was automatically updated to reflect the committed changes.
Closed by commit rC343635: [analyzer] Fix crash in exploded graph dumping 
(authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52756?vs=167855&id=168026#toc

Repository:
  rC Clang

https://reviews.llvm.org/D52756

Files:
  lib/Analysis/CFG.cpp
  test/Analysis/dump_egraph.c


Index: lib/Analysis/CFG.cpp
===================================================================
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -2632,15 +2632,12 @@
   for (DeclStmt::reverse_decl_iterator I = DS->decl_rbegin(),
                                        E = DS->decl_rend();
        I != E; ++I) {
-    // Get the alignment of the new DeclStmt, padding out to >=8 bytes.
-    unsigned A = alignof(DeclStmt) < 8 ? 8 : alignof(DeclStmt);
 
     // Allocate the DeclStmt using the BumpPtrAllocator.  It will get
     // automatically freed with the CFG.
     DeclGroupRef DG(*I);
     Decl *D = *I;
-    void *Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);
-    DeclStmt *DSNew = new (Mem) DeclStmt(DG, D->getLocation(), GetEndLoc(D));
+    DeclStmt *DSNew = new (Context) DeclStmt(DG, D->getLocation(), 
GetEndLoc(D));
     cfg->addSyntheticDeclStmt(DSNew, DS);
 
     // Append the fake DeclStmt to block.
Index: test/Analysis/dump_egraph.c
===================================================================
--- test/Analysis/dump_egraph.c
+++ test/Analysis/dump_egraph.c
@@ -5,8 +5,8 @@
 int getJ();
 
 int foo() {
-  int *x = 0;
-  return *x;
+  int *x = 0, *y = 0;
+  return *x + *y;
 }
 
 // CHECK: digraph "Exploded Graph" {


Index: lib/Analysis/CFG.cpp
===================================================================
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -2632,15 +2632,12 @@
   for (DeclStmt::reverse_decl_iterator I = DS->decl_rbegin(),
                                        E = DS->decl_rend();
        I != E; ++I) {
-    // Get the alignment of the new DeclStmt, padding out to >=8 bytes.
-    unsigned A = alignof(DeclStmt) < 8 ? 8 : alignof(DeclStmt);
 
     // Allocate the DeclStmt using the BumpPtrAllocator.  It will get
     // automatically freed with the CFG.
     DeclGroupRef DG(*I);
     Decl *D = *I;
-    void *Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);
-    DeclStmt *DSNew = new (Mem) DeclStmt(DG, D->getLocation(), GetEndLoc(D));
+    DeclStmt *DSNew = new (Context) DeclStmt(DG, D->getLocation(), GetEndLoc(D));
     cfg->addSyntheticDeclStmt(DSNew, DS);
 
     // Append the fake DeclStmt to block.
Index: test/Analysis/dump_egraph.c
===================================================================
--- test/Analysis/dump_egraph.c
+++ test/Analysis/dump_egraph.c
@@ -5,8 +5,8 @@
 int getJ();
 
 int foo() {
-  int *x = 0;
-  return *x;
+  int *x = 0, *y = 0;
+  return *x + *y;
 }
 
 // CHECK: digraph "Exploded Graph" {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to