summaryrefslogtreecommitdiff
path: root/tools/scan-build-py
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2016-09-14 18:14:11 +0000
committerDevin Coughlin <dcoughlin@apple.com>2016-09-14 18:14:11 +0000
commit82d5b51ee7e451c8672c60b4d96a8ba6db6f71e1 (patch)
tree2c7969c05456c3193c71898d61077c15252542a9 /tools/scan-build-py
parentf275070568ad8f115e515c35bb63def406e8e144 (diff)
downloadclang-82d5b51ee7e451c8672c60b4d96a8ba6db6f71e1.tar.gz
[analyzer] scan-build-py: Remove relative path hack for SATestsBuild.py
Remove the relative path hack in scan-build-py that converts a fully qualified directory name and a fully qualified file path to a relative path before running the analyzer on a file. This hack is not needed: the bad interaction with SATestsBuild.py it was intended to address is actually the same underlying problem that r280768 fixed. Further, because the hack would always relativize paths, it caused SATestBuild.py to be unable to properly line up issues when the build system changed directory and then built a source file in a child directory but used a fully-qualified path for the source file. Differential Revision: https://reviews.llvm.org/D24470 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281516 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/scan-build-py')
-rw-r--r--tools/scan-build-py/libscanbuild/runner.py13
-rw-r--r--tools/scan-build-py/tests/unit/test_runner.py14
2 files changed, 1 insertions, 26 deletions
diff --git a/tools/scan-build-py/libscanbuild/runner.py b/tools/scan-build-py/libscanbuild/runner.py
index 628ad90d62..72d02c85fe 100644
--- a/tools/scan-build-py/libscanbuild/runner.py
+++ b/tools/scan-build-py/libscanbuild/runner.py
@@ -205,19 +205,8 @@ def filter_debug_flags(opts, continuation=run_analyzer):
return continuation(opts)
-@require(['file', 'directory'])
-def set_file_path_relative(opts, continuation=filter_debug_flags):
- """ Set source file path to relative to the working directory.
-
- The only purpose of this function is to pass the SATestBuild.py tests. """
-
- opts.update({'file': os.path.relpath(opts['file'], opts['directory'])})
-
- return continuation(opts)
-
-
@require(['language', 'compiler', 'file', 'flags'])
-def language_check(opts, continuation=set_file_path_relative):
+def language_check(opts, continuation=filter_debug_flags):
""" Find out the language from command line parameters or file name
extension. The decision also influenced by the compiler invocation. """
diff --git a/tools/scan-build-py/tests/unit/test_runner.py b/tools/scan-build-py/tests/unit/test_runner.py
index b4730a1c51..2d09062233 100644
--- a/tools/scan-build-py/tests/unit/test_runner.py
+++ b/tools/scan-build-py/tests/unit/test_runner.py
@@ -219,20 +219,6 @@ class AnalyzerTest(unittest.TestCase):
self.assertEqual(['-DNDEBUG', '-UNDEBUG'], test(['-DNDEBUG']))
self.assertEqual(['-DSomething', '-UNDEBUG'], test(['-DSomething']))
- def test_set_file_relative_path(self):
- def test(expected, input):
- spy = Spy()
- self.assertEqual(spy.success,
- sut.set_file_path_relative(input, spy.call))
- self.assertEqual(expected, spy.arg['file'])
-
- test('source.c',
- {'file': '/home/me/source.c', 'directory': '/home/me'})
- test('me/source.c',
- {'file': '/home/me/source.c', 'directory': '/home'})
- test('../home/me/source.c',
- {'file': '/home/me/source.c', 'directory': '/tmp'})
-
def test_set_language_fall_through(self):
def language(expected, input):
spy = Spy()