[llvm-bugs] [Bug 30674] New: [libtooling] ASTContext::getObjCInstanceType never returns null - it creates typedef if type is not known

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 12 03:04:00 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30674

            Bug ID: 30674
           Summary: [libtooling] ASTContext::getObjCInstanceType never
                    returns null - it creates typedef if type is not known
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: akotulski at fb.com
                CC: klimek at google.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

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;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161012/05663adf/attachment-0001.html>


More information about the llvm-bugs mailing list