[Mlir-commits] [mlir] 52d79b0 - [mlir][llvm] Fix compiler error on GCC 9

Daniil Dudkin llvmlistbot at llvm.org
Fri May 27 05:34:18 PDT 2022


Author: Daniil Dudkin
Date: 2022-05-27T15:33:43+03:00
New Revision: 52d79b04b2628d21a328f331428f980a5ef3e2f0

URL: https://github.com/llvm/llvm-project/commit/52d79b04b2628d21a328f331428f980a5ef3e2f0
DIFF: https://github.com/llvm/llvm-project/commit/52d79b04b2628d21a328f331428f980a5ef3e2f0.diff

LOG: [mlir][llvm] Fix compiler error on GCC 9

This patch fixes the following compiler error:

    error: declaration of ‘mlir::LLVM::cconv::CConv mlir::LLVM::detail::CConvAttrStorage::CConv’ changes meaning of ‘CConv’ [-fpermissive]

CConv as a member variable name was shadowing CConv as an enumeration,
hence the compiler error.

Reviewed By: ftynse, alexbatashev

Differential Revision: https://reviews.llvm.org/D126530

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
    mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
index 4a095817ab0ce..2de2f7a7cb6a4 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
@@ -39,7 +39,7 @@ def LinkageAttr : LLVM_Attr<"Linkage"> {
 def CConvAttr : LLVM_Attr<"CConv"> {
   let mnemonic = "cconv";
   let parameters = (ins
-    "CConv":$CConv
+    "CConv":$CallingConv
   );
   let hasCustomAssemblyFormat = 1;
 }

diff  --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 9b77699ee7d8b..6f4da42908fb0 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -190,7 +190,7 @@ def CConv : DialectAttr<
     "LLVM Calling Convention specification"> {
   let storageType = "::mlir::LLVM::CConvAttr";
   let returnType = "::mlir::LLVM::cconv::CConv";
-  let convertFromStorage = "$_self.getCConv()";
+  let convertFromStorage = "$_self.getCallingConv()";
   let constBuilderCall =
           "::mlir::LLVM::CConvAttr::get($_builder.getContext(), $0)";
 }

diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 41d0521b981c2..164e966d1e1d4 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -2958,10 +2958,10 @@ Attribute LinkageAttr::parse(AsmParser &parser, Type type) {
 
 void CConvAttr::print(AsmPrinter &printer) const {
   printer << "<";
-  if (static_cast<uint64_t>(getCConv()) <= cconv::getMaxEnumValForCConv())
-    printer << stringifyEnum(getCConv());
+  if (static_cast<uint64_t>(getCallingConv()) <= cconv::getMaxEnumValForCConv())
+    printer << stringifyEnum(getCallingConv());
   else
-    printer << "INVALID_cc_" << static_cast<uint64_t>(getCConv());
+    printer << "INVALID_cc_" << static_cast<uint64_t>(getCallingConv());
   printer << ">";
 }
 


        


More information about the Mlir-commits mailing list