[PATCH] D80099: [llvm-objcopy][MachO] Add support for removing Swift symbols
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 13:44:24 PDT 2020
alexshap marked an inline comment as done.
alexshap added inline comments.
================
Comment at: llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp:77
+ if (Config.StripSwiftSymbols &&
+ (Obj.Header.Flags & MachO::MH_DYLDLINK == MachO::MH_DYLDLINK) &&
+ Obj.SwiftVersion && *Obj.SwiftVersion && N->isSwiftSymbol())
----------------
smeenai wrote:
> `&` has stupidly low precedence in C/C++ (because `&&` didn't exist once upon a time), so this is gonna parse as
>
> ```
> (Obj.Header.Flags & (MachO::MH_DYLDLINK == MachO::MH_DYLDLINK))
> ```
>
> You'll need the parens around `(Obj.Header.Flags & MachO::MH_DYLDLINK)` instead.
>
> Moreover, since `MH_DYLDLINK` is a single bit, can't you just do
>
> ```
> (Obj.Header.Flags & MachO::MH_DYLDLINK)
> ```
>
> or, if you wanna be really explicit
>
> ```
> (Obj.Header.Flags & MachO::MH_DYLDLINK) != 0
> ```
>
> ?
good catch, thanks!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80099/new/
https://reviews.llvm.org/D80099
More information about the llvm-commits
mailing list