Skip to content

Commit

Permalink
[mlir][llvm] Fix compiler error on GCC 9
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Daniil Dudkin committed May 27, 2022
1 parent a94d454 commit 52d79b0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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)";
}
Expand Down
6 changes: 3 additions & 3 deletions mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << ">";
}

Expand Down

0 comments on commit 52d79b0

Please sign in to comment.