diff options
author | Michael Ilseman <milseman@apple.com> | 2014-12-11 19:46:38 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2014-12-11 19:46:38 +0000 |
commit | 2b7ed472a7db9f1ca012c47223403b8758b15a3c (patch) | |
tree | 680e1d1e2410768d4a2c79c3c5d3844cb8834f16 | |
parent | e9256e340bfde926e8da41c9794907c7a586c997 (diff) |
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
-rw-r--r-- | lib/Support/CommandLine.cpp | 2 | ||||
-rw-r--r-- | lib/Support/ScaledNumber.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 985c8777701..7b06219104e 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -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)) diff --git a/lib/Support/ScaledNumber.cpp b/lib/Support/ScaledNumber.cpp index fc6d4e7be43..725f4649613 100644 --- a/lib/Support/ScaledNumber.cpp +++ b/lib/Support/ScaledNumber.cpp @@ -169,6 +169,8 @@ static std::string toStringAPFloat(uint64_t D, int E, unsigned Precision) { int Shift = 63 - (NewE - E); assert(Shift <= LeadingZeros); assert(Shift == LeadingZeros || NewE == ScaledNumbers::MaxScale); + assert((Shift & (1u << std::numeric_limits<int>::digits)) == 0 && + "undefined behavior"); D <<= Shift; E = NewE; |