[PATCH] D13038: dsymutil: Resolve forward decls for types defined in clang modules.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 08:50:35 PDT 2015

aprantl added inline comments.

Comment at: tools/dsymutil/DwarfLinker.cpp:1667-1672
@@ -1656,7 +1666,8 @@
   // FIXME: dsymutil-classic compat won't unique the same type
   // presented once as a struct and once as a class. Use the Tag in
   // the fully qualified name hash to get the same effect.
   // We hash NameRef, which is the mangled name, in order to get most
   // overloaded functions resolvec correctly.
   unsigned Hash = hash_combine(Context.getQualifiedNameHash(), Tag, NameRef);
friss wrote:
> >> The fact that we hash the Tag here prevents us from uniquing what's in a module and standard namespaces.
> > 
> > Even if we wouldn't hash the Tag, we would still hash the module's name (NameRef) which is crucial in order to support (Obj)C because it is legal to have conflicting definitions for the same type in two differently named modules.
> Yes, I know that. I'm thinking of something different. Let's take a C++ program that uses a module called Foo. If the same program has a namespace called Foo (unrelated to the module), then we could have ODR uniquing collisions between unrelated things if we didn't hash the Tag.
> I'm just saying that we should promote the FIXME comment from a bug I wanted to remove to a feature that's needed.
Got it now. I thought you were getting at that we aren't be able to unique types if one file imports a module and a second file is compiled without -fmodules and just #includes the module header.


More information about the llvm-commits mailing list