// The format of this database matches clang/Basic/Builtins.def.
// In libgcc
-BUILTIN(__clear_cache, "v.", "")
+BUILTIN(__clear_cache, "vc*c*", "")
BUILTIN(__builtin_thread_pointer, "v*", "")
// Saturating arithmetic
Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
if (BuiltinID == ARM::BI__clear_cache) {
+ assert(E->getNumArgs() == 2 && "__clear_cache takes 2 arguments");
const FunctionDecl *FD = E->getDirectCallee();
- // Oddly people write this call without args on occasion and gcc accepts
- // it - it's also marked as varargs in the description file.
SmallVector<Value*, 2> Ops;
- for (unsigned i = 0; i < E->getNumArgs(); i++)
+ for (unsigned i = 0; i < 2; i++)
Ops.push_back(EmitScalarExpr(E->getArg(i)));
llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType());
llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty);
// REQUIRES: arm-registered-target
// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -w -o - %s | FileCheck %s
-void clear0(void *ptr) {
- // CHECK: clear0
- // CHECK-NOT: load i8**
- __clear_cache();
-}
-
-void clear1(void *ptr) {
- // CHECK: clear1
- // CHECK: load i8**
- // CHECK-NOT: load i8**
- __clear_cache(ptr);
-}
-
-void clear2(void *ptr, void *ptr2) {
- // CHECK: clear2
+void clear(void *ptr, void *ptr2) {
+ // CHECK: clear
// CHECK: load i8**
// CHECK: load i8**
__clear_cache(ptr, ptr2);
-// RUN: %clang_cc1 -triple armv7 -fsyntax-only -verify -DTEST0 %s
-// RUN: %clang_cc1 -triple armv7 -fsyntax-only -verify -DTEST1 %s
+// RUN: %clang_cc1 -triple armv7 -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple armv7 -target-abi apcs-gnu \
-// RUN: -fsyntax-only -verify -DTEST1 %s
+// RUN: -fsyntax-only -verify %s
-#ifdef TEST0
-void __clear_cache(char*, char*);
-#endif
+void f(char *a, char *b) {
+ __clear_cache(); // expected-error {{too few arguments to function call, expected 2, have 0}} // expected-note {{'__clear_cache' is a builtin with type 'void (char *, char *)}}
+ __clear_cache(a); // expected-error {{too few arguments to function call, expected 2, have 1}}
+ __clear_cache(a, b);
+}
-#ifdef TEST1
-void __clear_cache(void*, void*);
-#endif
+void __clear_cache(void*, void*); // expected-error {{conflicting types for '__clear_cache'}}
+void __clear_cache(char*, char*);
#if defined(__ARM_PCS) || defined(__ARM_EABI__)
// va_list on ARM AAPCS is struct { void* __ap }.