Skip to content

Commit

Permalink
[DAPHNE-daphne-eu#830] Fix anonymous namespace issue when compiling w…
Browse files Browse the repository at this point in the history
…ith Clang

When compiling with clang, there is a issue at runtime (LLVM complaining about anonymous namespaces not allowed in various places). These are hereby replaced with a non-anonymous namespace. For the lack of creativity these are all called "file_local".
  • Loading branch information
corepointer committed Sep 24, 2024
1 parent 232e4e1 commit 3827c02
Show file tree
Hide file tree
Showing 5 changed files with 611 additions and 608 deletions.
8 changes: 4 additions & 4 deletions src/compiler/lowering/LowerToLLVMPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ class GenericCallOpLowering
}
};

namespace {
namespace file_local {
struct DaphneLowerToLLVMPass
: public PassWrapper<DaphneLowerToLLVMPass, OperationPass<ModuleOp>> {
explicit DaphneLowerToLLVMPass(const DaphneUserConfig &cfg) : cfg(cfg) {}
Expand All @@ -1073,9 +1073,9 @@ struct DaphneLowerToLLVMPass
}
void runOnOperation() final;
};
} // end anonymous namespace
} // end file_local namespace

void DaphneLowerToLLVMPass::runOnOperation() {
void file_local::DaphneLowerToLLVMPass::runOnOperation() {
auto module = getOperation();

RewritePatternSet patterns(&getContext());
Expand Down Expand Up @@ -1148,5 +1148,5 @@ void DaphneLowerToLLVMPass::runOnOperation() {

std::unique_ptr<Pass>
daphne::createLowerToLLVMPass(const DaphneUserConfig &cfg) {
return std::make_unique<DaphneLowerToLLVMPass>(cfg);
return std::make_unique<file_local::DaphneLowerToLLVMPass>(cfg);
}
6 changes: 3 additions & 3 deletions src/compiler/lowering/PhyOperatorSelectionPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ class MatMulOpLowering : public OpConversionPattern<daphne::MatMulOp> {
}
};

namespace {
namespace file_local {
struct PhyOperatorSelectionPass
: public PassWrapper<PhyOperatorSelectionPass, OperationPass<ModuleOp>> {
explicit PhyOperatorSelectionPass() {}
void runOnOperation() final;
};
} // end anonymous namespace

void PhyOperatorSelectionPass::runOnOperation() {
void file_local::PhyOperatorSelectionPass::runOnOperation() {
auto module = getOperation();

ConversionTarget target(getContext());
Expand Down Expand Up @@ -116,5 +116,5 @@ void PhyOperatorSelectionPass::runOnOperation() {
}

std::unique_ptr<Pass> daphne::createPhyOperatorSelectionPass() {
return std::make_unique<PhyOperatorSelectionPass>();
return std::make_unique<file_local::PhyOperatorSelectionPass>();
}
6 changes: 3 additions & 3 deletions src/compiler/lowering/RewriteSqlOpPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

using namespace mlir;

namespace {
namespace file_local {

std::unordered_map<std::string, mlir::Value> tables;
struct SqlReplacement : public RewritePattern {
Expand Down Expand Up @@ -86,7 +86,7 @@ struct RewriteSqlOpPass
};
} // namespace

void RewriteSqlOpPass::runOnOperation() {
void file_local::RewriteSqlOpPass::runOnOperation() {
auto module = getOperation();

RewritePatternSet patterns(&getContext());
Expand All @@ -103,5 +103,5 @@ void RewriteSqlOpPass::runOnOperation() {
}

std::unique_ptr<Pass> daphne::createRewriteSqlOpPass() {
return std::make_unique<RewriteSqlOpPass>();
return std::make_unique<file_local::RewriteSqlOpPass>();
}
Loading

0 comments on commit 3827c02

Please sign in to comment.