[llvm-bugs] [Bug 32691] New: Add clang_isNoReturnFunction to determine if a function is __attribute__((noreturn))

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 17 20:30:36 PDT 2017


            Bug ID: 32691
           Summary: Add clang_isNoReturnFunction to determine if a
                    function is __attribute__((noreturn))
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: harlan at harlanhaskins.com
                CC: klimek at google.com, llvm-bugs at lists.llvm.org

Currently, libclang doesn't have a wrapper to determine if a given CXCursor is
a function decorated with __attribute__((noreturn)).

It can be implemented as such:

int clang_isNoReturn(CXCursor cursor) {
  assert(cursor.kind == CXCursor_FunctionDecl);
  auto fn = static_cast<const clang::FunctionDecl *>(cursor.data[0]);
  if (!fn) return 0;
  return fn->isNoReturn() ? 1 : 0;

If this is something that's wanted or useful, I'd be happy to submit a patch.

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/20170418/d2bfb973/attachment.html>

More information about the llvm-bugs mailing list