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:
parent
002981baca
commit
fd5ac8a0ea
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user