From: Daniel Dunbar Date: Fri, 10 Apr 2009 22:14:52 +0000 (+0000) Subject: Don't set both readnone and readonly. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64c2e0762628eba26c100642521b6100c2515cc5;p=clang Don't set both readnone and readonly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68833 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index f3021dce43..bad76409cb 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1654,10 +1654,10 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, FuncAttrs |= llvm::Attribute::NoUnwind; if (TargetDecl->getAttr()) FuncAttrs |= llvm::Attribute::NoReturn; - if (TargetDecl->getAttr()) - FuncAttrs |= llvm::Attribute::ReadOnly; if (TargetDecl->getAttr()) FuncAttrs |= llvm::Attribute::ReadNone; + else if (TargetDecl->getAttr()) + FuncAttrs |= llvm::Attribute::ReadOnly; } QualType RetTy = FI.getReturnType(); diff --git a/test/CodeGen/function-attributes.c b/test/CodeGen/function-attributes.c index 373eb63b70..a12111ec94 100644 --- a/test/CodeGen/function-attributes.c +++ b/test/CodeGen/function-attributes.c @@ -43,4 +43,8 @@ int f12(int arg) { return arg ? 0 : f10_t(); } +// RUN: grep 'define void @f13() nounwind readnone' %t && +void f13(void) __attribute__((pure)) __attribute__((const)); +void f13(void){} + // RUN: true