As a follow-up to r212835, also add the LLVM nonnull function attribute when
__attribute__((returns_nonnull)) is provided.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212874
91177308-0d34-0410-b5e6-
96231b3b80d8
}
if (TargetDecl->hasAttr<MallocAttr>())
RetAttrs.addAttribute(llvm::Attribute::NoAlias);
+ if (TargetDecl->hasAttr<ReturnsNonNullAttr>())
+ RetAttrs.addAttribute(llvm::Attribute::NonNull);
}
if (CodeGenOpts.OptimizeSize)
*x = 0;
}
+static int a;
+// CHECK: define nonnull i32* @bar3()
+int * bar3() __attribute__((returns_nonnull)) {
+ return &a;
+}
+