Details
Diff Detail
- Repository
- rLLD LLVM Linker
- Build Status
Buildable 25183 Build 25182: arc lint + arc unit
Event Timeline
I think what @dschuff said in this comment was not removing all using from headers, but removing using namespace from headers.. no? We are not using using namespace in header files already.
I think some redundant includes should definitely go (IWYU). Regarding more granular using declarations, honestly it's up to @ruiu, Clang and LLDB handle it by aliasing some of LLVM's common classes in their respective namespaces, maybe that could work for LLD too? In fact I'm guessing that's the purpose of lld/Common/LLVM.h, you could take a similar approach for Wasm specific stuff and limit the using statements to your namespace.
Your guess is correct; lld/Common/LLVM.h is to using some identifiers so that they can be referred without namespace specifiers. In fact, I think it is fine to add Wasm* names to that file because it is obvious that they will never conflict with other names because of Wasm prefix. Some names are ambiguous, such as llvm::object::Archive, and it is better to refer them using a fully qualified name, as we have other classes with confusing names (e.g. lld::*::ArchiveFile).
That does mean that lld/Common/LLVM.h will need to include llvm/Object/Wasm.h. It seems strange that has not been necessary for ELF/ COFF so far but I'll upload a new version this change and you can see what you think of it.
LGTM. This is fine to me. We could create lld/wasm/LLVM.h to import Wasm* identifiers, but adding these identifiers directly to llvm/Common/LLVM.h makes more sense to me because the number of symbols we want to import is small.
That does mean that lld/Common/LLVM.h will need to include llvm/Object/Wasm.h. It seems strange that has not been necessary for ELF/ COFF so far but I'll upload a new version this change and you can see what you think of it.
As you noticed, you don't actually have to include llvm/Object/Wasm.h. You just need to declare class/struct names in lld/Common/LLVM.h.
include/lld/Common/LLVM.h | ||
---|---|---|
54 ↗ | (On Diff #175360) | nit: add a blank line before a new namespace declaration. |