<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - Some &quot;feature&quot; names can't be used in module map &quot;requires&quot;" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23614&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=FB4-VgcyNLVFE1fQqjqctERx76aEx55gq3V4vVl65jI&s=l_QcMKIInNDWdLAHW_faNoaC2b0NwT1x39qUG_ppjPA&e=">23614</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Some "feature" names can't be used in module map "requires"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Modules
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>John.Thompson.JTSoftware@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The clang clang/lib/Headers/module.modulemap file has the two module entries:

    explicit module sse4_1 {
      requires sse41
      export ssse3
      header "smmintrin.h"
    }

    explicit module sse4_2 {
      requires sse42
      export sse4_1
      header "nmmintrin.h"
    }

However, “sse41” and “sse42” in the requires don’t match the “sse4.1” and
“sse4.2” target features upon which this requires mechanism appears to be
based.  This leads to error messages like:

4.cpp:5:12: error: call to '_mm_blendv_ps' is ambiguous
    return _mm_blendv_ps(x,y,z);
           ^~~~~~~~~~~~~
...\lib\clang\include\smmintrin.h:103:1: note: candidate function
_mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)
^
...\lib\clang\include\smmintrin.h:103:1: note: candidate function
_mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)
^
1 error generated.

Because the ‘.’ makes the requires name an invalid identifier, either the
feature name needs to change, or there needs to be some kinds of mapping or
substitution done.  For example, I understand changing the feature name might
be problematic, so changing the module map to use “sse4_1” and have clang
replace the ‘_’ with ‘.’ before the feature check, or just map the problematic
names, or decouple the “requires” names from the features names, are some
possible options.  What do you think?

But also, this raises another issue.  The reason I get the error is because the
compiler silently failed to match the requires argument, but went ahead and
processed the header textually or something, leading to the confusing error. 
Could we improve the error detection here?  Are there other situations where a
silent failure is problematic?

Perhaps make the hasFeature return a three-state value with one that will
indicate invalid feature name?

Thanks.

-John</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>