summaryrefslogtreecommitdiff
path: root/clang/bindings
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-06-26 07:39:03 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-06-26 07:39:03 +0000
commitc3a7302397746d669e5339ef25506b0429b23354 (patch)
treef008d7424779a9e10652a21710e770a2ba55ae02 /clang/bindings
parent5dff8ca26a90c749a7a9550764592980f30ab544 (diff)
downloadllvm-c3a7302397746d669e5339ef25506b0429b23354.tar.gz
[clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase
Summary: Wraps JSON compilation database with a target and mode adding database wrapper. So that driver can correctly figure out which toolchain to use. Note that clients that wants to make use of this target discovery mechanism needs to link in TargetsInfos and initialize them at startup. Reviewers: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63755 llvm-svn: 364386
Diffstat (limited to 'clang/bindings')
-rw-r--r--clang/bindings/python/tests/cindex/test_cdb.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/bindings/python/tests/cindex/test_cdb.py b/clang/bindings/python/tests/cindex/test_cdb.py
index e2a48f14cdeb..99bc72143bef 100644
--- a/clang/bindings/python/tests/cindex/test_cdb.py
+++ b/clang/bindings/python/tests/cindex/test_cdb.py
@@ -63,15 +63,16 @@ class TestCDB(unittest.TestCase):
expected = [
{ 'wd': '/home/john.doe/MyProject',
'file': '/home/john.doe/MyProject/project.cpp',
- 'line': ['clang++', '-o', 'project.o', '-c',
+ 'line': ['clang++', '--driver-mode=g++', '-o', 'project.o', '-c',
'/home/john.doe/MyProject/project.cpp']},
{ 'wd': '/home/john.doe/MyProjectA',
'file': '/home/john.doe/MyProject/project2.cpp',
- 'line': ['clang++', '-o', 'project2.o', '-c',
+ 'line': ['clang++', '--driver-mode=g++', '-o', 'project2.o', '-c',
'/home/john.doe/MyProject/project2.cpp']},
{ 'wd': '/home/john.doe/MyProjectB',
'file': '/home/john.doe/MyProject/project2.cpp',
- 'line': ['clang++', '-DFEATURE=1', '-o', 'project2-feature.o', '-c',
+ 'line': ['clang++', '--driver-mode=g++', '-DFEATURE=1', '-o',
+ 'project2-feature.o', '-c',
'/home/john.doe/MyProject/project2.cpp']},
]
@@ -89,7 +90,7 @@ class TestCDB(unittest.TestCase):
self.assertEqual(len(cmds), 1)
self.assertEqual(cmds[0].directory, os.path.dirname(file))
self.assertEqual(cmds[0].filename, file)
- expected = [ 'clang++', '-o', 'project.o', '-c',
+ expected = [ 'clang++', '--driver-mode=g++', '-o', 'project.o', '-c',
'/home/john.doe/MyProject/project.cpp']
for arg, exp in zip(cmds[0].arguments, expected):
self.assertEqual(arg, exp)
@@ -101,10 +102,11 @@ class TestCDB(unittest.TestCase):
self.assertEqual(len(cmds), 2)
expected = [
{ 'wd': '/home/john.doe/MyProjectA',
- 'line': ['clang++', '-o', 'project2.o', '-c',
+ 'line': ['clang++', '--driver-mode=g++', '-o', 'project2.o', '-c',
'/home/john.doe/MyProject/project2.cpp']},
{ 'wd': '/home/john.doe/MyProjectB',
- 'line': ['clang++', '-DFEATURE=1', '-o', 'project2-feature.o', '-c',
+ 'line': ['clang++', '--driver-mode=g++', '-DFEATURE=1', '-o',
+ 'project2-feature.o', '-c',
'/home/john.doe/MyProject/project2.cpp']}
]
for i in range(len(cmds)):