<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 --- - [libtooling] ASTContext::getObjCInstanceType never returns null - it creates typedef if type is not known"
   href="https://llvm.org/bugs/show_bug.cgi?id=30674">30674</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[libtooling] ASTContext::getObjCInstanceType never returns null - it creates typedef if type is not known
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>libclang
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>akotulski@fb.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Docs for getObjCInstanceType say:
"Retrieve the Objective-C "instancetype" type, if already known;
otherwise, returns a NULL type;"

This is obviously not true, by looking at source code, I also tested it on
clang trunk from August to confirm. It would be great if there was a way to
know if getObjCInstanceType is known or not without creating it.



This is how source code looks like:
QualType getObjCInstanceType() {
  return getTypeDeclType(getObjCInstanceTypeDecl());
}

TypedefDecl *getObjCInstanceTypeDecl() {
  if (!ObjCInstanceTypeDecl)
    ObjCInstanceTypeDecl = TypedefDecl::Create(...)
  }
  return ObjCInstanceTypeDecl;
}</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>