mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-01 18:13:18 +01:00
Do not try to emit nested functions with unanalyzed parents.
GitHub: Fixes #497.
This commit is contained in:
@@ -2012,3 +2012,20 @@ llvm::GlobalVariable* getOrCreateGlobal(Loc loc, llvm::Module& module,
|
||||
init, name, 0, isThreadLocal);
|
||||
#endif
|
||||
}
|
||||
|
||||
FuncDeclaration* getParentFunc(Dsymbol* sym, bool stopOnStatic) {
|
||||
if (!sym)
|
||||
return NULL;
|
||||
Dsymbol* parent = sym->parent;
|
||||
assert(parent);
|
||||
while (parent && !parent->isFuncDeclaration()) {
|
||||
if (stopOnStatic) {
|
||||
Declaration* decl = sym->isDeclaration();
|
||||
if (decl && decl->isStatic())
|
||||
return NULL;
|
||||
}
|
||||
parent = parent->parent;
|
||||
}
|
||||
|
||||
return (parent ? parent->isFuncDeclaration() : NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user