Index: test/FileCheck/defines.txt =================================================================== --- test/FileCheck/defines.txt +++ test/FileCheck/defines.txt @@ -3,16 +3,19 @@ ; ; RUN: not FileCheck -DVALUE=10 -check-prefix NOT -input-file %s %s 2>&1 | FileCheck %s -check-prefix NOT-ERRMSG ; RUN: FileCheck -DVALUE=20 -check-prefix NOT -input-file %s %s +; RUN: not FileCheck -DVALUE10 -input-file %s %s 2>&1 | FileCheck %s -check-prefix ERRCLI Value = 10 ; CHECK: Value = [[VALUE]] ; NOT-NOT: Value = [[VALUE]] -; ERRMSG: defines.txt:8:10: error: CHECK: expected string not found in input +; ERRMSG: defines.txt:9:10: error: CHECK: expected string not found in input ; ERRMSG: defines.txt:1:1: note: scanning from here ; ERRMSG: defines.txt:1:1: note: with variable "VALUE" equal to "20" -; ERRMSG: defines.txt:7:1: note: possible intended match here +; ERRMSG: defines.txt:8:1: note: possible intended match here -; NOT-ERRMSG: defines.txt:9:12: error: {{NOT}}-NOT: excluded string found in input -; NOT-ERRMSG: defines.txt:7:1: note: found here -; NOT-ERRMSG: defines.txt:7:1: note: with variable "VALUE" equal to "10" \ No newline at end of file +; NOT-ERRMSG: defines.txt:10:12: error: {{NOT}}-NOT: excluded string found in input +; NOT-ERRMSG: defines.txt:8:1: note: found here +; NOT-ERRMSG: defines.txt:8:1: note: with variable "VALUE" equal to "10" + +; ERRCLI: Command-line definition 'VALUE10' missing equal sign Index: utils/FileCheck/FileCheck.cpp =================================================================== --- utils/FileCheck/FileCheck.cpp +++ utils/FileCheck/FileCheck.cpp @@ -523,8 +523,17 @@ for (auto CheckNot : ImplicitCheckNot) Req.ImplicitCheckNot.push_back(CheckNot); - for (auto G : GlobalDefines) + bool GlobalDefineError = false; + for (auto G : GlobalDefines) { + if (G.find('=') == std::string::npos) { + errs() << "Command-line definition '" << G << "' missing equal sign\n"; + GlobalDefineError = true; + continue; + } Req.GlobalDefines.push_back(G); + } + if (GlobalDefineError) + return 2; Req.AllowEmptyInput = AllowEmptyInput; Req.EnableVarScope = EnableVarScope;