Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-18 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Thanks for the fix! We'll commit shortly.


Repository:
  rL LLVM

http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-18 Thread Ismail Pazarbasi via cfe-commits
ismailp added a comment.

Thank you for reviewing!


Repository:
  rL LLVM

http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-18 Thread Ismail Pazarbasi via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248050: Analyzer: Fix a crasher in UbigraphViz (authored by 
ismailp).

Changed prior to commit:
  http://reviews.llvm.org/D12119?vs=35141=35142#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12119

Files:
  cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  cfe/trunk/test/Analysis/ubigraph-viz.cpp

Index: cfe/trunk/test/Analysis/ubigraph-viz.cpp
===
--- cfe/trunk/test/Analysis/ubigraph-viz.cpp
+++ cfe/trunk/test/Analysis/ubigraph-viz.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.API 
-analyzer-viz-egraph-ubigraph -verify %s
+// expected-no-diagnostics
+
+int f(int x) {
+  return x < 0 ? 0 : 42;
+}
+
Index: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -778,8 +778,9 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"


Index: cfe/trunk/test/Analysis/ubigraph-viz.cpp
===
--- cfe/trunk/test/Analysis/ubigraph-viz.cpp
+++ cfe/trunk/test/Analysis/ubigraph-viz.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.API -analyzer-viz-egraph-ubigraph -verify %s
+// expected-no-diagnostics
+
+int f(int x) {
+  return x < 0 ? 0 : 42;
+}
+
Index: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -778,8 +778,9 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-17 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

I see, Maybe we should add a new test file to test this instead of adding it to 
an existing test.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-17 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

Otherwise, LGTM.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-15 Thread Ismail Pazarbasi via cfe-commits
ismailp added a comment.

I don't have ubigraph installed either. The purpose of the test isn't to check 
as to whether we can generate a conforming/sensible ubigraph output, but to 
ensure that this tiny patch works and clang doesn't crash. So, I'd keep it. But 
if you are worried about other/unknown problems in ubigraph generator that the 
test might surface, then we can proceed without the test, and a ubigraph expert 
can write an output validation test.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-14 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: test/Analysis/free.c:1
@@ -1,2 +1,2 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -analyzer-viz-egraph-ubigraph 
-verify %s
 // RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -verify -analyzer-config 
unix.Malloc:Optimistic=true %s

I am not sure how to best test ubigraph, but adding it to an existing test is 
not  great. Some builedbot machines might not have ubigraph installed.

I suggest to commit the fix without any changes to the tests and investigate 
how it can be tested later on.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-04 Thread Ismail Pazarbasi via cfe-commits
ismailp updated this revision to Diff 34082.
ismailp added a comment.

- Rolled back to the first version of patch, where only parameter `Out` is 
renamed to `OutStream`
- Use a different test that doesn't trigger the self-loop assertion.


http://reviews.llvm.org/D12119

Files:
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/free.c

Index: test/Analysis/free.c
===
--- test/Analysis/free.c
+++ test/Analysis/free.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -analyzer-viz-egraph-ubigraph 
-verify %s
 // RUN: %clang_cc1 -analyze -analyzer-store=region 
-analyzer-checker=core,unix.Malloc -fblocks -verify -analyzer-config 
unix.Malloc:Optimistic=true %s
 typedef __typeof(sizeof(int)) size_t;
 void free(void *);
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -778,8 +778,9 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"


Index: test/Analysis/free.c
===
--- test/Analysis/free.c
+++ test/Analysis/free.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -analyzer-viz-egraph-ubigraph -verify %s
 // RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.Malloc -fblocks -verify -analyzer-config unix.Malloc:Optimistic=true %s
 typedef __typeof(sizeof(int)) size_t;
 void free(void *);
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -778,8 +778,9 @@
<< ", ('arrow','true'), ('oriented', 'true'))\n";
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptr Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptr OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out << "('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n";
   *Out << "('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-09-03 Thread Ismail Pazarbasi via cfe-commits
ismailp added a comment.

Ping!


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-22 Thread Ismail Pazarbasi via cfe-commits
ismailp updated this revision to Diff 32903.
ismailp added a comment.

- Change parameter name to `OutStream`.


http://reviews.llvm.org/D12119

Files:
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/cfg.cpp

Index: test/Analysis/cfg.cpp
===
--- test/Analysis/cfg.cpp
+++ test/Analysis/cfg.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple 
x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -std=c++11 %s  
%t 21
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple 
x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true 
-analyzer-viz-egraph-ubigraph -std=c++11 %s  %t 21
 // RUN: FileCheck --input-file=%t %s
 
 // CHECK-LABEL: void checkWrap(int i)
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -745,9 +745,6 @@
 }
 
 void UbigraphViz::AddEdge(ExplodedNode *Src, ExplodedNode *Dst) {
-
-  assert (Src != Dst  Self-edges are not allowed.);
-
   // Lookup the Src.  If it is a new node, it's a root.
   VMap::iterator SrcI= M.find(Src);
   unsigned SrcID;
@@ -778,8 +775,9 @@
 , ('arrow','true'), ('oriented', 'true'))\n;
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
   *Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),


Index: test/Analysis/cfg.cpp
===
--- test/Analysis/cfg.cpp
+++ test/Analysis/cfg.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -std=c++11 %s  %t 21
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -analyzer-viz-egraph-ubigraph -std=c++11 %s  %t 21
 // RUN: FileCheck --input-file=%t %s
 
 // CHECK-LABEL: void checkWrap(int i)
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -745,9 +745,6 @@
 }
 
 void UbigraphViz::AddEdge(ExplodedNode *Src, ExplodedNode *Dst) {
-
-  assert (Src != Dst  Self-edges are not allowed.);
-
   // Lookup the Src.  If it is a new node, it's a root.
   VMap::iterator SrcI= M.find(Src);
   unsigned SrcID;
@@ -778,8 +775,9 @@
 , ('arrow','true'), ('oriented', 'true'))\n;
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream OutStream,
+ StringRef Filename)
+: Out(std::move(OutStream)), Filename(Filename), Cntr(0) {
 
   *Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
   *Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-22 Thread Ismail Pazarbasi via cfe-commits
ismailp added inline comments.


Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:749
@@ -748,3 @@
-
-  assert (Src != Dst  Self-edges are not allowed.);
-

krememek wrote:
 Did you look at the test case that causes this assertion to fail?  I think it 
 would be good to know if this assertion is actually safe to remove.  I'm a 
 bit skeptical that it is safe to remove, and that (per my last review) that 
 this may be detecting that an invariant is getting violated.  If you are not 
 certain how to investigate that part, please report which test is triggering 
 the problem and myself or someone else familiar with the engine core can take 
 a look.  Thanks.
There wasn't a test that checks Ubigraph generator. After making the patch 
below, I picked a few existing tests, and added '-analyzer-viz-egraph-ubigraph' 
to their RUN lines. Then, I ran lit.py, and 'tests/Analysis/cfg.cpp' has 
crashed. I have minimized the test case to understand the problem.

Self-loop happens during implicit destructor of `Aggregate` in the following 
minimized test case:
```
  struct LifetimeExtend { LifetimeExtend(int); ~LifetimeExtend(); };
  struct Aggregate { const LifetimeExtend a; const LifetimeExtend b; };
  void test_lifetime_extended_temporaries() {
{
  Aggregate aggregate{LifetimeExtend(4), LifetimeExtend(4)};
  4;
}
  }
```
The destructor of `a` has a self-loop. My hypothesis is that `a` and `b` have 
the same `ProgramState`s. `b`'s destructor is visited first, since it's 
destroyed first. When destructor of `a` gets visited, analyzer calls 
`ProgramState::Profile` and finds the same state as `b`'s destructor. 
Therefore, both `a`'s destructor and `b`'s destructor have the same 
`ExplodedNode`. Do you think this is correct?

I have added -analyzer-viz-egraph-ubigraph to a few more C++ tests. I didn't 
observe any crash. However, I didn't verify that it generates correct ubigraph 
output.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-21 Thread Ted Kremenek via cfe-commits
krememek added inline comments.


Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:749
@@ -748,3 @@
-
-  assert (Src != Dst  Self-edges are not allowed.);
-

Did you look at the test case that causes this assertion to fail?  I think it 
would be good to know if this assertion is actually safe to remove.  I'm a bit 
skeptical that it is safe to remove, and that (per my last review) that this 
may be detecting that an invariant is getting violated.  If you are not certain 
how to investigate that part, please report which test is triggering the 
problem and myself or someone else familiar with the engine core can take a 
look.  Thanks.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-21 Thread Ted Kremenek via cfe-commits
krememek added inline comments.


Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:778
@@ -780,3 +777,3 @@
 
-UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Stm, StringRef Filename)
+: Out(std::move(Stm)), Filename(Filename), Cntr(0) {

While succinct, I think 'Stm' is an actively harmful name as it conveys no 
meaning.  There's no need to hyper optimize here.

How about 'outStream', or something that clearly indicates what it is.

You're only going to use it twice.  No harm in spelling it out.  'Stm' could 
mean a bunch of things.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-20 Thread Ismail Pazarbasi via cfe-commits
ismailp updated this revision to Diff 32745.
ismailp added a comment.

- Renamed `Out` parameter to `Stm`.
- Removed assertion that checks whether an ExplodedNode has an edge to itself.
- Added '-analyzer-viz-egraph-ubigraph' to an analyzer invocation in a test.


http://reviews.llvm.org/D12119

Files:
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/cfg.cpp

Index: test/Analysis/cfg.cpp
===
--- test/Analysis/cfg.cpp
+++ test/Analysis/cfg.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple 
x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -std=c++11 %s  
%t 21
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple 
x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true 
-analyzer-viz-egraph-ubigraph -std=c++11 %s  %t 21
 // RUN: FileCheck --input-file=%t %s
 
 // CHECK-LABEL: void checkWrap(int i)
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -745,9 +745,6 @@
 }
 
 void UbigraphViz::AddEdge(ExplodedNode *Src, ExplodedNode *Dst) {
-
-  assert (Src != Dst  Self-edges are not allowed.);
-
   // Lookup the Src.  If it is a new node, it's a root.
   VMap::iterator SrcI= M.find(Src);
   unsigned SrcID;
@@ -778,8 +775,8 @@
 , ('arrow','true'), ('oriented', 'true'))\n;
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Stm, StringRef Filename)
+: Out(std::move(Stm)), Filename(Filename), Cntr(0) {
 
   *Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
   *Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),


Index: test/Analysis/cfg.cpp
===
--- test/Analysis/cfg.cpp
+++ test/Analysis/cfg.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -std=c++11 %s  %t 21
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -analyzer-config cfg-temporary-dtors=true -analyzer-viz-egraph-ubigraph -std=c++11 %s  %t 21
 // RUN: FileCheck --input-file=%t %s
 
 // CHECK-LABEL: void checkWrap(int i)
Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -745,9 +745,6 @@
 }
 
 void UbigraphViz::AddEdge(ExplodedNode *Src, ExplodedNode *Dst) {
-
-  assert (Src != Dst  Self-edges are not allowed.);
-
   // Lookup the Src.  If it is a new node, it's a root.
   VMap::iterator SrcI= M.find(Src);
   unsigned SrcID;
@@ -778,8 +775,8 @@
 , ('arrow','true'), ('oriented', 'true'))\n;
 }
 
-UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Out, StringRef Filename)
-: Out(std::move(Out)), Filename(Filename), Cntr(0) {
+UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Stm, StringRef Filename)
+: Out(std::move(Stm)), Filename(Filename), Cntr(0) {
 
   *Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
   *Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-18 Thread Ted Kremenek via cfe-commits
krememek added inline comments.


Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:784
@@ -783,3 +783,3 @@
 
-  *Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
-  *Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),
+  *this-Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
+  *this-Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', 
'#ffcc66'),

This seems really brittle.

Can we just rename the parameter 'Out' to something else, and then just use 
'Out'?  Seems more reasonable to rename the parameter than to change every 
single functional line of code that uses 'Out'.


http://reviews.llvm.org/D12119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D12119: Analyzer: Fix a crasher in UbigraphViz

2015-08-18 Thread Ismail Pazarbasi via cfe-commits
ismailp created this revision.
ismailp added reviewers: zaks.anna, krememek.
ismailp added a subscriber: cfe-commits.

Name `Out` refers to the parameter. It is moved into the member `Out`
in ctor-init. Dereferencing null pointer will crash clang, if user
passes '-analyzer-viz-egraph-ubigraph' argument.

http://reviews.llvm.org/D12119

Files:
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -781,8 +781,8 @@
 UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Out, StringRef Filename)
 : Out(std::move(Out)), Filename(Filename), Cntr(0) {
 
-  *Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
-  *Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),
+  *this-Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
+  *this-Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', 
'#ffcc66'),
('size', '1.5'))\n;
 }
 


Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
===
--- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -781,8 +781,8 @@
 UbigraphViz::UbigraphViz(std::unique_ptrraw_ostream Out, StringRef Filename)
 : Out(std::move(Out)), Filename(Filename), Cntr(0) {
 
-  *Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
-  *Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),
+  *this-Out  ('vertex_style_attribute', 0, ('shape', 'icosahedron'))\n;
+  *this-Out  ('vertex_style', 1, 0, ('shape', 'sphere'), ('color', '#ffcc66'),
('size', '1.5'))\n;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits