OSDN Git Service

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)
commitc0c21334847550e55a375500c0a8433b0300cc7d
treeff9523066cfc41dd933f572fa078de176ae8d97c
parent090b50ca27d8fbc511d35dc67e6afb443b3f84c3
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230676 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ProfileData/CoverageMappingReader.h
lib/ProfileData/CoverageMapping.cpp
lib/ProfileData/CoverageMappingReader.cpp