[cfe-dev] Adding custom builtins

Daniel Kudrow dkudrow at gmail.com
Wed Oct 24 11:57:01 PDT 2012


Hi all,
I'm hacking clang to parse a c-like quantum programming language and am
having trouble parsing builtin functions. It seems to me
that FunctionDecl::getBuiltinID() [Decl.cpp] is chiefly responsible for
determining whether a function identifier is a builtin or not. However the
guts of this function: IdentifierInfo::getBuiltinID() [IdentfierTable.h]
but it appears to me that this function will only recognize objective c
builtins.

  /// getBuiltinID - Return a value indicating whether this is a builtin
  /// function.  0 is not-built-in.  1 is
builtin-for-some-nonprimary-target.
  /// 2+ are specific builtin functions.
  unsigned getBuiltinID() const {
    if (ObjCOrBuiltinID >= tok::NUM_OBJC_KEYWORDS)
      return ObjCOrBuiltinID - tok::NUM_OBJC_KEYWORDS;
    else
      return 0;
  }

Am I missing a step in the builtin lookup process?

Many thanks,
Dani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121024/0e248f37/attachment.html>


More information about the cfe-dev mailing list