<div dir="ltr">On Mon, Mar 25, 2013 at 6:59 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mar 25, 2013, at 6:25 PM, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br>
> The only vector types a user can pass from MSVC code to clang code are<br>
> the ones from *mmintrin.h, so we only have to match the MSVC mangling<br>
> for these types. MSVC mangles the __m128 family of types as tag types,<br>
> which we match. For other vector types, we emit a unique tag type<br>
> mangling that won't match anything produced by MSVC.<br>
><br>
> <a href="http://llvm-reviews.chandlerc.com/D576" target="_blank">http://llvm-reviews.chandlerc.com/D576</a><br>
><br>
> Files:<br>
> lib/AST/MicrosoftMangle.cpp<br>
> test/CodeGenCXX/mangle-ms-vector-types.cpp<br>
><br>
> Index: lib/AST/MicrosoftMangle.cpp<br>
> ===================================================================<br>
> --- lib/AST/MicrosoftMangle.cpp<br>
> +++ lib/AST/MicrosoftMangle.cpp<br>
> @@ -1519,12 +1519,45 @@<br>
><br>
> void MicrosoftCXXNameMangler::mangleType(const VectorType *T,<br>
> SourceRange Range) {<br>
> - DiagnosticsEngine &Diags = Context.getDiags();<br>
> - unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,<br>
> - "cannot mangle this vector type yet");<br>
> - Diags.Report(Range.getBegin(), DiagID)<br>
> - << Range;<br>
> + if (!T->getElementType()->isBuiltinType()) {<br>
<br>
You do a getAs<BuiltinType>() right below this; just do that and check for null.<br></blockquote><div><br></div><div style>OK.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> + DiagnosticsEngine &Diags = Context.getDiags();<br>
> + unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,<br>
> + "cannot mangle vectors of non-builtin types");<br>
> + Diags.Report(Range.getBegin(), DiagID)<br>
> + << Range;<br>
> + }<br>
<br>
You're not testing this diagnostic. I can tell because you've forgotten to early-exit,<br>
so you'll actually crash if you're not given a BuiltinType. :)<br>
<br>
You'll need to put the diagnostic in a separate file that's expected to fail, but<br>
you should be able to put multiple such tests in such a file.<br>
<br>
Otherwise this looks fine.<br></blockquote><div style><br></div><div style>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. </div>
</div></div></div>