<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 - Project xgboost fails to compile when SkipFunctionBodies is specified"
   href="https://bugs.llvm.org/show_bug.cgi?id=44235">44235</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Project xgboost fails to compile when SkipFunctionBodies is specified
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>igor.bronstein@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22905" name="attach_22905" title="Minimal ASTFrontendAction example">attachment 22905</a> <a href="attachment.cgi?id=22905&action=edit" title="Minimal ASTFrontendAction example">[details]</a></span>
Minimal ASTFrontendAction example

Our tool uses ASTFrontendAction/ASTConsumer to analyze C/C++ projects.
Sometimes we specify `SkipFunctionBodies` to optimize the process. I'm
attaching `clang_tool.cpp`, a minimal example that models what's happening.

Unfortunately `xgboost` fails to compile when `SkipFunctionBodies` is `true`:

```
src/metric/elementwise_metric.cc:7:
In file included from src/metric/elementwise_metric.cu:8:
In file included from include/xgboost/metric.h:16:
include/xgboost/./data.h:204:22: error: unexpected OpenMP directive '#pragma
omp parallel for'
#pragma omp parallel for schedule(static)
                     ^
include/xgboost/./data.h:205:5: error: expected member name or ';' after
declaration specifiers
    for (long i = 0; i < batch_size; ++i) {  // NOLINT(*)
    ^
include/xgboost/./data.h:213:22: error: unexpected OpenMP directive '#pragma
omp parallel for'
#pragma omp parallel for schedule(static)
                     ^
include/xgboost/./data.h:214:5: error: expected member name or ';' after
declaration specifiers
    for (long i = 0; i < batch_size; ++i) {  // NOLINT(*)
    ^
include/xgboost/./data.h:225:4: error: expected ';' after class
  }
   ^
   ;
include/xgboost/./data.h:229:22: error: unexpected OpenMP directive '#pragma
omp parallel for'
#pragma omp parallel for schedule(dynamic, 1)
                     ^
include/xgboost/./data.h:230:5: error: expected unqualified-id
    for (bst_omp_uint i = 0; i < ncol; ++i) {
    ^
include/xgboost/./data.h:264:26: error: unknown type name 'SparsePage'; did you
mean 'xgboost::SparsePage'?
  inline void Push(const SparsePage &batch) {
                         ^~~~~~~~~~
                         xgboost::SparsePage
include/xgboost/./data.h:156:7: note: 'xgboost::SparsePage' declared here
class SparsePage {
      ^
include/xgboost/./data.h:284:26: error: unknown type name 'Inst'
  inline void Push(const Inst &inst) {
                         ^
xgboost/include/xgboost/./data.h:298:1: error: extraneous closing brace ('}')
};
^
include/xgboost/./data.h:304:17: error: unknown type name 'SparsePage'; did you
mean 'xgboost::SparsePage'?
  virtual const SparsePage& operator*() const = 0;
                ^~~~~~~~~~
                xgboost::SparsePage
include/xgboost/./data.h:156:7: note: 'xgboost::SparsePage' declared here
class SparsePage { 
```

There are similar errors for all the source files which include the affected
header file. I have an archive with `xgboost` and its dependencies, but I guess
it exceeds file size limit for this bug tracker.

Anyway I will be glad to provide you with any further information.</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>