This reverts commit fce3a66f5e2f247890c57ac01a2c9847358c0f27. It broke a Fortran application in our in-house testing.
This commit is contained in:
parent
d7e129dffb
commit
166806e792
@ -528,15 +528,7 @@ void ModFileWriter::PutSymbol(
|
||||
}
|
||||
},
|
||||
[&](const UseDetails &) { PutUse(symbol); },
|
||||
[&](const UseErrorDetails &x) {
|
||||
for (const auto &[at, symptr] : x.occurrences()) {
|
||||
if (symptr) {
|
||||
UseDetails details{at, *symptr};
|
||||
PutUseDetails(details);
|
||||
uses_ << symbol.name() << "=>" << symptr->name() << '\n';
|
||||
}
|
||||
}
|
||||
},
|
||||
[](const UseErrorDetails &) {},
|
||||
[&](const ProcBindingDetails &x) {
|
||||
bool deferred{symbol.attrs().test(Attr::DEFERRED)};
|
||||
typeBindings << "procedure";
|
||||
@ -860,7 +852,8 @@ void ModFileWriter::PutGeneric(const Symbol &symbol) {
|
||||
}
|
||||
}
|
||||
|
||||
void ModFileWriter::PutUseDetails(const UseDetails &details) {
|
||||
void ModFileWriter::PutUse(const Symbol &symbol) {
|
||||
auto &details{symbol.get<UseDetails>()};
|
||||
auto &use{details.symbol()};
|
||||
const Symbol &module{GetUsedModule(details)};
|
||||
if (use.owner().parent().IsIntrinsicModules()) {
|
||||
@ -870,15 +863,9 @@ void ModFileWriter::PutUseDetails(const UseDetails &details) {
|
||||
usedNonIntrinsicModules_.insert(module);
|
||||
}
|
||||
uses_ << module.name() << ",only:";
|
||||
}
|
||||
|
||||
void ModFileWriter::PutUse(const Symbol &symbol) {
|
||||
const auto &details{symbol.get<UseDetails>()};
|
||||
PutUseDetails(details);
|
||||
PutGenericName(uses_, symbol);
|
||||
// Can have intrinsic op with different local-name and use-name
|
||||
// (e.g. `operator(<)` and `operator(.lt.)`) but rename is not allowed
|
||||
auto &use{details.symbol()};
|
||||
if (!IsIntrinsicOp(symbol) && use.name() != symbol.name()) {
|
||||
PutGenericName(uses_ << "=>", use);
|
||||
}
|
||||
|
||||
@ -83,7 +83,6 @@ private:
|
||||
void PutUserReduction(llvm::raw_ostream &, const Symbol &);
|
||||
void PutSubprogram(const Symbol &);
|
||||
void PutGeneric(const Symbol &);
|
||||
void PutUseDetails(const UseDetails &);
|
||||
void PutUse(const Symbol &);
|
||||
void PutUseExtraAttr(Attr, const Symbol &, const Symbol &);
|
||||
llvm::raw_ostream &PutAttrs(llvm::raw_ostream &, Attrs,
|
||||
|
||||
@ -9534,7 +9534,7 @@ void ResolveNamesVisitor::HandleProcedureName(
|
||||
} else if (symbol->test(Symbol::Flag::Implicit)) {
|
||||
Say(name,
|
||||
"Use of '%s' as a procedure conflicts with its implicit definition"_err_en_US);
|
||||
} else if (!HadUseError(context(), name.source, symbol)) {
|
||||
} else {
|
||||
SayWithDecl(name, *symbol,
|
||||
"Use of '%s' as a procedure conflicts with its declaration"_err_en_US);
|
||||
}
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
module modfile84A
|
||||
contains
|
||||
subroutine foo()
|
||||
end subroutine
|
||||
end
|
||||
module modfile84B
|
||||
contains
|
||||
subroutine foo()
|
||||
end
|
||||
end
|
||||
module modfile84AB
|
||||
use modfile84A, only: foo, bar=>foo
|
||||
use modfile84B, only: foo, bar=>foo
|
||||
end
|
||||
@ -1,19 +0,0 @@
|
||||
!RUN: rm -rf %t && mkdir -p %t
|
||||
!RUN: %flang_fc1 -fsyntax-only -J%t %S/Inputs/modfile84.f90
|
||||
!RUN: not %flang_fc1 -fsyntax-only -J%t %s 2>&1 | FileCheck %s
|
||||
|
||||
!CHECK: error: Reference to 'foo' is ambiguous
|
||||
!CHECK: 'foo' was use-associated from module 'modfile84a'
|
||||
!CHECK: 'foo' was use-associated from module 'modfile84b'
|
||||
!CHECK: error: 'foo' is not a callable procedure
|
||||
!CHECK: 'foo' is USE-associated with 'foo' in module 'modfile84ab'
|
||||
!CHECK: error: Reference to 'bar' is ambiguous
|
||||
!CHECK: 'bar' was use-associated from module 'modfile84a'
|
||||
!CHECK: 'bar' was use-associated from module 'modfile84b'
|
||||
!CHECK: error: 'bar' is not a callable procedure
|
||||
!CHECK: 'bar' is USE-associated with 'bar' in module 'modfile84ab'
|
||||
|
||||
use modfile84AB
|
||||
call foo()
|
||||
call bar()
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user