[PATCH] D130426: [CodeGen] Fixed ambiguous symbol ExtAddrMode in case of NDEBUG and LLVM_ENABLE_DUMP

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 23 12:17:51 PDT 2022


barannikov88 added inline comments.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:2618
 
+} // end anonymous namespace
+
----------------
slydiman wrote:
> barannikov88 wrote:
> > slydiman wrote:
> > > barannikov88 wrote:
> > > > slydiman wrote:
> > > > > barannikov88 wrote:
> > > > > > Please refer to [[ https://llvm.org/docs/CodingStandards.html#anonymous-namespaces | the coding style ]], in particular:
> > > > > > > Because of this, we have a simple guideline: make anonymous namespaces as small as possible, and only use them for class declarations.
> > > > > > 
> > > > > It seems the function void ExtAddrMode::print() is related to the struct ExtAddrMode declared above inside the anonymous namespace.
> > > > > Please correct me if I'm wrong. Do you have any suggestions how to fix this error other way?
> > > > `print` is defined under `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)`.
> > > > It should be declared under the same macros. Same for `dump`.
> > > > 
> > > > As for the error, it seems that it is picking ExtAddrMode from TargetInstrInfo.h somehow (note that it says 'print': is not a member of '**llvm::**ExtAddrMode',) though I could not find where this header is included. Are you sure you don't have any local changes that may trigger the issue?
> > > > 
> > > I have no any changes. Just defined NDEBUG and LLVM_ENABLE_DUMP.
> > > I have no any changes.
> > According to the description, the compiler complains about line 2562, which does not contain 'printf', so I assumed that you have modified the source (or, at least, have an outdated version).
> > 
> > > Just defined NDEBUG and LLVM_ENABLE_DUMP.
> > Defining both of these macros does not trigger the error for me. But my build OS is Linux.
> > 
> > I have no other ideas what could go wrong here, maybe others do?
> > 
> I have updated the summary with more details.
So, it is indeed confused with the same-named class from TargetInstrInfo.h. Could you track where it is included?
Adding #error directive to TargetInstrInfo.h and recompiling single CodeGenPrepare.cpp should help to identify this place. For me, however, adding this directive does not prevent the cpp file from being successfully compiled.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130426/new/

https://reviews.llvm.org/D130426



More information about the llvm-commits mailing list