[llvm] r287060 - Fix Modi and File count if there are more than 65535 modules/files.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 16:38:33 PST 2016
Author: ruiu
Date: Tue Nov 15 18:38:33 2016
New Revision: 287060
URL: http://llvm.org/viewvc/llvm-project?rev=287060&view=rev
Log:
Fix Modi and File count if there are more than 65535 modules/files.
These numbers are intended to be capped at 65535, but
`std::max<uint16_t>(UINT16_MAX, N)` always returns N for any N because
the expression is the same as `std::max((uint16_t)UINT16_MAX, (uint16_t)N)`.
Modified:
llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp?rev=287060&r1=287059&r2=287060&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp Tue Nov 15 18:38:33 2016
@@ -185,8 +185,8 @@ Error DbiStreamBuilder::generateFileInfo
WritableStreamRef(FileInfoBuffer).keep_front(NamesOffset);
StreamWriter MetadataWriter(MetadataBuffer);
- uint16_t ModiCount = std::min<uint16_t>(UINT16_MAX, ModuleInfos.size());
- uint16_t FileCount = std::min<uint16_t>(UINT16_MAX, SourceFileNames.size());
+ uint16_t ModiCount = std::min<uint32_t>(UINT16_MAX, ModuleInfos.size());
+ uint16_t FileCount = std::min<uint32_t>(UINT16_MAX, SourceFileNames.size());
if (auto EC = MetadataWriter.writeInteger(ModiCount)) // NumModules
return EC;
if (auto EC = MetadataWriter.writeInteger(FileCount)) // NumSourceFiles
More information about the llvm-commits
mailing list