Index: include/clang-c/Index.h =================================================================== --- include/clang-c/Index.h +++ include/clang-c/Index.h @@ -3313,6 +3313,12 @@ CINDEX_LINKAGE unsigned clang_Cursor_isFunctionInlined(CXCursor C); /** + * \brief Determine whether a CXCursor that is a function declaration, is + * marked with __attribute__((noreturn)), [[gnu::noreturn]], or [[noreturn]]. + */ +CINDEX_LINKAGE unsigned clang_Cursor_isFunctionNoReturn(CXCursor C); + +/** * \brief Determine whether a CXType has the "volatile" qualifier set, * without looking through typedefs that may have added "volatile" at * a different level. Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -3545,6 +3545,15 @@ return FD->isInlined(); } +unsigned clang_Cursor_isFunctionNoReturn(CXCursor C) { + const Decl *D = getCursorDecl(C); + const FunctionDecl *FD = dyn_cast_or_null(D); + if (!FD) { + return false; + } + return FD->isNoReturn(); +} + static StringLiteral* getCFSTR_value(CallExpr *callExpr) { if (callExpr->getNumArgs() != 1) { return nullptr;