llvm-project/clang/test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1771 lines
52 KiB
Plaintext
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>clang_version</key>
<key>diagnostics</key>
<array>
<dict>
<key>path</key>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;p&apos; is null</string>
<key>message</key>
<string>Assuming &apos;p&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>20</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>20</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>20</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>20</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>8</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>&apos;x&apos; initialized to a null pointer value</string>
<key>message</key>
<string>&apos;x&apos; initialized to a null pointer value</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>6</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer (loaded from variable &apos;x&apos;)</string>
<key>message</key>
<string>Dereference of null pointer (loaded from variable &apos;x&apos;)</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer (loaded from variable &apos;x&apos;)</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>8ea3f4e6a3100c73f078fac15acb0a9c</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testCondOp</string>
<key>issue_hash_function_offset</key><string>5</string>
<key>location</key>
<dict>
<key>line</key><integer>10</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>5</integer>
<integer>6</integer>
<integer>10</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;p&apos; is null</string>
<key>message</key>
<string>Assuming &apos;p&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>15</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>2c219a33e961fc1be7d54b700867259e</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testCondProblem</string>
<key>issue_hash_function_offset</key><string>5</string>
<key>location</key>
<dict>
<key>line</key><integer>19</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>14</integer>
<integer>15</integer>
<integer>19</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;p&apos; is null</string>
<key>message</key>
<string>Assuming &apos;p&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>16</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>16</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>16</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>17</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>17</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>8d43b511137326eab7d1242950e72984</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testLHSProblem</string>
<key>issue_hash_function_offset</key><string>1</string>
<key>location</key>
<dict>
<key>line</key><integer>25</integer>
<key>col</key><integer>16</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>24</integer>
<integer>25</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;p&apos; is null</string>
<key>message</key>
<string>Assuming &apos;p&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>19</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>19</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>19</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>20</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>20</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>b8e93b7355a6779a960f9a942fafac15</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testRHSProblem</string>
<key>issue_hash_function_offset</key><string>1</string>
<key>location</key>
<dict>
<key>line</key><integer>33</integer>
<key>col</key><integer>19</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>32</integer>
<integer>33</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>41</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>41</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>41</integer>
<key>col</key><integer>8</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>&apos;x&apos; initialized to a null pointer value</string>
<key>message</key>
<string>&apos;x&apos; initialized to a null pointer value</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>41</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>41</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer (loaded from variable &apos;x&apos;)</string>
<key>message</key>
<string>Dereference of null pointer (loaded from variable &apos;x&apos;)</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer (loaded from variable &apos;x&apos;)</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>a944281d096940ca43ec995649b48b5f</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testBinaryCondOp</string>
<key>issue_hash_function_offset</key><string>4</string>
<key>location</key>
<dict>
<key>line</key><integer>44</integer>
<key>col</key><integer>6</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>40</integer>
<integer>41</integer>
<integer>44</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;p&apos; is null</string>
<key>message</key>
<string>Assuming &apos;p&apos; is null</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>49</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>message</key>
<string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>4db164bbf5cea42d75c5e838be1eef6f</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testBinaryLHSProblem</string>
<key>issue_hash_function_offset</key><string>5</string>
<key>location</key>
<dict>
<key>line</key><integer>53</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>48</integer>
<integer>49</integer>
<integer>53</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;a&apos; is not equal to 0</string>
<key>message</key>
<string>Assuming &apos;a&apos; is not equal to 0</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>59</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>26</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer</string>
<key>message</key>
<string>Dereference of null pointer</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>778d56ad485369222613ac2c03b97700</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testDiagnosableBranch</string>
<key>issue_hash_function_offset</key><string>4</string>
<key>location</key>
<dict>
<key>line</key><integer>62</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>58</integer>
<integer>59</integer>
<integer>62</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;a&apos; is not equal to 0</string>
<key>message</key>
<string>Assuming &apos;a&apos; is not equal to 0</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming &apos;b&apos; is not equal to 0</string>
<key>message</key>
<string>Assuming &apos;b&apos; is not equal to 0</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>68</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>26</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer</string>
<key>message</key>
<string>Dereference of null pointer</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>a2b345c9681d9dd3aa15d12810759cb9</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testDiagnosableBranchLogical</string>
<key>issue_hash_function_offset</key><string>6</string>
<key>location</key>
<dict>
<key>line</key><integer>73</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>67</integer>
<integer>68</integer>
<integer>73</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
<dict>
<key>path</key>
<array>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Assuming the condition is true</string>
<key>message</key>
<string>Assuming the condition is true</string>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>79</integer>
<key>col</key><integer>7</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>control</string>
<key>edges</key>
<array>
<dict>
<key>start</key>
<array>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<key>end</key>
<array>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</dict>
</array>
</dict>
<dict>
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ranges</key>
<array>
<array>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>5</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>26</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
</array>
<key>depth</key><integer>0</integer>
<key>extended_message</key>
<string>Dereference of null pointer</string>
<key>message</key>
<string>Dereference of null pointer</string>
</dict>
</array>
<key>description</key><string>Dereference of null pointer</string>
<key>category</key><string>Logic error</string>
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>f56671e5f67c73abef619b56f7c29fa4</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testNonDiagnosableBranchArithmetic</string>
<key>issue_hash_function_offset</key><string>4</string>
<key>location</key>
<dict>
<key>line</key><integer>82</integer>
<key>col</key><integer>24</integer>
<key>file</key><integer>0</integer>
</dict>
<key>ExecutedLines</key>
<dict>
<key>0</key>
<array>
<integer>78</integer>
<integer>79</integer>
<integer>82</integer>
</array>
</dict>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
</array>
<key>files</key>
<array>
</array>
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck Some of the analyzer tests check the exact plist output, in order to verify that the diagnostics produced is correct. Current testing setup has many issues: plist output clobbers tests, making them harder to read it is impossible to debug test failures given error messages from FileCheck. The only recourse is manually creating the files and using the diff again, it is impossible to update the tests given the error message: the only process is a tedious manual one, going from a separate plist file to CHECK directives. This patch offers a much better approach of using "diff" directly in place of FileCheck, and moving tests to separate files. Generated using the following script: ``` import os import glob import re import subprocess diagnostics_key = "// CHECK: <key>diagnostics</key>" def process_file(f, data): idx = data.index(diagnostics_key) plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f)) plist_data = data[idx:] plist_data = plist_data.replace('// CHECK: ', '') plist_data = plist_data.replace('// CHECK-NEXT: ', '') plist_data += "</dict>\n</plist>\n" data = data[:idx] ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s") if not ptn.findall(data): print "none found =/ skipping..." return data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data) with open(f, 'w') as out_f: out_f.write(data) subprocess.check_call(["mkdir", "-p", plist_out_folder]) with open(plist_out_f, 'w') as out_f: out_f.write(plist_data) def main(): files = glob.glob("**/*.*") for f in files: with open(f) as f_handler: data = f_handler.read() if diagnostics_key in data: print "Converting %s" %f process_file(f, data) if __name__ == "__main__": main() ``` Differential Revision: https://reviews.llvm.org/D50545 llvm-svn: 339475
2018-08-11 05:36:45 +08:00
</dict>
</plist>