std::vector<StringRef> NameTable;
};
-// Represents the source position in GCC sample profiles.
-struct SourceInfo {
- SourceInfo()
- : FuncName(), DirName(), FileName(), StartLine(0), Line(0),
- Discriminator(0) {}
-
- SourceInfo(StringRef FuncName, StringRef DirName, StringRef FileName,
- uint32_t StartLine, uint32_t Line, uint32_t Discriminator)
- : FuncName(FuncName), DirName(DirName), FileName(FileName),
- StartLine(StartLine), Line(Line), Discriminator(Discriminator) {}
-
- bool operator<(const SourceInfo &p) const;
-
- uint32_t Offset() const { return ((Line - StartLine) << 16) | Discriminator; }
-
- bool Malformed() const { return Line < StartLine; }
-
- StringRef FuncName;
- StringRef DirName;
- StringRef FileName;
- uint32_t StartLine;
- uint32_t Line;
- uint32_t Discriminator;
-};
-
typedef SmallVector<FunctionSamples *, 10> InlineCallStack;
// Supported histogram types in GCC. Currently, we only need support for
return Magic == SPMagic();
}
-bool SourceInfo::operator<(const SourceInfo &P) const {
- if (Line != P.Line)
- return Line < P.Line;
- if (StartLine != P.StartLine)
- return StartLine < P.StartLine;
- if (Discriminator != P.Discriminator)
- return Discriminator < P.Discriminator;
- return FuncName < P.FuncName;
-}
-
std::error_code SampleProfileReaderGCC::skipNextWord() {
uint32_t dummy;
if (!GcovBuffer.readInt(dummy))