summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2017-06-30 13:21:27 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2017-06-30 13:21:27 +0000
commitf5f1f63df1b65b19c63a06ff10921f08ce043a81 (patch)
tree85c7a2b50501fdb16819f98dbd4a0fbcf988f6ac /unittests
parent0c223be753a86df1bef5ace82e5a3e11020c026c (diff)
[Driver] Actually report errors during parsing instead of stopping when there's an error somewhere.
This is a more principled version of r303756. That change was both very brittle about the state of the Diags object going into the driver and also broke tooling in funny ways. In particular it prevented tools from capturing diagnostics properly and made the compilation database logic fail to provide arguments to the tool, falling back to scanning directories for JSON files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Driver/ToolChainTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/Driver/ToolChainTest.cpp b/unittests/Driver/ToolChainTest.cpp
index bce2748aa2..ec50560b20 100644
--- a/unittests/Driver/ToolChainTest.cpp
+++ b/unittests/Driver/ToolChainTest.cpp
@@ -152,5 +152,16 @@ TEST(ToolChainTest, DefaultDriverMode) {
EXPECT_TRUE(CXXDriver.CCCIsCXX());
EXPECT_TRUE(CLDriver.IsCLMode());
}
+TEST(ToolChainTest, InvalidArgument) {
+ IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+ struct TestDiagnosticConsumer : public DiagnosticConsumer {};
+ IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
+ DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
+ Driver TheDriver("/bin/clang", "arm-linux-gnueabihf", Diags);
+ std::unique_ptr<Compilation> C(TheDriver.BuildCompilation(
+ {"-fsyntax-only", "-fan-unknown-option", "foo.cpp"}));
+ EXPECT_TRUE(C);
+ EXPECT_TRUE(C->containsError());
+}
} // end anonymous namespace.