[clang] [CIR] Implement 'weak-ref' lowering (PR #238538)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 17:49:47 PST 2026


================
@@ -946,14 +946,11 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase &base) {
     // at properties of the most recent declaration at the point of emission.
     d = cast<ValueDecl>(d->getMostRecentDecl());
 
-    if (d->hasAttr<WeakRefAttr>()) {
-      cgm.errorNYI(d->getSourceRange(),
-                   "ConstantLValueEmitter: emit pointer base for weakref");
-      return {};
-    }
-
     if (auto *fd = dyn_cast<FunctionDecl>(d)) {
-      cir::FuncOp fop = cgm.getAddrOfFunction(fd);
+      cir::FuncOp fop =
----------------
andykaylor wrote:

Could we move `emitFunctionDeclPointer` to CIRGenFunction and use it here? It's only one use, but it's clearly duplicated logic.

https://github.com/llvm/llvm-project/pull/238538


More information about the cfe-commits mailing list