summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/inlining/eager-reclamation-path-notes.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reapply r362994 & co "[analyzer][tests] Add normalize_plist to replace ↵Hubert Tong2019-06-111-1/+1
| | | | | | | | | | | diff_plist" Following r363007, which reverted r362998, r362996, and r362994, reapply with adjustments for the CRLF differences encountered with Windows. Namely, the `-b` option of `diff` is employed, and the `grep` patterns have `$` replaced with `[[:space:]]*$`. llvm-svn: 363069
* Revert r362994 & co "[analyzer][tests] Add normalize_plist to replace ↵Reid Kleckner2019-06-101-1/+1
| | | | | | | | | | | diff_plist" Reverts r362998, r362996, and r362994 because the tests do not pass on Windows due to CRLF changes. Adding back `-w` to diff is not enough, the new grep substitution doesn't work on Windows, and fixing it is non-trivial. llvm-svn: 363007
* [analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)Hubert Tong2019-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The `%diff_plist` lit substitution invokes `diff` with a non-portable `-I` option. The intended effect can be achieved by normalizing the inputs to `diff` beforehand. Such normalization can be done with `grep -Ev`, which is also used by other tests. This patch applies the change (adjusted for review comments) described in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html mechanically to the cases where the output file is piped to `%diff_plist` via `cat`. The changes were applied via a script, except that `clang/test/Analysis/NewDelete-path-notes.cpp` and `clang/test/Analysis/plist-macros-with-expansion.cpp` were each adjusted for the line-continuation on the relevant `RUN` step. Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62950 llvm-svn: 362996
* [analyzer] [NFC] Reverse the argument order for "diff" in testsGeorge Karpenkov2019-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The current argument order has "expected" and "actual" the wrong way around, so that the diff shows the change from expected to actual, not from actual to expected. Namely, if the expected diagnostics contains the string "foo", but the analyzer emits "bar", we really want to see: ``` - foo + bar ``` not ``` - bar + foo ``` since adapting to most changes would require applying that diff to the expected output. Differential Revision: https://reviews.llvm.org/D56340 llvm-svn: 350866
* [Analyzer] Define and use diff_plist in tests, NFCMikhail Maltsev2018-09-171-1/+1
| | | | | | | | | This patch defines a new substitution and uses it to reduce duplication in the Clang Analyzer test cases. Differential Revision: https://reviews.llvm.org/D52036 llvm-svn: 342365
* [analyzer] [NFC] Change the tests by making the version check more resilientGeorge Karpenkov2018-09-111-1/+1
| | | | llvm-svn: 341978
* Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist ↵George Karpenkov2018-09-071-1/+1
| | | | | | | | | | output, update tests"""" This reverts commit 2f5d71d9fa135be86bb299e7d773036e50bf1df6. Hopefully fixing tests on Windows. llvm-svn: 341719
* Revert "Revert "Revert "[analyzer] Add coverage information to plist output, ↵Simon Pilgrim2018-09-071-1/+1
| | | | | | | | update tests""" Reverts analyzer tests from rL341627 again as they still broke windows buildbots llvm-svn: 341648
* Revert "Revert "[analyzer] Add coverage information to plist output, update ↵George Karpenkov2018-09-071-1/+1
| | | | | | | | | | tests"" This reverts commit a39bcab414dd7ace7e490363ecdf01ecce7743fc. Reverting the revert, fixing tests. llvm-svn: 341627
* Move test inputs into Inputs directory.Richard Smith2018-08-141-1/+1
| | | | | | | We don't need a new ExpectedOutputs/ convention. Expected outputs are just another form of test input. llvm-svn: 339634
* [analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate ↵George Karpenkov2018-08-101-353/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [analyzer] [NFC] Remove unused Extensive diagnostic setting,George Karpenkov2018-06-121-1/+1
| | | | | | | | | | | | | | Rename AlternateExtensive to Extensive. In 2013, five years ago, we have switched to AlternateExtensive diagnostics by default, and Extensive was available under unused, undocumented flag. This change remove the flag, renames the Alternate diagnostic to Extensive (as it's no longer Alternate), and ports the test. Differential Revision: https://reviews.llvm.org/D47670 llvm-svn: 334524
* Reland 4: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-03-031-2/+2
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296895
* Revert "Reland 3: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen2017-03-021-2/+2
| | | | | | | | multiple constraint managers" This reverts commit ea36f1406e1f36bf456c3f3929839b024128e468. llvm-svn: 296841
* Reland 3: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-03-021-2/+2
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296837
* Revert "Reland 2: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen2017-03-021-2/+2
| | | | | | | | multiple constraint managers" This reverts commit f93343c099fff646a2314cc7f4925833708298b1. llvm-svn: 296836
* Reland 2: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-03-021-2/+2
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296835
* Revert "Reland: [analyzer] NFC: Update test infrastructure to support ↵Dominic Chen2017-02-281-2/+2
| | | | | | | | multiple constraint managers" This reverts commit 1b28d0b10e1c8feccb971abb6ef7a18bee589830. llvm-svn: 296422
* Reland: [analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-02-281-2/+2
| | | | | | | | | | | | | | constraint managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296414
* Revert "[analyzer] NFC: Update test infrastructure to support multiple ↵Dominic Chen2017-02-271-2/+2
| | | | | | | | constraint managers" This reverts commit 8e7780b9e59ddaad1800baf533058d2c064d4787. llvm-svn: 296317
* [analyzer] NFC: Update test infrastructure to support multiple constraint ↵Dominic Chen2017-02-271-2/+2
| | | | | | | | | | | | | | managers Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952. Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D30373 llvm-svn: 296312
* [analyzer] Bug identificationGabor Horvath2015-10-221-1/+3
| | | | | | | | | | | | | | | | This patch adds hashes to the plist and html output to be able to identfy bugs for suppressing false positives or diff results against a baseline. This hash aims to be resilient for code evolution and is usable to identify bugs in two different snapshots of the same software. One missing piece however is a permanent unique identifier of the checker that produces the warning. Once that issue is resolved, the hashes generated are going to change. Until that point this feature is marked experimental, but it is suitable for early adoption. Differential Revision: http://reviews.llvm.org/D10305 Original patch by: Bence Babati! llvm-svn: 251011
* [Static Analyzer] The name of the checker that reports a bug is addedGabor Horvath2015-02-091-0/+1
| | | | | | | | | | | to the plist output. This check_name field does not guaranteed to be the same as the name of the checker in the future. Reviewer: Anna Zaks Differential Revision: http://reviews.llvm.org/D6841 llvm-svn: 228624
* [analyzer] Enable the new edge algorithm by default.Jordan Rose2013-06-031-1/+1
| | | | | | | | | ...but don't yet migrate over the existing plist tests. Some of these would be trivial to migrate; others could use a bit of inspection first. In any case, though, the new edge algorithm seems to have proven itself, and we'd like more coverage (and more usage) of it going forwards. llvm-svn: 183165
* [analyzer] Show "Returning from ..." note at caller's depth, not callee's.Jordan Rose2013-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Before: 1. Calling 'foo' 2. Doing something interesting 3. Returning from 'foo' 4. Some kind of error here After: 1. Calling 'foo' 2. Doing something interesting 3. Returning from 'foo' 4. Some kind of error here The location of the note is already in the caller, not the callee, so this just brings the "depth" attribute in line with that. This only affects plist diagnostic consumers (i.e. Xcode). It's necessary for Xcode to associate the control flow arrows with the right stack frame. <rdar://problem/13634363> llvm-svn: 179351
* [analyzer] Don't emit extra context arrow after returning from an inlined call.Jordan Rose2013-04-121-34/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this code int getZero() { return 0; } void test() { int problem = 1 / getZero(); // expected-warning {{Division by zero}} } we generate these arrows: +-----------------+ | v int problem = 1 / getZero(); ^ | +---+ where the top one represents the control flow up to the first call, and the bottom one represents the flow to the division.* It turns out, however, that we were generating the top arrow twice, as if attempting to "set up context" after we had already returned from the call. This resulted in poor highlighting in Xcode. * Arguably the best location for the division is the '/', but that's a different problem. <rdar://problem/13326040> llvm-svn: 179350
* [analyzer] Look for lvalue nodes when tracking a null pointer.Jordan Rose2013-03-081-0/+419
r176010 introduced the notion of "interesting" lvalue expressions, whose nodes are guaranteed never to be reclaimed by the ExplodedGraph. This was used in bugreporter::trackNullOrUndefValue to find the region that contains the null or undef value being tracked. However, the /rvalue/ nodes (i.e. the loads from these lvalues that produce a null or undef value) /are/ still being reclaimed, and if we couldn't find the node for the rvalue, we just give up. This patch changes that so that we look for the node for either the rvalue or the lvalue -- preferring the former, since it lets us fall back to value-only tracking in cases where we can't get a region, but allowing the latter as well. <rdar://problem/13342842> llvm-svn: 176737
OpenPOWER on IntegriCloud