Mercurial > projects > ldc
changeset 1221:f41ff8ccc249
Unbreak nested naked functions.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Fri, 17 Apr 2009 01:14:35 +0200 |
parents | e945d2a0999e |
children | b6370749ec8d f1877b6be63d |
files | gen/tollvm.cpp |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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;