mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-04 04:19:25 +00:00
Silence static analyzer warnings in LLVMSupport.
The static analyzer catches a few potential bugs in LLVMSupport. Add in asserts to silence the warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224044 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -323,6 +323,7 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
|
|||||||
if (i+1 >= argc)
|
if (i+1 >= argc)
|
||||||
return Handler->error("requires a value!");
|
return Handler->error("requires a value!");
|
||||||
// Steal the next argument, like for '-o filename'
|
// Steal the next argument, like for '-o filename'
|
||||||
|
assert(argv && "null check");
|
||||||
Value = argv[++i];
|
Value = argv[++i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -356,6 +357,7 @@ static inline bool ProvideOption(Option *Handler, StringRef ArgName,
|
|||||||
while (NumAdditionalVals > 0) {
|
while (NumAdditionalVals > 0) {
|
||||||
if (i+1 >= argc)
|
if (i+1 >= argc)
|
||||||
return Handler->error("not enough values!");
|
return Handler->error("not enough values!");
|
||||||
|
assert(argv && "null check");
|
||||||
Value = argv[++i];
|
Value = argv[++i];
|
||||||
|
|
||||||
if (CommaSeparateAndAddOccurrence(Handler, i, ArgName, Value, MultiArg))
|
if (CommaSeparateAndAddOccurrence(Handler, i, ArgName, Value, MultiArg))
|
||||||
|
@@ -169,6 +169,8 @@ static std::string toStringAPFloat(uint64_t D, int E, unsigned Precision) {
|
|||||||
int Shift = 63 - (NewE - E);
|
int Shift = 63 - (NewE - E);
|
||||||
assert(Shift <= LeadingZeros);
|
assert(Shift <= LeadingZeros);
|
||||||
assert(Shift == LeadingZeros || NewE == ScaledNumbers::MaxScale);
|
assert(Shift == LeadingZeros || NewE == ScaledNumbers::MaxScale);
|
||||||
|
assert((Shift & (1u << std::numeric_limits<int>::digits)) == 0 &&
|
||||||
|
"undefined behavior");
|
||||||
D <<= Shift;
|
D <<= Shift;
|
||||||
E = NewE;
|
E = NewE;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user