<div dir="ltr">On Wed, May 29, 2013 at 3:55 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.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"><div class="im">On Wed, May 29, 2013 at 3:31 PM, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br>

> --- include/clang/AST/ASTConsumer.h (revision 182601)<br>
> +++ include/clang/AST/ASTConsumer.h (working copy)<br>
> @@ -92,6 +92,12 @@<br>
>    /// only exists to support Microsoft's #pragma comment(linker, "/foo").<br>
>    virtual void HandleLinkerOptionPragma(llvm::StringRef Opts) {}<br>
><br>
> +  /// \brief Handle a pragma that emits a mismatch identifier and value to<br>
> the<br>
> +  /// object file for the linker to work with.  Currently, this only exists<br>
> to<br>
> +  /// support Microsoft's #pragma detect_mismatch.<br>
> +  virtual void HandleDetectMismatch(llvm::StringRef Name,<br>
> +                                    llvm::StringRef Value) {}<br>
> +<br>
><br>
> Should we avoid broadening the ASTConsumer interface?  If we lowered the<br>
> option in Sema, then we could reuse HandleLinkerOptionPragma() without too<br>
> much fuss.  But then we're doing codegen-like work in Sema.  I'd like a<br>
> second opinion on this.  If we can do this in Sema, we can eliminate a lot<br>
> of the plumbing for this and for #pragma comment(lib).<br>
<br>
</div>I had originally done it that way, but wasn't overly keen on it.  We<br>
could reuse the TargetInfo behavior for getting the proper linker<br>
options, but it seemed like a layering violation.</blockquote><div><br></div><div style>Yeah, we'd have to use some Target interface outside of CodeGen, but I don't see anything obvious.</div><div style><br></div>
<div style>Perhaps we should continue full steam ahead on this route and refactor at a later date.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">

> +/// \brief Handle the Microsoft \#pragma detect_mismatch extension.<br>
> +///<br>
> +/// The syntax is:<br>
> +/// \code<br>
> +///   #pragma detect_mismatch("name", "value")<br>
> +/// \endcode<br>
> +/// Where 'name' and 'value' are quoted strings.  The values are embedded<br>
> in<br>
> +/// the object file and passed along to the linker.  If the linker detects<br>
> a<br>
> +/// mismatch in the object file's values for the given name, a LNK2038<br>
> error<br>
> +/// is emitted.  See MSDN for more details.<br>
><br>
> Seems reasonable to link to MSDN here.<br>
<br>
</div>I left it out for consistency, but can add it in easily enough.<br>
<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span></blockquote></div><br></div></div>