This is an archive of the discontinued LLVM Phabricator instance.

Rename the 'concept' variable in SymbolInterfaces.td
ClosedPublic

Authored by lxsameer on Mar 25 2021, 12:47 PM.

Details

Summary

concept is a reserved keyword in C++20 and since we're using it as a variable name in mlir/include/mlir/IR/SymbolInterfaces.td it breaks the compilation under C++20.
here is an example of the failure (from a project of mine):

FAILED: src/CMakeFiles/lserene.dir/sir/sir.cpp.o 
/usr/bin/cmake -E __run_co_compile --tidy="clang-tidy;--extra-arg-before=--driver-mode=g++" --source=../src/sir/sir.cpp -- /home/lxsameer/usr/lib/llvm-13/bin/clang++ -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/lxsameer/usr/lib/llvm-13/include -I../include -Iinclude -I. -I_deps/fmtlib-src/include -Wall -Wextra -Werror -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -g -g -fno-omit-frame-pointer -fsanitize=address   -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -std=c++20 -MD -MT src/CMakeFiles/lserene.dir/sir/sir.cpp.o -MF src/CMakeFiles/lserene.dir/sir/sir.cpp.o.d -o src/CMakeFiles/lserene.dir/sir/sir.cpp.o -c ../src/sir/sir.cpp
/home/lxsameer/usr/lib/llvm-13/include/mlir/IR/SymbolInterfaces.h.inc:155:13: error: expected unqualified-id [clang-diagnostic-error]
      auto *concept = getInterfaceFor(op);
            ^
/home/lxsameer/usr/lib/llvm-13/include/mlir/IR/SymbolInterfaces.h.inc:156:12: error: expected expression [clang-diagnostic-error]
      if (!concept)
           ^
/home/lxsameer/usr/lib/llvm-13/include/mlir/IR/SymbolInterfaces.h.inc:158:15: error: expected expression [clang-diagnostic-error]
      return !concept->isOptionalSymbol(op) ||
              ^
6 warnings and 3 errors generated.

Diff Detail

Event Timeline

lxsameer created this revision.Mar 25 2021, 12:47 PM
lxsameer requested review of this revision.Mar 25 2021, 12:47 PM
mehdi_amini accepted this revision.Mar 25 2021, 1:19 PM

Thanks!

This revision is now accepted and ready to land.Mar 25 2021, 1:19 PM

@mehdi_amini Since I don't have commit access, would you do me the honor of merging this one please ?
for the commit info, name: Sameer Rahmani email: lxsameer@gnu.org

thanks

This revision was automatically updated to reflect the committed changes.