explaining why we have to ignore errors here even though in other parts
of codegen we can be more strict with builtins.
Also add a test case based on the code in a TSan test that found this
issue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298494
91177308-0d34-0410-b5e6-
96231b3b80d8
ASTContext::GetBuiltinTypeError Error;
getContext().GetBuiltinType(BuiltinID, Error, nullptr,
&OverrideNonnullReturn, &OverrideNonnullArgs);
- assert(Error == ASTContext::GE_None && "Should not codegen an error");
+ // Note that we can't check the 'Error' here as there may be errors that
+ // have been diagnosed and reported to the programmer as warnings but
+ // repaired in the AST such as for implicit declarations of builtin
+ // functions. None of those impact our usage of this to analyze attributes
+ // for the builtins.
}
bool HasOptnone = false;
_setjmp(0);
}
+// Bogus declarations that will end up with bad types when detecting builtins,
+// but that we will still process when considering whether to add attributes.
+struct __jmp_buf_tag;
+extern int __sigsetjmp(struct __jmp_buf_tag *__env, int __savemask);
+
+// CHECK-LABEL: define void @f21()
+// CHECK: {
+// CHECK: call i32 @__sigsetjmp(%{{.*}}* null, i32 0)
+// CHECK: [[RT_CALL]]
+// CHECK: ret void
+void f21(void) {
+ __sigsetjmp(0, 0);
+}
+
// CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} }
// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} }
// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} }