[PATCH] [ms-cxxabi] Mangle vector types

Reid Kleckner rnk at google.com
Tue Mar 26 09:46:49 PDT 2013


On Mon, Mar 25, 2013 at 6:59 PM, John McCall <rjmccall at apple.com> wrote:

> On Mar 25, 2013, at 6:25 PM, Reid Kleckner <rnk at google.com> wrote:
> > The only vector types a user can pass from MSVC code to clang code are
> > the ones from *mmintrin.h, so we only have to match the MSVC mangling
> > for these types.  MSVC mangles the __m128 family of types as tag types,
> > which we match.  For other vector types, we emit a unique tag type
> > mangling that won't match anything produced by MSVC.
> >
> > http://llvm-reviews.chandlerc.com/D576
> >
> > Files:
> >  lib/AST/MicrosoftMangle.cpp
> >  test/CodeGenCXX/mangle-ms-vector-types.cpp
> >
> > Index: lib/AST/MicrosoftMangle.cpp
> > ===================================================================
> > --- lib/AST/MicrosoftMangle.cpp
> > +++ lib/AST/MicrosoftMangle.cpp
> > @@ -1519,12 +1519,45 @@
> >
> > void MicrosoftCXXNameMangler::mangleType(const VectorType *T,
> >                                          SourceRange Range) {
> > -  DiagnosticsEngine &Diags = Context.getDiags();
> > -  unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
> > -    "cannot mangle this vector type yet");
> > -  Diags.Report(Range.getBegin(), DiagID)
> > -    << Range;
> > +  if (!T->getElementType()->isBuiltinType()) {
>
> You do a getAs<BuiltinType>() right below this;  just do that and check
> for null.
>

OK.


> > +    DiagnosticsEngine &Diags = Context.getDiags();
> > +    unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
> > +      "cannot mangle vectors of non-builtin types");
> > +    Diags.Report(Range.getBegin(), DiagID)
> > +      << Range;
> > +  }
>
> You're not testing this diagnostic.  I can tell because you've forgotten
> to early-exit,
> so you'll actually crash if you're not given a BuiltinType. :)
>
> You'll need to put the diagnostic in a separate file that's expected to
> fail, but
> you should be able to put multiple such tests in such a file.
>
> Otherwise this looks fine.
>

It seems I can't actually test this case because we don't have any vector
attributes that work on complex types.  We already issue a diagnostic for
that earlier.  I'll make this check an assert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130326/989aff01/attachment.html>


More information about the cfe-commits mailing list