mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-24 04:16:08 +00:00
[flang] Silence warnings from module files after recent change (#92834)
I modified declaration checking for interoperable objects to buffer its generated messages as I had previously done for derived types and procedure interfaces, but failed to modify all of the message creation statements to use the new buffer, so some are now escaping when a module file is being compiled. Fix to ensure that the new buffer is always used.
This commit is contained in:
parent
975579bd94
commit
c24f881340
@ -3000,14 +3000,14 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
|
||||
examinedByWhyNotInteroperable_.insert(symbol);
|
||||
CHECK(symbol.has<ObjectEntityDetails>());
|
||||
if (isExplicitBindC && !symbol.owner().IsModule()) {
|
||||
messages_.Say(symbol.name(),
|
||||
msgs.Say(symbol.name(),
|
||||
"A variable with BIND(C) attribute may only appear in the specification part of a module"_err_en_US);
|
||||
}
|
||||
auto shape{evaluate::GetShape(foldingContext_, symbol)};
|
||||
if (shape) {
|
||||
if (evaluate::GetRank(*shape) == 0) { // 18.3.4
|
||||
if (IsAllocatableOrPointer(symbol) && !IsDummy(symbol)) {
|
||||
messages_.Say(symbol.name(),
|
||||
msgs.Say(symbol.name(),
|
||||
"A scalar interoperable variable may not be ALLOCATABLE or POINTER"_err_en_US);
|
||||
}
|
||||
} else if (auto extents{
|
||||
@ -3028,25 +3028,22 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
|
||||
if (derived) {
|
||||
if (derived->typeSymbol().attrs().test(Attr::BIND_C)) {
|
||||
} else if (isError) {
|
||||
if (auto *msg{messages_.Say(symbol.name(),
|
||||
"The derived type of a BIND(C) object must also be BIND(C)"_err_en_US)}) {
|
||||
msg->Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
|
||||
}
|
||||
context_.SetError(symbol);
|
||||
msgs.Say(symbol.name(),
|
||||
"The derived type of a BIND(C) object must also be BIND(C)"_err_en_US)
|
||||
.Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
|
||||
} else if (auto bad{WhyNotInteroperableDerivedType(
|
||||
derived->typeSymbol(), /*isError=*/false)};
|
||||
bad.AnyFatalError()) {
|
||||
if (auto *msg{messages_.Say(symbol.name(),
|
||||
"The derived type of an interoperable object must be interoperable, but is not"_err_en_US)}) {
|
||||
msg->Attach(
|
||||
derived->typeSymbol().name(), "Non-interoperable type"_en_US);
|
||||
bad.AttachTo(*msg, parser::Severity::None);
|
||||
}
|
||||
bad.AttachTo(
|
||||
msgs.Say(symbol.name(),
|
||||
"The derived type of an interoperable object must be interoperable, but is not"_err_en_US)
|
||||
.Attach(derived->typeSymbol().name(),
|
||||
"Non-interoperable type"_en_US),
|
||||
parser::Severity::None);
|
||||
} else {
|
||||
if (auto *msg{messages_.Say(symbol.name(),
|
||||
"The derived type of an interoperable object should be BIND(C)"_warn_en_US)}) {
|
||||
msg->Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
|
||||
}
|
||||
msgs.Say(symbol.name(),
|
||||
"The derived type of an interoperable object should be BIND(C)"_warn_en_US)
|
||||
.Attach(derived->typeSymbol().name(), "Non-BIND(C) type"_en_US);
|
||||
}
|
||||
}
|
||||
if (type->IsAssumedType()) { // ok
|
||||
|
Loading…
x
Reference in New Issue
Block a user