[flang] Fix crash from -DMACRO= with empty replacement

Such macros were exposing some edge cases in the preprocessor
regarding empty tokens.

Differential Revision: https://reviews.llvm.org/D101207
This commit is contained in:
peter klausler 2021-04-23 16:26:49 -07:00
parent 1cc5946cc8
commit 0eb3299d28
2 changed files with 5 additions and 2 deletions

View File

@ -93,7 +93,7 @@ public:
return x - start_;
}
A OffsetMember(std::size_t n) const {
CHECK(n < size_);
CHECK(n <= size_);
return start_ + n;
}

View File

@ -91,7 +91,10 @@ void OffsetToProvenanceMappings::Put(const OffsetToProvenanceMappings &that) {
}
ProvenanceRange OffsetToProvenanceMappings::Map(std::size_t at) const {
// CHECK(!provenanceMap_.empty());
if (provenanceMap_.empty()) {
CHECK(at == 0);
return {};
}
std::size_t low{0}, count{provenanceMap_.size()};
while (count > 1) {
std::size_t mid{low + (count >> 1)};