Debug info: Mark noreturn functions with DIFlagNoReturn.

This affects functions with the C++11 [[ noreturn ]] and C11 _Noreturn
specifiers.

Patch by Victor Leschuk!

https://reviews.llvm.org/D23168

llvm-svn: 278942
This commit is contained in:
Adrian Prantl 2016-08-17 16:20:32 +00:00
parent 002981baca
commit fd5ac8a0ea
2 changed files with 10 additions and 3 deletions

View File

@ -2657,9 +2657,13 @@ bool FunctionDecl::isGlobal() const {
}
bool FunctionDecl::isNoReturn() const {
return hasAttr<NoReturnAttr>() || hasAttr<CXX11NoReturnAttr>() ||
hasAttr<C11NoReturnAttr>() ||
getType()->getAs<FunctionType>()->getNoReturnAttr();
bool HasNoReturnAttr = hasAttr<NoReturnAttr>() || hasAttr<CXX11NoReturnAttr>()
|| hasAttr<C11NoReturnAttr>();
const auto *FuncType = getType()->getAs<FunctionType>();
bool TypeHasNoReturnAttr = false;
if (FuncType)
TypeHasNoReturnAttr = FuncType->getNoReturnAttr();
return HasNoReturnAttr || TypeHasNoReturnAttr;
}
void

View File

@ -2646,6 +2646,9 @@ void CGDebugInfo::collectFunctionDeclProps(GlobalDecl GD, llvm::DIFile *Unit,
llvm::DIScope *Mod = getParentModuleOrNull(RDecl);
FDContext = getContextDescriptor(RDecl, Mod ? Mod : TheCU);
}
// Check if it is a noreturn-marked function
if (FD->isNoReturn())
Flags |= llvm::DINode::FlagNoReturn;
// Collect template parameters.
TParamsArray = CollectFunctionTemplateParams(FD, Unit);
}