[flang] Check for having compiled the inverted map before using it

Original-commit: flang-compiler/f18@cef90ee11e
Reviewed-on: https://github.com/flang-compiler/f18/pull/715
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2019-09-09 09:25:49 -07:00
parent 73329265ff
commit be799e4300
1 changed files with 2 additions and 0 deletions

View File

@ -403,6 +403,8 @@ std::optional<ProvenanceRange> CookedSource::GetProvenanceRange(
std::optional<CharBlock> CookedSource::GetCharBlock(
ProvenanceRange range) const {
CHECK(!invertedMap_.empty() &&
"CompileProvenanceRangeToOffsetMappings not called");
if (auto to{invertedMap_.Map(range)}) {
return CharBlock{data_.c_str() + *to, range.size()};
} else {