Silence static analyzer warnings in LLVMSupport.

The static analyzer catches a few potential bugs in LLVMSupport. Add
in asserts to silence the warnings.

llvm-svn: 224044
This commit is contained in:
Michael Ilseman
2014-12-11 19:46:38 +00:00
parent 199aeff7dd
commit 4e654cd664
2 changed files with 4 additions and 0 deletions

View File

@@ -323,6 +323,7 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
if (i+1 >= argc)
return Handler->error("requires a value!");
// Steal the next argument, like for '-o filename'
assert(argv && "null check");
Value = argv[++i];
}
break;
@@ -356,6 +357,7 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
while (NumAdditionalVals > 0) {
if (i+1 >= argc)
return Handler->error("not enough values!");
assert(argv && "null check");
Value = argv[++i];
if (CommaSeparateAndAddOccurrence(Handler, i, ArgName, Value, MultiArg))