forked from OSchip/llvm-project
[flang] Don't attempt to compute element size if no DynamicType
If an error has occurred a symbol may have a DeclTypeSpec but no valid DynamicType. There is no need to compute the size of erroneous symbols. Also, we only need to process object entities and procedure entities. All other kinds of symbols can be skipped. This fixes another problem revealed by https://bugs.llvm.org/show_bug.cgi?id=47265 Differential Revision: https://reviews.llvm.org/D86484
This commit is contained in:
parent
1a2a34a38a
commit
044a71d828
|
@ -295,9 +295,8 @@ std::size_t ComputeOffsetsHelper::ComputeOffset(
|
|||
}
|
||||
|
||||
void ComputeOffsetsHelper::DoSymbol(Symbol &symbol) {
|
||||
if (symbol.has<TypeParamDetails>() || symbol.has<SubprogramDetails>() ||
|
||||
symbol.has<UseDetails>() || symbol.has<ProcBindingDetails>()) {
|
||||
return; // these have type but no size
|
||||
if (!symbol.has<ObjectEntityDetails>() && !symbol.has<ProcEntityDetails>()) {
|
||||
return;
|
||||
}
|
||||
SizeAndAlignment s{GetSizeAndAlignment(symbol)};
|
||||
if (s.size == 0) {
|
||||
|
@ -324,7 +323,7 @@ auto ComputeOffsetsHelper::GetSizeAndAlignment(const Symbol &symbol)
|
|||
auto ComputeOffsetsHelper::GetElementSize(const Symbol &symbol)
|
||||
-> SizeAndAlignment {
|
||||
const DeclTypeSpec *type{symbol.GetType()};
|
||||
if (!type) {
|
||||
if (!evaluate::DynamicType::From(type).has_value()) {
|
||||
return {};
|
||||
}
|
||||
// TODO: The size of procedure pointers is not yet known
|
||||
|
|
Loading…
Reference in New Issue