forked from OSchip/llvm-project
[flang] When creating symbols for intrinsics, do not put them in the global scope, and do not emit them to module files.
Original-commit: flang-compiler/f18@9907026609 Reviewed-on: https://github.com/flang-compiler/f18/pull/565 Tree-same-pre-rewrite: false
This commit is contained in:
parent
64206257a0
commit
375dcec348
|
@ -427,7 +427,6 @@ void PutEntity(std::ostream &os, const Symbol &symbol) {
|
|||
},
|
||||
},
|
||||
symbol.details());
|
||||
os << '\n';
|
||||
}
|
||||
|
||||
void PutShapeSpec(std::ostream &os, const ShapeSpec &x) {
|
||||
|
@ -470,9 +469,13 @@ void PutObjectEntity(std::ostream &os, const Symbol &symbol) {
|
|||
PutShape(os, details.shape(), '(', ')');
|
||||
PutShape(os, details.coshape(), '[', ']');
|
||||
PutInit(os, details.init());
|
||||
os << '\n';
|
||||
}
|
||||
|
||||
void PutProcEntity(std::ostream &os, const Symbol &symbol) {
|
||||
if (symbol.attrs().test(Attr::INTRINSIC)) {
|
||||
return;
|
||||
}
|
||||
const auto &details{symbol.get<ProcEntityDetails>()};
|
||||
const ProcInterface &interface{details.interface()};
|
||||
PutEntity(os, symbol, [&]() {
|
||||
|
@ -485,6 +488,7 @@ void PutProcEntity(std::ostream &os, const Symbol &symbol) {
|
|||
os << ')';
|
||||
PutPassName(os, details.passName());
|
||||
});
|
||||
os << '\n';
|
||||
}
|
||||
|
||||
void PutPassName(std::ostream &os, const SourceName *passName) {
|
||||
|
@ -502,6 +506,7 @@ void PutTypeParam(std::ostream &os, const Symbol &symbol) {
|
|||
PutLower(os << ',', common::EnumToString(details.attr()));
|
||||
});
|
||||
PutInit(os, details.init());
|
||||
os << '\n';
|
||||
}
|
||||
|
||||
void PutInit(std::ostream &os, const MaybeExpr &init) {
|
||||
|
|
|
@ -4767,11 +4767,12 @@ void ResolveNamesVisitor::HandleProcedureName(
|
|||
CHECK(flag == Symbol::Flag::Function || flag == Symbol::Flag::Subroutine);
|
||||
auto *symbol{FindSymbol(name)};
|
||||
if (symbol == nullptr) {
|
||||
Attrs attrs;
|
||||
if (context().intrinsics().IsIntrinsic(name.source.ToString())) {
|
||||
attrs.set(Attr::INTRINSIC);
|
||||
symbol =
|
||||
&MakeSymbol(InclusiveScope(), name.source, Attrs{Attr::INTRINSIC});
|
||||
} else {
|
||||
symbol = &MakeSymbol(context().globalScope(), name.source, Attrs{});
|
||||
}
|
||||
symbol = &MakeSymbol(context().globalScope(), name.source, attrs);
|
||||
Resolve(name, *symbol);
|
||||
if (symbol->has<ModuleDetails>()) {
|
||||
SayWithDecl(name, *symbol,
|
||||
|
|
|
@ -118,7 +118,7 @@ contains
|
|||
!REF: /module1/nested4/x
|
||||
real, intent(in) :: x
|
||||
!DEF: /module1/nested4/nested4 ObjectEntity COMPLEX(4)
|
||||
!DEF: /cmplx INTRINSIC ProcEntity
|
||||
!DEF: /module1/nested4/cmplx INTRINSIC ProcEntity
|
||||
!REF: /module1/nested4/x
|
||||
nested4 = cmplx(x+4., 6.)
|
||||
end function nested4
|
||||
|
|
|
@ -23,11 +23,11 @@ character*1 function f1(x1, x2)
|
|||
!REF: /f1/n
|
||||
!REF: /f1/x1
|
||||
!REF: /f1/x2
|
||||
!DEF: /len INTRINSIC ProcEntity
|
||||
!DEF: /f1/len INTRINSIC ProcEntity
|
||||
character*(n), intent(in) :: x1, x2*(len(x1)+1)
|
||||
!DEF: /f1/t DerivedType
|
||||
type :: t
|
||||
!REF: /len
|
||||
!REF: /f1/len
|
||||
!REF: /f1/x2
|
||||
!DEF: /f1/t/c1 ObjectEntity CHARACTER(4_8,1)
|
||||
!DEF: /f1/t/c2 ObjectEntity CHARACTER(6_8,1)
|
||||
|
|
Loading…
Reference in New Issue