[PATCH] D144337: Prevent line 0 instructions from dividing a lexical block into ranges

ykhatav via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 4 09:38:26 PST 2023


ykhatav added a comment.

In D144337#4167827 <https://reviews.llvm.org/D144337#4167827>, @probinson wrote:

> It seems strange to define the enum in a header for a module that uses it only once, and externalize it in a module that uses it several times.
>
> I'd always thought this DefaultOnOff business should be generalized...  Hmm I see boolOrDefault in CommandLine.h.  Maybe we could convert UnknownLocations to use that, remove `static` from the definition, and then LexicalScopes.cpp can reference it as an extern.
> I agree with you that UnknownLocations may be better defined with boolorDefault instead of DefaultOnOff. I can change that.

However,  the reason I moved the definition of UnknownLocations to LexicalScopes.cpp was to avoid a link-time error. Defining UnknownLocations as extern in LexicalScopes.cpp gives a link-time error despite removing the "static" keyword from its definition in DwarfDebug.cpp. I see that the two object files are in different directories and while building the LexicalScopes.cpp file it is unable to find the definition of UnknownLocations. I am aware that it may not be the optimal approach so I would appreciate any feedback or consider alternative methods.

> (Converting the rest of the DwarfDebug.cpp options from DefaultOnOff to boolOrDefault should not be part of your task. But maybe add a FIXME on the enum definition.)




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144337



More information about the llvm-commits mailing list