[PATCH] Have clang list the imported modules in the debug info

Eric Christopher echristo at gmail.com
Wed May 6 14:35:26 PDT 2015


On Wed, May 6, 2015 at 2:26 PM Adrian Prantl <aprantl at apple.com> wrote:

>
> > On May 5, 2015, at 8:07 PM, David Blaikie <dblaikie at gmail.com> wrote:
> >
> > If we believe hash collisions to be an issue - then type units are
> broken and I'd like to figure out how to fix them, then use the same
> feature here.
> >
>
> This led me to perform a little experiment: I had a python script
> calculate the MD5 sum of ~60.000 unique mangled type names that I extracted
> from the IR of a clang LTO build. There was not a single collision in the
> abbreviated 64-bit hashes, and I had to truncate the length of the hash
> values to 32 bits before I was able to produced even a single collision.
>
> I think now that hash collisions might be a red herring and a calculable
> risk that we can decide to ignore.
>
> The only thing that we cannot ignore here is that for ODR-less languages
> two types may legally have the same mangled name (and thus hash) when they
> are defined in two different modules. This means we can’t use type units
> for these languages and external type reference must be a pair of mangled
> name and module.
>
>
If it's a new language then you designed your language poorly ;)

That said, add enough to the name for hashing purposes to make it hash
uniquely? Or you can go down the path of hashing the type similar to the
fission CU hashing (which is what type units were arguably designed to do
in the first place if you take a look at the standard, we just only use
them for ODR compliant languages etc right now).

-eric


> -- adrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150506/0f1c4a08/attachment.html>


More information about the cfe-commits mailing list