Fix C++0x narrowing conversion errors in Clang.

llvm-svn: 137552
This commit is contained in:
Jeffrey Yasskin 2011-08-13 05:47:04 +00:00
parent d1de7764be
commit 9a56e37927
1 changed files with 6 additions and 2 deletions

View File

@ -166,7 +166,8 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) {
#endif
// Search the diagnostic table with a binary search.
StaticDiagInfoRec Find = { DiagID, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0,0 };
StaticDiagInfoRec Find = { static_cast<unsigned short>(DiagID),
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const StaticDiagInfoRec *Found =
std::lower_bound(StaticDiagInfo, StaticDiagInfo + StaticDiagInfoSize, Find);
@ -269,7 +270,10 @@ unsigned DiagnosticIDs::getIdFromName(StringRef Name) {
if (Name.empty()) { return diag::DIAG_UPPER_LIMIT; }
StaticDiagNameIndexRec Find = { Name.data(), 0, Name.size() };
assert(Name.size() == static_cast<uint8_t>(Name.size()) &&
"Name is too long");
StaticDiagNameIndexRec Find = { Name.data(), 0,
static_cast<uint8_t>(Name.size()) };
const StaticDiagNameIndexRec *Found =
std::lower_bound( StaticDiagNameIndex, StaticDiagNameIndexEnd, Find);