Skip to content

Commit a76df89

Browse files
committed
Revert "[clang][CIR] Change buildX functions to emitX (llvm#115568)"
This reverts commit 1791b25.
1 parent ec034bd commit a76df89

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mlir::Location CIRGenModule::getLoc(SourceRange cRange) {
5050
return mlir::FusedLoc::get({begin, end}, metadata, builder.getContext());
5151
}
5252

53-
void CIRGenModule::emitGlobal(clang::GlobalDecl gd) {
53+
void CIRGenModule::buildGlobal(clang::GlobalDecl gd) {
5454
const auto *global = cast<ValueDecl>(gd.getDecl());
5555

5656
if (const auto *fd = dyn_cast<FunctionDecl>(global)) {
@@ -71,19 +71,19 @@ void CIRGenModule::emitGlobal(clang::GlobalDecl gd) {
7171
}
7272

7373
// TODO(CIR): Defer emitting some global definitions until later
74-
emitGlobalDefinition(gd);
74+
buildGlobalDefinition(gd);
7575
}
7676

77-
void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd,
78-
mlir::Operation *op) {
77+
void CIRGenModule::buildGlobalFunctionDefinition(clang::GlobalDecl gd,
78+
mlir::Operation *op) {
7979
auto const *funcDecl = cast<FunctionDecl>(gd.getDecl());
8080
auto funcOp = builder.create<cir::FuncOp>(
8181
getLoc(funcDecl->getSourceRange()), funcDecl->getIdentifier()->getName());
8282
theModule.push_back(funcOp);
8383
}
8484

85-
void CIRGenModule::emitGlobalDefinition(clang::GlobalDecl gd,
86-
mlir::Operation *op) {
85+
void CIRGenModule::buildGlobalDefinition(clang::GlobalDecl gd,
86+
mlir::Operation *op) {
8787
const auto *decl = cast<ValueDecl>(gd.getDecl());
8888
if (const auto *fd = dyn_cast<FunctionDecl>(decl)) {
8989
// TODO(CIR): Skip generation of CIR for functions with available_externally
@@ -99,15 +99,15 @@ void CIRGenModule::emitGlobalDefinition(clang::GlobalDecl gd,
9999

100100
if (fd->isMultiVersion())
101101
errorNYI(fd->getSourceRange(), "multiversion functions");
102-
emitGlobalFunctionDefinition(gd, op);
102+
buildGlobalFunctionDefinition(gd, op);
103103
return;
104104
}
105105

106-
llvm_unreachable("Invalid argument to CIRGenModule::emitGlobalDefinition");
106+
llvm_unreachable("Invalid argument to CIRGenModule::buildGlobalDefinition");
107107
}
108108

109109
// Emit code for a single top level declaration.
110-
void CIRGenModule::emitTopLevelDecl(Decl *decl) {
110+
void CIRGenModule::buildTopLevelDecl(Decl *decl) {
111111

112112
// Ignore dependent declarations.
113113
if (decl->isTemplated())
@@ -123,7 +123,7 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
123123
auto *fd = cast<FunctionDecl>(decl);
124124
// Consteval functions shouldn't be emitted.
125125
if (!fd->isConsteval())
126-
emitGlobal(fd);
126+
buildGlobal(fd);
127127
break;
128128
}
129129
}

clang/lib/CIR/CodeGen/CIRGenModule.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ class CIRGenModule : public CIRGenTypeCache {
7272
mlir::Location getLoc(clang::SourceLocation cLoc);
7373
mlir::Location getLoc(clang::SourceRange cRange);
7474

75-
void emitTopLevelDecl(clang::Decl *decl);
75+
void buildTopLevelDecl(clang::Decl *decl);
7676

7777
/// Emit code for a single global function or variable declaration. Forward
7878
/// declarations are emitted lazily.
79-
void emitGlobal(clang::GlobalDecl gd);
79+
void buildGlobal(clang::GlobalDecl gd);
8080

81-
void emitGlobalDefinition(clang::GlobalDecl gd,
82-
mlir::Operation *op = nullptr);
83-
void emitGlobalFunctionDefinition(clang::GlobalDecl gd, mlir::Operation *op);
81+
void buildGlobalDefinition(clang::GlobalDecl gd,
82+
mlir::Operation *op = nullptr);
83+
void buildGlobalFunctionDefinition(clang::GlobalDecl gd, mlir::Operation *op);
8484

8585
/// Helpers to emit "not yet implemented" error diagnostics
8686
DiagnosticBuilder errorNYI(llvm::StringRef);

clang/lib/CIR/CodeGen/CIRGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mlir::ModuleOp CIRGenerator::getModule() const { return cgm->getModule(); }
4545
bool CIRGenerator::HandleTopLevelDecl(DeclGroupRef group) {
4646

4747
for (Decl *decl : group)
48-
cgm->emitTopLevelDecl(decl);
48+
cgm->buildTopLevelDecl(decl);
4949

5050
return true;
5151
}

0 commit comments

Comments
 (0)