[cfe-commits] [Windows] Fix PR13389 - wrong mangling of return type qualifiers

Chandler Carruth chandlerc at google.com
Thu Jul 19 14:59:12 PDT 2012


On Thu, Jul 19, 2012 at 2:16 PM, John McCall <rjmccall at apple.com> wrote:

> On Jul 19, 2012, at 1:39 PM, Timur Iskhodzhanov wrote:
> >> Otherwise it seems very, very ad-hoc,
> > I do think this is more of a general rule as the same ABCD encoding
> > should be used to fix http://llvm.org/PR13182 too.
> > Maybe I should merge these two fixes into one patch and extract a
> > "mangleCVQualifiers" function? WDYT?
> > I was planning to have this as two separate patches.
>
> If this is just about mangling CV qualifiers, then that sounds fine.
> How you choose to structures the patches doesn't matter much to me.
>
> >> which makes me worried that
> >> this it only works for the test cases we've run through it already.
> > That's TDD, right? :)
>
> TDD is not really appropriate here.  We're not developing to vague
> requirements, we're implementing a spec.  The Chromium build is not
> going to give us complete, or even near-complete, coverage of MSVC's
> mangling scheme.  Fixing just enough to get Chromium to build is not
> going to leave us with a working mangler;  it is going to leave us with
> a mangler that needs to be fixed again, and again, and again, every
> time we push a new project through it (or, for that matter, a new version
> of Chromium).
>
> You need to be running experiments and trying to look for unifying
> principles behind MSVC's manglings.  Like, you're mangling qualifiers,
> but not when it's a pointer, reference (?!), or builtin type that's
> qualified?
> Something like that?  That's a rather complicated list of special cases.
> Now, it's possible that there is no fundamental rule here, and that MSVC's
> mangler has logic just as convoluted in it;  if so, fine, the spec's the
> spec.
> But please do the investigation, looking for corner cases that illustrate
> the general rule, and leave comments and test cases behind you that
> tell us what you've done.


FWIW, I agree w/ John, but I actually think TDD can get us here, we just
need to be a bit more creative with the tests.

Imagine you start w/ a build failure in Chromium. You realize it has to do
with qualifiers, and you have the first test case.

Now, generate a *comprehensive* set of test cases for how qualifiers impact
mangling by varying all of the bits John mentions. You can do this
programmatically, and test all of them, and then you'll have test failures
which specifically indicate how best to architect the mangling for that
entity in order to not just handle a few cases, but to handle the system in
general.

Anyways, what ever the path to getting there is, getting this fundamentally
correct and tested across the edge cases and axes in which it can break is
the important result. =]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120719/15721293/attachment.html>


More information about the cfe-commits mailing list