diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2011-08-13 05:47:04 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2011-08-13 05:47:04 +0000 |
commit | 7c5109b0322058c1fb80222b71b380b2c7b10d4e (patch) | |
tree | d4caa9963f2725ae1ab59d0b69eebd6fe47de8f8 /lib/Basic | |
parent | 83bbba1fc98dd3b2a351013a40808e995e648f40 (diff) |
Fix C++0x narrowing conversion errors in Clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r-- | lib/Basic/DiagnosticIDs.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 66b16a9ba1..907e826a33 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -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); |