From 64b0bdf88afd11b4693b1553c8f5e13c1cb581ed Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Tue, 30 Jun 2015 04:41:18 +0000 Subject: [CodeGen] Tweak isTriviallyRecursive further isTriviallyRecursive is a hack used to bridge a gap between the expectations that source code assumes and the semantics that LLVM IR can provide. Specifically, asm labels on functions are treated as an explicit name for a GlobalObject in Clang but treated like an output-processing step in GCC. Tweak this hack a little further to emit calls to library functions instead of emitting an incorrect definition. The definition in question would have available_externally linkage (this is OK) but result in a call to itself which will either result in an infinite loop or stack overflow. This fixes PR23964. llvm-svn: 241043 --- clang/lib/CodeGen/CodeGenModule.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 461f694acb0..ea09ba8d4fb 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1457,12 +1457,7 @@ CodeGenModule::isTriviallyRecursive(const FunctionDecl *FD) { Name = FD->getName(); } - auto &BI = Context.BuiltinInfo; - unsigned BuiltinID = Context.Idents.get(Name).getBuiltinID(); - if (!BuiltinID || !BI.isPredefinedLibFunction(BuiltinID)) - return false; - - FunctionIsDirectlyRecursive Walker(Name, BI); + FunctionIsDirectlyRecursive Walker(Name, Context.BuiltinInfo); Walker.TraverseFunctionDecl(const_cast(FD)); return Walker.Result; } -- cgit v1.2.3