]> granicus.if.org Git - clang/commitdiff
Don't set both readnone and readonly.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 10 Apr 2009 22:14:52 +0000 (22:14 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 10 Apr 2009 22:14:52 +0000 (22:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68833 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
test/CodeGen/function-attributes.c

index f3021dce43c7fd816e51c1990db4117cff8b7ebe..bad76409cb1315b7b887312f628565696be6d4d8 100644 (file)
@@ -1654,10 +1654,10 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
       FuncAttrs |= llvm::Attribute::NoUnwind;
     if (TargetDecl->getAttr<NoReturnAttr>())
       FuncAttrs |= llvm::Attribute::NoReturn;
-    if (TargetDecl->getAttr<PureAttr>())
-      FuncAttrs |= llvm::Attribute::ReadOnly;
     if (TargetDecl->getAttr<ConstAttr>())
       FuncAttrs |= llvm::Attribute::ReadNone;
+    else if (TargetDecl->getAttr<PureAttr>())
+      FuncAttrs |= llvm::Attribute::ReadOnly;
   }
 
   QualType RetTy = FI.getReturnType();
index 373eb63b700c10fcea92daa7c9da25acf80ace42..a12111ec94acc6f69cedda3ad2c234414e8e657b 100644 (file)
@@ -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