summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-03-05 08:30:04 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-03-05 08:30:04 +0000
commit49af6290578500190a1c915721b12f5eefd51d4d (patch)
tree7590f1d4ba3ce0ce95f86a41503bd7d806357484 /clang/lib/CodeGen/CGCall.cpp
parente750491ff33d5ab1fbfae5d530a6769074154730 (diff)
downloadbcm5719-llvm-49af6290578500190a1c915721b12f5eefd51d4d.tar.gz
bcm5719-llvm-49af6290578500190a1c915721b12f5eefd51d4d.zip
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
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp5
1 files changed, 4 insertions, 1 deletions
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<FunctionProtoType>();
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<CXXMethodDecl>(Fn);
+ if (Fn->isNoReturn() && !(AttrOnCallSite && MD && MD->isVirtual()))
FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
}
OpenPOWER on IntegriCloud