# HG changeset patch # User Frits van Bommel # Date 1239923675 -7200 # Node ID f41ff8ccc24986b84420abeb74dde7b4c9e9c500 # Parent e945d2a0999eee3ed458367a1858027c9ec8f32d Unbreak nested naked functions. diff -r e945d2a0999e -r f41ff8ccc249 gen/tollvm.cpp --- a/gen/tollvm.cpp Thu Apr 16 12:01:28 2009 +0200 +++ b/gen/tollvm.cpp Fri Apr 17 01:14:35 2009 +0200 @@ -315,6 +315,11 @@ assert(0 && "not global/function"); } + // The following breaks for nested naked functions, so check for that. + bool skipNestedCheck = false; + if (FuncDeclaration* fd = sym->isFuncDeclaration()) + skipNestedCheck = (fd->naked != 0); + // Any symbol nested in a function can't be referenced directly from // outside that function, so we can give such symbols internal linkage. // This holds even if nested indirectly, such as member functions of @@ -328,10 +333,11 @@ // --- // if instances get emitted in multiple object files because they'd use // different instances of 'i'. - for (Dsymbol* parent = sym->parent; parent ; parent = parent->parent) { - if (parent->isFuncDeclaration()) - return llvm::GlobalValue::InternalLinkage; - } + if (!skipNestedCheck) + for (Dsymbol* parent = sym->parent; parent ; parent = parent->parent) { + if (parent->isFuncDeclaration()) + return llvm::GlobalValue::InternalLinkage; + } // default to external linkage return llvm::GlobalValue::ExternalLinkage;