diff options
Diffstat (limited to 'contrib/llvm/tools/clang')
5 files changed, 13 insertions, 3 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def b/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def index 0a513ef..48bf5db 100644 --- a/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def +++ b/contrib/llvm/tools/clang/include/clang/Basic/Builtins.def @@ -70,6 +70,8 @@ // f -> this is a libc/libm function without the '__builtin_' prefix. It can // be followed by ':headername:' to state which header this function // comes from. +// i -> this is a runtime library implemented function without the +// '__builtin_' prefix. It will be implemented in compiter-rt or libgcc. // p:N: -> this is a printf-like function whose Nth argument is the format // string. // P:N: -> similar to the p:N: attribute, but the function is like vprintf diff --git a/contrib/llvm/tools/clang/include/clang/Basic/Builtins.h b/contrib/llvm/tools/clang/include/clang/Basic/Builtins.h index 3b88e15..cfcbcdb 100644 --- a/contrib/llvm/tools/clang/include/clang/Basic/Builtins.h +++ b/contrib/llvm/tools/clang/include/clang/Basic/Builtins.h @@ -128,6 +128,13 @@ public: return strchr(GetRecord(ID).Attributes, 'f') != 0; } + /// \brief Determines whether this builtin is a predefined compiler-rt/libgcc + /// function, such as "__clear_cache", where we know the signature a + /// priori. + bool isPredefinedRuntimeFunction(unsigned ID) const { + return strchr(GetRecord(ID).Attributes, 'i') != 0; + } + /// \brief Determines whether this builtin has custom typechecking. bool hasCustomTypechecking(unsigned ID) const { return strchr(GetRecord(ID).Attributes, 't') != 0; diff --git a/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsAArch64.def b/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsAArch64.def index 9e9f6d08..768e4bb 100644 --- a/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsAArch64.def +++ b/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsAArch64.def @@ -15,4 +15,4 @@ // The format of this database matches clang/Basic/Builtins.def. // In libgcc -BUILTIN(__clear_cache, "vv*v*", "") +BUILTIN(__clear_cache, "vv*v*", "i") diff --git a/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsARM.def b/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsARM.def index 888e529..f1e3dfc 100644 --- a/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsARM.def +++ b/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsARM.def @@ -15,7 +15,7 @@ // The format of this database matches clang/Basic/Builtins.def. // In libgcc -BUILTIN(__clear_cache, "v.", "") +BUILTIN(__clear_cache, "v.", "i") BUILTIN(__builtin_thread_pointer, "v*", "") // Saturating arithmetic diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp index e0e8bd6..f72bec0 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp @@ -8671,7 +8671,8 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) { // Builtin functions cannot be defined. if (unsigned BuiltinID = FD->getBuiltinID()) { - if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) { + if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID) && + !Context.BuiltinInfo.isPredefinedRuntimeFunction(BuiltinID)) { Diag(FD->getLocation(), diag::err_builtin_definition) << FD; FD->setInvalidDecl(); } |