[clang] [CIR] Upstream global variable linkage types (PR #129072)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 28 01:07:07 PST 2025


================
@@ -0,0 +1,63 @@
+//===- CIROpInterfaces.td - CIR Op Interface Definitions --------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_CIR_OP_INTERFACES
+#define MLIR_CIR_OP_INTERFACES
+
+include "mlir/IR/OpBase.td"
+
+let cppNamespace = "::cir" in {
+  def CIRGlobalValueInterface
+      : OpInterface<"CIRGlobalValueInterface"> {
+
+    let methods = [
+      InterfaceMethod<"",
+      "bool", "hasAvailableExternallyLinkage", (ins), [{}],
+      /*defaultImplementation=*/[{ return false; }]
----------------
xlauko wrote:

Why does this return false by default? Shouldn't this follow same pattern as other `has` methods, i.e.:
```
/*defaultImplementation=*/[{
     return cir::isAvailableExternallyLinkage($_op.getLinkage());
 }]
```


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


More information about the cfe-commits mailing list