<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Assertion failure when expanding variadic macros for plist output"
   href="https://bugs.llvm.org/show_bug.cgi?id=44493">44493</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure when expanding variadic macros for plist output
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>xazax.hun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I get the following assertion failure:

clang-10:
/usr/local/google/home/xazax/LLVM/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:1171:
(anonymous namespace)::MacroNameAndArgs
getMacroNameAndArgs(clang::SourceLocation, const clang::Preprocessor &):
Assertion `TheTok.is(tok::r_paren) && "Expanded macro argument acquisition
failed! After the end of the loop" " this token should be ')'!"' failed.

I vaguely recall variadic macros not being supported yet, but I think we should
not have an assert failure.

Minimal repro:
#define log(args...) \
  do {               \
  } while (0)

int main(int argc, char** argv) {
  log("arg");
  log("arg", "arg2");

  int a;
  a & 0xffc00000;
  return 0;
}

Command line:
clang-10 --analyze --analyzer-output plist-multi-file -o out.plist -Xclang
-analyzer-config -Xclang expand-macros=true minimal.cpp</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>