Page MenuHomePhabricator

D61060.diff
No OneTemporary

File Metadata

Created
Mon, Sep 16, 9:25 PM

D61060.diff

Index: cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist
===================================================================
--- cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist
+++ cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist
@@ -13,30 +13,30 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
- <key>line</key><integer>7</integer>
- <key>col</key><integer>12</integer>
+ <key>line</key><integer>24</integer>
+ <key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
- <key>line</key><integer>7</integer>
- <key>col</key><integer>12</integer>
+ <key>line</key><integer>24</integer>
+ <key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>7</integer>
- <key>col</key><integer>18</integer>
+ <key>line</key><integer>24</integer>
+ <key>col</key><integer>10</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
- <string>Memory is allocated</string>
+ <string>Attempt to free released memory</string>
<key>message</key>
- <string>Memory is allocated</string>
+ <string>Attempt to free released memory</string>
</dict>
<dict>
<key>kind</key><string>control</string>
@@ -46,26 +46,26 @@
<key>start</key>
<array>
<dict>
- <key>line</key><integer>7</integer>
- <key>col</key><integer>3</integer>
+ <key>line</key><integer>17</integer>
+ <key>col</key><integer>1</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>7</integer>
- <key>col</key><integer>5</integer>
+ <key>line</key><integer>17</integer>
+ <key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
- <key>line</key><integer>9</integer>
+ <key>line</key><integer>18</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>4</integer>
+ <key>line</key><integer>18</integer>
+ <key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
@@ -73,6 +73,35 @@
</array>
</dict>
<dict>
+ <key>kind</key><string>event</string>
+ <key>location</key>
+ <dict>
+ <key>line</key><integer>18</integer>
+ <key>col</key><integer>12</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ <key>ranges</key>
+ <array>
+ <array>
+ <dict>
+ <key>line</key><integer>18</integer>
+ <key>col</key><integer>12</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ <dict>
+ <key>line</key><integer>18</integer>
+ <key>col</key><integer>18</integer>
+ <key>file</key><integer>0</integer>
+ </dict>
+ </array>
+ </array>
+ <key>depth</key><integer>0</integer>
+ <key>extended_message</key>
+ <string>Memory is allocated</string>
+ <key>message</key>
+ <string>Memory is allocated</string>
+ </dict>
+ <dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
@@ -80,26 +109,26 @@
<key>start</key>
<array>
<dict>
- <key>line</key><integer>9</integer>
+ <key>line</key><integer>18</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>4</integer>
+ <key>line</key><integer>18</integer>
+ <key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>7</integer>
+ <key>line</key><integer>20</integer>
+ <key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>7</integer>
+ <key>line</key><integer>20</integer>
+ <key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
@@ -107,34 +136,6 @@
</array>
</dict>
<dict>
- <key>kind</key><string>pop-up</string>
- <key>location</key>
- <dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>7</integer>
- <key>file</key><integer>0</integer>
- </dict>
- <key>ranges</key>
- <array>
- <array>
- <dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>7</integer>
- <key>file</key><integer>0</integer>
- </dict>
- <dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>7</integer>
- <key>file</key><integer>0</integer>
- </dict>
- </array>
- </array>
- <key>extended_message</key>
- <string>&apos;p&apos; is non-null</string>
- <key>message</key>
- <string>&apos;p&apos; is non-null</string>
- </dict>
- <dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
@@ -142,25 +143,25 @@
<key>start</key>
<array>
<dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>7</integer>
+ <key>line</key><integer>20</integer>
+ <key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>9</integer>
- <key>col</key><integer>7</integer>
+ <key>line</key><integer>20</integer>
+ <key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
- <key>line</key><integer>11</integer>
+ <key>line</key><integer>21</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>11</integer>
+ <key>line</key><integer>21</integer>
<key>col</key><integer>10</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -172,7 +173,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
- <key>line</key><integer>11</integer>
+ <key>line</key><integer>21</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -180,12 +181,12 @@
<array>
<array>
<dict>
- <key>line</key><integer>11</integer>
+ <key>line</key><integer>21</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>11</integer>
+ <key>line</key><integer>21</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -205,12 +206,12 @@
<key>start</key>
<array>
<dict>
- <key>line</key><integer>11</integer>
+ <key>line</key><integer>21</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>11</integer>
+ <key>line</key><integer>21</integer>
<key>col</key><integer>10</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -218,12 +219,12 @@
<key>end</key>
<array>
<dict>
- <key>line</key><integer>14</integer>
+ <key>line</key><integer>24</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>14</integer>
+ <key>line</key><integer>24</integer>
<key>col</key><integer>8</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -231,35 +232,6 @@
</dict>
</array>
</dict>
- <dict>
- <key>kind</key><string>event</string>
- <key>location</key>
- <dict>
- <key>line</key><integer>14</integer>
- <key>col</key><integer>3</integer>
- <key>file</key><integer>0</integer>
- </dict>
- <key>ranges</key>
- <array>
- <array>
- <dict>
- <key>line</key><integer>14</integer>
- <key>col</key><integer>3</integer>
- <key>file</key><integer>0</integer>
- </dict>
- <dict>
- <key>line</key><integer>14</integer>
- <key>col</key><integer>10</integer>
- <key>file</key><integer>0</integer>
- </dict>
- </array>
- </array>
- <key>depth</key><integer>0</integer>
- <key>extended_message</key>
- <string>Attempt to free released memory</string>
- <key>message</key>
- <string>Attempt to free released memory</string>
- </dict>
</array>
<key>description</key><string>Attempt to free released memory</string>
<key>category</key><string>Memory error</string>
@@ -269,10 +241,10 @@
<key>issue_hash_content_of_line_in_context</key><string>bd8e324d09c70b9e2be6f824a4942e5a</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>test</string>
- <key>issue_hash_function_offset</key><string>8</string>
+ <key>issue_hash_function_offset</key><string>7</string>
<key>location</key>
<dict>
- <key>line</key><integer>14</integer>
+ <key>line</key><integer>24</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -280,11 +252,11 @@
<dict>
<key>0</key>
<array>
- <integer>6</integer>
- <integer>7</integer>
- <integer>9</integer>
- <integer>11</integer>
- <integer>14</integer>
+ <integer>17</integer>
+ <integer>18</integer>
+ <integer>20</integer>
+ <integer>21</integer>
+ <integer>24</integer>
</array>
</dict>
</dict>
@@ -295,7 +267,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -303,12 +275,12 @@
<array>
<array>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -324,7 +296,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
- <key>line</key><integer>19</integer>
+ <key>line</key><integer>29</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -342,12 +314,12 @@
<key>start</key>
<array>
<dict>
- <key>line</key><integer>19</integer>
+ <key>line</key><integer>29</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>19</integer>
+ <key>line</key><integer>29</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -355,12 +327,12 @@
<key>end</key>
<array>
<dict>
- <key>line</key><integer>20</integer>
+ <key>line</key><integer>30</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>20</integer>
+ <key>line</key><integer>30</integer>
<key>col</key><integer>8</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -372,7 +344,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
- <key>line</key><integer>20</integer>
+ <key>line</key><integer>30</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -380,12 +352,12 @@
<array>
<array>
<dict>
- <key>line</key><integer>20</integer>
+ <key>line</key><integer>30</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>20</integer>
+ <key>line</key><integer>30</integer>
<key>col</key><integer>13</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -401,7 +373,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -409,12 +381,12 @@
<array>
<array>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -434,12 +406,12 @@
<key>start</key>
<array>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>25</integer>
+ <key>line</key><integer>35</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -447,12 +419,12 @@
<key>end</key>
<array>
<dict>
- <key>line</key><integer>27</integer>
+ <key>line</key><integer>37</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>27</integer>
+ <key>line</key><integer>37</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -464,7 +436,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
- <key>line</key><integer>27</integer>
+ <key>line</key><integer>37</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -472,12 +444,12 @@
<array>
<array>
<dict>
- <key>line</key><integer>27</integer>
+ <key>line</key><integer>37</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
- <key>line</key><integer>27</integer>
+ <key>line</key><integer>37</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -501,7 +473,7 @@
<key>issue_hash_function_offset</key><string>3</string>
<key>location</key>
<dict>
- <key>line</key><integer>27</integer>
+ <key>line</key><integer>37</integer>
<key>col</key><integer>2</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -509,11 +481,11 @@
<dict>
<key>0</key>
<array>
- <integer>19</integer>
- <integer>20</integer>
- <integer>24</integer>
- <integer>25</integer>
- <integer>27</integer>
+ <integer>29</integer>
+ <integer>30</integer>
+ <integer>34</integer>
+ <integer>35</integer>
+ <integer>37</integer>
</array>
</dict>
</dict>
Index: cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
===================================================================
--- cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
+++ cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
@@ -1,13 +1,23 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus.NewDelete,unix.Malloc -analyzer-output=text -verify %s
-// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus.NewDelete,unix.Malloc -analyzer-output=text -analyzer-config c++-allocator-inlining=true -verify %s
-// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus.NewDelete,unix.Malloc -analyzer-output=plist %s -o %t.plist
-// RUN: cat %t.plist | %diff_plist %S/Inputs/expected-plists/NewDelete-path-notes.cpp.plist -
+// RUN: %clang_analyze_cc1 \
+// RUN: -analyzer-checker=cplusplus.NewDelete,unix.Malloc \
+// RUN: -analyzer-config add-pop-up-notes=false \
+// RUN: -analyzer-output=text -verify %s
+// RUN: %clang_analyze_cc1 \
+// RUN: -analyzer-checker=cplusplus.NewDelete,unix.Malloc \
+// RUN: -analyzer-config c++-allocator-inlining=true \
+// RUN: -analyzer-config add-pop-up-notes=false \
+// RUN: -analyzer-output=text -verify %s
+// RUN: %clang_analyze_cc1 \
+// RUN: -analyzer-checker=cplusplus.NewDelete,unix.Malloc \
+// RUN: -analyzer-config add-pop-up-notes=false \
+// RUN: -analyzer-output=plist %s -o %t.plist
+// RUN: cat %t.plist | %diff_plist \
+// RUN: %S/Inputs/expected-plists/NewDelete-path-notes.cpp.plist -
void test() {
int *p = new int;
// expected-note@-1 {{Memory is allocated}}
- if (p) // expected-note {{'p' is non-null}}
- // expected-note@-1 {{Taking true branch}}
+ if (p) // expected-note {{Taking true branch}}
delete p;
// expected-note@-1 {{Memory is released}}

Event Timeline