Fix DataReader to work with new local sym perf2flo format

Summary:
In a recent commit, we changed local symbols to be specially tagged
with the number 2 (local sym) instead of 1 (sym). This patch modifies the reader
to don't choke when seeing a 2 in the symbol id field.

(cherry picked from FBD2552776)
This commit is contained in:
Rafael Auler
2015-10-16 17:00:36 -07:00
committed by Maksim Panchenko
parent f9ed45893b
commit 9a8d357d0b

View File

@@ -92,12 +92,14 @@ ErrorOr<int64_t> DataReader::parseNumberField(char EndChar) {
ErrorOr<Location> DataReader::parseLocation() {
// Read whether the location of the branch should be DSO or a symbol
if (ParsingBuf[0] != '0' && ParsingBuf[0] != '1') {
reportError("expected 0 or 1");
// 0 means it is a DSO. 1 means it is a global symbol. 2 means it is a local
// symbol.
if (ParsingBuf[0] != '0' && ParsingBuf[0] != '1' && ParsingBuf[0] != '2') {
reportError("expected 0, 1 or 2");
return make_error_code(llvm::errc::io_error);
}
bool IsSymbol = ParsingBuf[0] == '1';
bool IsSymbol = ParsingBuf[0] == '1' || ParsingBuf[0] == '2';
ParsingBuf = ParsingBuf.drop_front(1);
Col += 1;
@@ -153,7 +155,7 @@ bool DataReader::hasData() {
if (ParsingBuf.size() == 0)
return false;
if (ParsingBuf[0] == '0' || ParsingBuf[0] == '1')
if (ParsingBuf[0] == '0' || ParsingBuf[0] == '1' || ParsingBuf[0] == '2')
return true;
return false;
}