aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenModule.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 895a07e..45dfcf5 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -655,6 +655,16 @@ mlir::Value CIRGenModule::getAddrOfGlobalVar(const VarDecl *d, mlir::Type ty,
g.getSymName());
}
+cir::GlobalViewAttr CIRGenModule::getAddrOfGlobalVarAttr(const VarDecl *d) {
+ assert(d->hasGlobalStorage() && "Not a global variable");
+ mlir::Type ty = getTypes().convertTypeForMem(d->getType());
+
+ cir::GlobalOp globalOp = getOrCreateCIRGlobal(d, ty, NotForDefinition);
+ assert(!cir::MissingFeatures::addressSpace());
+ cir::PointerType ptrTy = builder.getPointerTo(globalOp.getSymType());
+ return builder.getGlobalViewAttr(ptrTy, globalOp);
+}
+
void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *vd,
bool isTentative) {
if (getLangOpts().OpenCL || getLangOpts().OpenMPIsTargetDevice) {