Skip to content

Commit 32b7893

Browse files
committed
[flang][Lower] Move SymbolBox::dump and SymMap::dump out of line
Fix linking issue in tco and fir-opt, where the inline definitions generated references to the operator<<, whose definition was not linked in. Example: ld.lld: error: undefined symbol: Fortran::lower::operator<<(llvm::raw_ostream&, Fortran::lower::SymbolBox const&) >>> referenced by SymbolMap.h:131 (/home/gha/actions-runner/_work/llvm-project/llvm-project/flang/include/flang/Lower/SymbolMap.h:131) >>> LowerHLFIRIntrinsics.cpp.o:(Fortran::lower::SymbolBox::dump() const) in archive lib/libHLFIRTransforms.a
1 parent c848028 commit 32b7893

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

flang/include/flang/Lower/SymbolMap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct SymbolBox : public fir::details::matcher<SymbolBox> {
128128
const SymbolBox &symBox);
129129

130130
/// Dump the map. For debugging.
131-
LLVM_DUMP_METHOD void dump() const { llvm::errs() << *this << '\n'; }
131+
LLVM_DUMP_METHOD void dump() const;
132132

133133
private:
134134
VT box;
@@ -293,7 +293,7 @@ class SymMap {
293293
const SymMap &symMap);
294294

295295
/// Dump the map. For debugging.
296-
LLVM_DUMP_METHOD void dump() const { llvm::errs() << *this << '\n'; }
296+
LLVM_DUMP_METHOD void dump() const;
297297

298298
void addVariableDefinition(semantics::SymbolRef symRef,
299299
fir::FortranVariableOpInterface definingOp,

flang/lib/Lower/SymbolMap.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Fortran::lower::SymMap::lookupImpliedDo(Fortran::lower::SymMap::AcDoVar var) {
8282
return {};
8383
}
8484

85+
void Fortran::lower::SymbolBox::dump() const { llvm::errs() << *this << '\n'; }
86+
87+
void Fortran::lower::SymMap::dump() const { llvm::errs() << *this << '\n'; }
88+
8589
llvm::raw_ostream &
8690
Fortran::lower::operator<<(llvm::raw_ostream &os,
8791
const Fortran::lower::SymbolBox &symBox) {

0 commit comments

Comments
 (0)