Ensure that all forward-references and placeholders are resolved. Iteratively lazy-loading metadata on-demand if needed.
| 941 | /// Ensure that all forward-references and placeholders are resolved. |
| 942 | /// Iteratively lazy-loading metadata on-demand if needed. |
| 943 | void MetadataLoader::MetadataLoaderImpl::resolveForwardRefsAndPlaceholders( |
| 944 | PlaceholderQueue &Placeholders) { |
| 945 | DenseSet<unsigned> Temporaries; |
| 946 | while (1) { |
| 947 | // Populate Temporaries with the placeholders that haven't been loaded yet. |
| 948 | Placeholders.getTemporaries(MetadataList, Temporaries); |
| 949 | |
| 950 | // If we don't have any temporary, or FwdReference, we're done! |
| 951 | if (Temporaries.empty() && !MetadataList.hasFwdRefs()) |
| 952 | break; |
| 953 | |
| 954 | // First, load all the temporaries. This can add new placeholders or |
| 955 | // forward references. |
| 956 | for (auto ID : Temporaries) |
| 957 | lazyLoadOneMetadata(ID, Placeholders); |
| 958 | Temporaries.clear(); |
| 959 | |
| 960 | // Second, load the forward-references. This can also add new placeholders |
| 961 | // or forward references. |
| 962 | while (MetadataList.hasFwdRefs()) |
| 963 | lazyLoadOneMetadata(MetadataList.getNextFwdRef(), Placeholders); |
| 964 | } |
| 965 | // At this point we don't have any forward reference remaining, or temporary |
| 966 | // that haven't been loaded. We can safely drop RAUW support and mark cycles |
| 967 | // as resolved. |
| 968 | MetadataList.tryToResolveCycles(); |
| 969 | |
| 970 | // Finally, everything is in place, we can replace the placeholders operands |
| 971 | // with the final node they refer to. |
| 972 | Placeholders.flush(MetadataList); |
| 973 | } |
| 974 | |
| 975 | Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( |
| 976 | SmallVectorImpl<uint64_t> &Record, unsigned Code, |
nothing calls this directly
no test coverage detected