From 49af6290578500190a1c915721b12f5eefd51d4d Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 5 Mar 2013 08:30:04 +0000 Subject: Don't emit calls to virtual [[noreturn]] functions as noreturn; overrides of a [[noreturn]] function are not required to also be [[noreturn]]. We still emit calls to virtual __attribute__((noreturn)) functions as noreturn; unlike GCC, we do require overriders to also be noreturn for that attribute. llvm-svn: 176476 --- clang/lib/CodeGen/CGCall.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 4e8e724ea5a..6aabd64f9bd 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -993,7 +993,10 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, const FunctionProtoType *FPT = Fn->getType()->getAs(); if (FPT && FPT->isNothrow(getContext())) FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); - if (Fn->isNoReturn()) + // Don't use [[noreturn]] or _Noreturn for a call to a virtual function. + // These attributes are not inherited by overloads. + const CXXMethodDecl *MD = dyn_cast(Fn); + if (Fn->isNoReturn() && !(AttrOnCallSite && MD && MD->isVirtual())) FuncAttrs.addAttribute(llvm::Attribute::NoReturn); } -- cgit v1.2.3