summaryrefslogtreecommitdiffstats
path: root/clang/tools/scan-build-py/tests
diff options
context:
space:
mode:
authorYury Gribov <y.gribov@samsung.com>2016-02-18 11:08:46 +0000
committerYury Gribov <y.gribov@samsung.com>2016-02-18 11:08:46 +0000
commita6560ebe4c4bc540d6eb8cbfd60fe0788194c90c (patch)
tree99b77dd582cb9a9ac123067ae1394010bf8cd7e5 /clang/tools/scan-build-py/tests
parent9c4ed175c2055711b1a2d8a4d1a1575b9a5e41fb (diff)
downloadbcm5719-llvm-a6560ebe4c4bc540d6eb8cbfd60fe0788194c90c.tar.gz
bcm5719-llvm-a6560ebe4c4bc540d6eb8cbfd60fe0788194c90c.zip
[analyzer] Add --force-analyze-debug-code option to scan-build
to force debug build and hopefully enable more precise warnings. Static Analyzer is much more efficient when built in debug mode (-UNDEBUG) so we advice users to enable it manually. This may be inconvenient in case of large complex projects (think about Linux distros e.g. Android or Tizen). This patch adds a flag to scan-build which inserts -UNDEBUG automatically. Differential Revision: http://reviews.llvm.org/D16200 llvm-svn: 261204
Diffstat (limited to 'clang/tools/scan-build-py/tests')
-rw-r--r--clang/tools/scan-build-py/tests/unit/test_runner.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/tools/scan-build-py/tests/unit/test_runner.py b/clang/tools/scan-build-py/tests/unit/test_runner.py
index ea10051d850..de15d236920 100644
--- a/clang/tools/scan-build-py/tests/unit/test_runner.py
+++ b/clang/tools/scan-build-py/tests/unit/test_runner.py
@@ -211,3 +211,14 @@ class RequireDecoratorTest(unittest.TestCase):
def test_method_exception_not_caught(self):
self.assertRaises(Exception, method_exception_from_inside, dict())
+
+class ForceAnalyzeDebugTest(unittest.TestCase):
+
+ def test_force_analyze_debug_code(self):
+ for a, b in [
+ ([], ['-UNDEBUG']),
+ (['-O2'], ['-O2', '-UNDEBUG']),
+ (['-Dkey=val'], ['-Dkey=val', '-UNDEBUG']),
+ (['-D', 'NDEBUG'], ['-D', 'NDEBUG', '-UNDEBUG']) ]:
+ sut.force_analyze_debug_code(a)
+ self.assertEqual(a, b)
OpenPOWER on IntegriCloud