From 30e41fb4da688d9c7c4d9bc122d8f1cb9a864f75 Mon Sep 17 00:00:00 2001 From: Paul Robinson Date: Mon, 15 Dec 2014 18:57:28 +0000 Subject: Warn when attribute 'optnone' conflicts with attributes on a different declaration of the same function. llvm-svn: 224256 --- clang/lib/CodeGen/CodeGenModule.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 06467fd..87bd955 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -769,9 +769,10 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, // OptimizeNone wins over OptimizeForSize, MinSize, AlwaysInline. assert(!F->hasFnAttribute(llvm::Attribute::OptimizeForSize) && "OptimizeNone and OptimizeForSize on same function!"); - // FIXME: Change these to asserts. - F->removeFnAttr(llvm::Attribute::MinSize); - F->removeFnAttr(llvm::Attribute::AlwaysInline); + assert(!F->hasFnAttribute(llvm::Attribute::MinSize) && + "OptimizeNone and MinSize on same function!"); + assert(!F->hasFnAttribute(llvm::Attribute::AlwaysInline) && + "OptimizeNone and AlwaysInline on same function!"); // Attribute 'inlinehint' has no effect on 'optnone' functions. // Explicitly remove it from the set of function attributes. -- cgit v1.1