Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 16360a5

Browse files
committed
[Driver] Suggest valid integrated tools
Summary: There are only two valid integrated Clang driver tools: `-cc1` and `-cc1as`. If a user asks for an unknown tool, such as `-cc1asphalt`, an error message is displayed to indicate that there is no such tool, but the message doesn't indicate what the valid options are. Include the valid options in the error message. Test Plan: `check-clang` Reviewers: sepavloff, bkramer, phosek Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42004 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322517 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 10a3299 commit 16360a5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/Driver/unknown-arg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// RUN: FileCheck %s --check-prefix=SILENT
1515
// RUN: not %clang -cc1as -hell --version -debug-info-macros 2>&1 | \
1616
// RUN: FileCheck %s --check-prefix=CC1AS-DID-YOU-MEAN
17+
// RUN: not %clang -cc1asphalt -help 2>&1 | \
18+
// RUN: FileCheck %s --check-prefix=UNKNOWN-INTEGRATED
1719

1820
// CHECK: error: unknown argument: '-cake-is-lie'
1921
// CHECK: error: unknown argument: '-%0'
@@ -46,7 +48,7 @@
4648
// CC1AS-DID-YOU-MEAN: error: unknown argument '-hell', did you mean '-help'?
4749
// CC1AS-DID-YOU-MEAN: error: unknown argument '--version', did you mean '-version'?
4850
// CC1AS-DID-YOU-MEAN: error: unknown argument '-debug-info-macros', did you mean '-debug-info-macro'?
49-
51+
// UNKNOWN-INTEGRATED: error: unknown integrated tool 'asphalt'. Valid tools include '-cc1' and '-cc1as'.
5052

5153
// RUN: %clang -S %s -o %t.s -Wunknown-to-clang-option 2>&1 | FileCheck --check-prefix=IGNORED %s
5254

tools/driver/driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ static int ExecuteCC1Tool(ArrayRef<const char *> argv, StringRef Tool) {
311311
return cc1as_main(argv.slice(2), argv[0], GetExecutablePathVP);
312312

313313
// Reject unknown tools.
314-
llvm::errs() << "error: unknown integrated tool '" << Tool << "'\n";
314+
llvm::errs() << "error: unknown integrated tool '" << Tool << "'. "
315+
<< "Valid tools include '-cc1' and '-cc1as'.\n";
315316
return 1;
316317
}
317318

0 commit comments

Comments
 (0)