mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 09:31:03 +03:00
Merge pull request #3832 from kinke/fix_compilability
Fix little compilability regression
This commit is contained in:
parent
88d8a2f856
commit
406e469e99
2 changed files with 22 additions and 34 deletions
|
@ -152,26 +152,26 @@ void emitLLVMUsedArray(IRState &irs) {
|
||||||
llvmUsed->setSection("llvm.metadata");
|
llvmUsed->setSection("llvm.metadata");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool inlineAsmDiagnostic(IRState* irs,const llvm::SMDiagnostic &d, unsigned locCookie)
|
bool inlineAsmDiagnostic(IRState *irs, const llvm::SMDiagnostic &d,
|
||||||
{
|
unsigned locCookie) {
|
||||||
if (!locCookie) {
|
if (!locCookie) {
|
||||||
d.print(nullptr, llvm::errs());
|
d.print(nullptr, llvm::errs());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// replace the `<inline asm>` dummy filename by the LOC of the actual D
|
|
||||||
// expression/statement (`myfile.d(123)`)
|
|
||||||
const Loc &loc = irs->getInlineAsmSrcLoc(locCookie);
|
|
||||||
const char *filename = loc.toChars(/*showColumns*/ false);
|
|
||||||
|
|
||||||
// keep on using llvm::SMDiagnostic::print() for nice, colorful output
|
|
||||||
llvm::SMDiagnostic d2(*d.getSourceMgr(), d.getLoc(), filename, d.getLineNo(),
|
|
||||||
d.getColumnNo(), d.getKind(), d.getMessage(),
|
|
||||||
d.getLineContents(), d.getRanges(), d.getFixIts());
|
|
||||||
d2.print(nullptr, llvm::errs());
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace the `<inline asm>` dummy filename by the LOC of the actual D
|
||||||
|
// expression/statement (`myfile.d(123)`)
|
||||||
|
const Loc &loc = irs->getInlineAsmSrcLoc(locCookie);
|
||||||
|
const char *filename = loc.toChars(/*showColumns*/ false);
|
||||||
|
|
||||||
|
// keep on using llvm::SMDiagnostic::print() for nice, colorful output
|
||||||
|
llvm::SMDiagnostic d2(*d.getSourceMgr(), d.getLoc(), filename, d.getLineNo(),
|
||||||
|
d.getColumnNo(), d.getKind(), d.getMessage(),
|
||||||
|
d.getLineContents(), d.getRanges(), d.getFixIts());
|
||||||
|
d2.print(nullptr, llvm::errs());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LDC_LLVM_VER < 1300
|
#if LDC_LLVM_VER < 1300
|
||||||
void inlineAsmDiagnosticHandler(const llvm::SMDiagnostic &d, void *context,
|
void inlineAsmDiagnosticHandler(const llvm::SMDiagnostic &d, void *context,
|
||||||
unsigned locCookie) {
|
unsigned locCookie) {
|
||||||
|
|
|
@ -29,26 +29,14 @@ IrFunction::IrFunction(FuncDeclaration *fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
void IrFunction::setNeverInline() {
|
void IrFunction::setNeverInline() {
|
||||||
assert(!func->getAttributes()
|
assert(!func->hasFnAttribute(llvm::Attribute::AlwaysInline) &&
|
||||||
#if LDC_LLVM_VER < 1400
|
"function can't be never- and always-inline at the same time");
|
||||||
.hasAttribute(LLAttributeList::FunctionIndex,
|
|
||||||
#else
|
|
||||||
.hasFnAttr(
|
|
||||||
#endif
|
|
||||||
llvm::Attribute::AlwaysInline) &&
|
|
||||||
"function can't be never- and always-inline at the same time");
|
|
||||||
func->addFnAttr(llvm::Attribute::NoInline);
|
func->addFnAttr(llvm::Attribute::NoInline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IrFunction::setAlwaysInline() {
|
void IrFunction::setAlwaysInline() {
|
||||||
assert(!func->getAttributes()
|
assert(!func->hasFnAttribute(llvm::Attribute::NoInline) &&
|
||||||
#if LDC_LLVM_VER < 1400
|
"function can't be never- and always-inline at the same time");
|
||||||
.hasAttribute(LLAttributeList::FunctionIndex,
|
|
||||||
#else
|
|
||||||
.hasFnAttr(
|
|
||||||
#endif
|
|
||||||
llvm::Attribute::NoInline) &&
|
|
||||||
"function can't be never- and always-inline at the same time");
|
|
||||||
func->addFnAttr(llvm::Attribute::AlwaysInline);
|
func->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue