[BuildSystem] Diagnose empty arguments to shell commands.
diff --git a/lib/BuildSystem/BuildSystem.cpp b/lib/BuildSystem/BuildSystem.cpp
index 8e744a5..68e04e2 100644
--- a/lib/BuildSystem/BuildSystem.cpp
+++ b/lib/BuildSystem/BuildSystem.cpp
@@ -834,6 +834,12 @@
virtual bool configureAttribute(const ConfigureContext& ctx, StringRef name,
ArrayRef<StringRef> values) override {
if (name == "args") {
+ // Diagnose missing arguments.
+ if (values.empty()) {
+ ctx.error("invalid arguments for command '" + getName() + "'");
+ return false;
+ }
+
args = std::vector<std::string>(values.begin(), values.end());
} else {
return ExternalCommand::configureAttribute(ctx, name, values);
diff --git a/tests/BuildSystem/Parser/missing-shell-arguments.llbuild b/tests/BuildSystem/Parser/missing-shell-arguments.llbuild
new file mode 100644
index 0000000..13f2c43
--- /dev/null
+++ b/tests/BuildSystem/Parser/missing-shell-arguments.llbuild
@@ -0,0 +1,14 @@
+# Check error handling.
+#
+# RUN: %{llbuild} buildsystem build --no-db -f %s > %t.out 2> %t.err || true
+# RUN: %{FileCheck} --check-prefix CHECK-ERR --input-file %t.err %s
+
+client:
+ name: basic
+
+
+commands:
+ C0:
+ tool: shell
+ # CHECK-ERR: error: invalid arguments for command 'C0'
+ args: []