mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 19:06:02 +03:00
Pass IrFunction* to applyFuncDeclUDAs instead of irfunc->func (llvm::Function*) such that LDC's UDAs can set function properties that are not part of llvm::Function.
This commit is contained in:
parent
339d875327
commit
b25b7966cc
3 changed files with 8 additions and 4 deletions
|
@ -496,7 +496,7 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applyFuncDeclUDAs(fdecl, func);
|
applyFuncDeclUDAs(fdecl, irFunc);
|
||||||
|
|
||||||
// main
|
// main
|
||||||
if (fdecl->isMain()) {
|
if (fdecl->isMain()) {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "attrib.h"
|
#include "attrib.h"
|
||||||
#include "declaration.h"
|
#include "declaration.h"
|
||||||
#include "expression.h"
|
#include "expression.h"
|
||||||
|
#include "ir/irfunction.h"
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
|
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
|
@ -211,10 +212,13 @@ void applyVarDeclUDAs(VarDeclaration *decl, llvm::GlobalVariable *gvar) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyFuncDeclUDAs(FuncDeclaration *decl, llvm::Function *func) {
|
void applyFuncDeclUDAs(FuncDeclaration *decl, IrFunction *irFunc) {
|
||||||
if (!decl->userAttribDecl)
|
if (!decl->userAttribDecl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
llvm::Function *func = irFunc->func;
|
||||||
|
assert(func);
|
||||||
|
|
||||||
Expressions *attrs = decl->userAttribDecl->getAttributes();
|
Expressions *attrs = decl->userAttribDecl->getAttributes();
|
||||||
expandTuples(attrs);
|
expandTuples(attrs);
|
||||||
for (auto &attr : *attrs) {
|
for (auto &attr : *attrs) {
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
class Dsymbol;
|
class Dsymbol;
|
||||||
class FuncDeclaration;
|
class FuncDeclaration;
|
||||||
class VarDeclaration;
|
class VarDeclaration;
|
||||||
|
struct IrFunction;
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class Function;
|
|
||||||
class GlobalVariable;
|
class GlobalVariable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyFuncDeclUDAs(FuncDeclaration *decl, llvm::Function *func);
|
void applyFuncDeclUDAs(FuncDeclaration *decl, IrFunction *irFunc);
|
||||||
void applyVarDeclUDAs(VarDeclaration *decl, llvm::GlobalVariable *gvar);
|
void applyVarDeclUDAs(VarDeclaration *decl, llvm::GlobalVariable *gvar);
|
||||||
|
|
||||||
bool hasWeakUDA(Dsymbol *sym);
|
bool hasWeakUDA(Dsymbol *sym);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue