<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/83697>83697</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            llvm-config needs to report -D_DEBUG as a cxxflag when built using Microsoft's standard library in debug mode.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dabrahams
      </td>
    </tr>
</table>

<pre>
    The ABI of Microsoft's standard library (e.g. object layout of iterators and collections) differs between standard CMake `Debug` and `Release` builds; `Debug` builds use a less-efficient representation that catches more erroneous usage at runtime.  However, `llvm-config` from a `Debug` build does not put `-D_DEBUG` in its `--cxxflags` output, and `llvm-config` is often used to generate pkg-config files, which transmit the usage requirements for LLVM to clients  (there is also no way to know from `llvm-config` whether the LLVM build used `-D_DEBUG`, although `--build-mode` comes close). When a  client uses such a .pc file to build against LLVM it results in link errors with newer MSVC libraries (and silent ODR violations with older ones).

In short: when built against the MSVC standard library, if LLVM was built with `_DEBUG` defined, `-D_DEBUG` should be among the `--cxxflags` output from the corresponding `llvm-config`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVF9v4zYM_zTKCxHDsd3k_OCHtlm3A64YcNtuj4Ms0bZWWcxEqrl--0FKtvauGPaSADTJ3x9S1MxuDoiDurlTN8eNTrJQHKweo170ypuR7Mvw64Jwe_cRaIJHZyIxTaKaAwOLDlZHC96NUccXUM0HrOYKaPwTjYDXL5Qk1znBqIUigw4WDHmPRhwFVk0P1k0TRoYR5YwYXtveP-onBLWvjzimWe3rUq329Wf0qBlzZEzOW1bt3Td5lygkRtDgkXmL0-SMwyAQ8RSRMYjODEAWLWC0mAUZVooIGCMFpJTr9YygBWIK4lasAH6iMz5jVM19BvT-ed0aCpMrsFOkFfR7JmAJGQIJnJLkz9vjH8cf7n77MWe4AE64RLfm69f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