From b4d3c999295a01785d1c4442e05ba127571dbdc4 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 24 Mar 2011 05:09:45 +0000 Subject: [PATCH] Make sure we aggressively attach nounwind (etc.) to calls to library functions of the form __builtin_XXX. llvm-svn: 128198 --- clang/lib/CodeGen/CGBuiltin.cpp | 3 +-- clang/test/CodeGen/builtin-attributes.c | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 7e61b50c93d6..e6b6ee92c03f 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -948,8 +948,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, getContext().BuiltinInfo.isPredefinedLibFunction(BuiltinID)) return EmitCall(E->getCallee()->getType(), CGM.getBuiltinLibFunction(FD, BuiltinID), - ReturnValueSlot(), - E->arg_begin(), E->arg_end()); + ReturnValueSlot(), E->arg_begin(), E->arg_end(), FD); // See if we have a target specific intrinsic. const char *Name = getContext().BuiltinInfo.GetName(BuiltinID); diff --git a/clang/test/CodeGen/builtin-attributes.c b/clang/test/CodeGen/builtin-attributes.c index afde3fab8481..822b8eecf7d7 100644 --- a/clang/test/CodeGen/builtin-attributes.c +++ b/clang/test/CodeGen/builtin-attributes.c @@ -10,3 +10,8 @@ void f0() { void f1() { exit(1); } + +// CHECK: call i8* @strstr{{.*}} nounwind +char* f2(char* a, char* b) { + return __builtin_strstr(a, b); +}