[cfe-commits] r137552 - /cfe/trunk/lib/Basic/DiagnosticIDs.cpp
Jeffrey Yasskin
jyasskin at google.com
Fri Aug 12 22:47:05 PDT 2011
Author: jyasskin
Date: Sat Aug 13 00:47:04 2011
New Revision: 137552
URL: http://llvm.org/viewvc/llvm-project?rev=137552&view=rev
Log:
Fix C++0x narrowing conversion errors in Clang.
Modified:
cfe/trunk/lib/Basic/DiagnosticIDs.cpp
Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=137552&r1=137551&r2=137552&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Sat Aug 13 00:47:04 2011
@@ -166,7 +166,8 @@
#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 @@
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);
More information about the cfe-commits
mailing list