[InstrProf] Encapsulates access to AddrToMD5Map.
authorMircea Trofin <mtrofin@google.com>
Wed, 21 Mar 2018 22:27:31 +0000 (22:27 +0000)
committerMircea Trofin <mtrofin@google.com>
Wed, 21 Mar 2018 22:27:31 +0000 (22:27 +0000)
commit556f8f6adc39e306749ace5582b2842981c0cd7f
treeba5670f4a5fe1185200057e77ecf35c66d871147
parenteb629994554a05a4d3e59d6b5c09d312416d096e
[InstrProf] Encapsulates access to AddrToMD5Map.

Summary:
This fixes a unittest failure introduced by D44717

D44717 introduced lazy sorting of the internal data structures of the
symbol table. The AddrToMD5Map getter was potentially exposing
inconsistent (unsorted) state. We could sort in the accessor, however,
a client may store the pointer and thus bypass the internal state
management of the symbol table. The alternative in this CL blocks
direct access to the state, thus ensuring consistent
externally-observable state.

Reviewers: davidxl, xur, eraman

Reviewed By: xur

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D44757

llvm-svn: 328163
llvm/include/llvm/ProfileData/InstrProf.h
llvm/include/llvm/ProfileData/InstrProfData.inc
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/unittests/ProfileData/InstrProfTest.cpp