InstrProf: Simplify the construction of BinaryCoverageReader
authorJustin Bogner <mail@justinbogner.com>
Thu, 26 Feb 2015 20:06:28 +0000 (20:06 +0000)
committerJustin Bogner <mail@justinbogner.com>
Thu, 26 Feb 2015 20:06:28 +0000 (20:06 +0000)
commit43e51634bb699c7aa8b97a78955115a15cbe291d
tree7da9d214cb98edcd62b951a6926f87cae0418b79
parente84891a459c6dfbcce93d2184f904ead886fd99a
InstrProf: Simplify the construction of BinaryCoverageReader

Creating BinaryCoverageReader is a strange and complicated dance where
the constructor sets error codes that member functions will later
read, and the object is in an invalid state if readHeader isn't
immediately called after construction.

Instead, make the constructor private and add a static create method
to do the construction properly. This also has the benefit of removing
readHeader completely and simplifying the interface of the object.

llvm-svn: 230676
llvm/include/llvm/ProfileData/CoverageMappingReader.h
llvm/lib/ProfileData/CoverageMapping.cpp
llvm/lib/ProfileData/CoverageMappingReader.cpp