Rollup merge of #47220 - nagisa:nonamellvm, r=rkruppe

Use name-discarding LLVM context

This is only applicable when neither of --emit=llvm-ir or --emit=llvm-bc are not
requested.

In case either of these outputs are wanted, but the benefits of such context are
desired as well, -Zfewer_names option provides the same functionality regardless
of the outputs requested.

Should be a viable fix for https://github.com/rust-lang/rust/issues/46449
This commit is contained in:
kennytm 2018-01-07 02:36:06 +08:00 committed by GitHub
commit f6125846b6
8 changed files with 27 additions and 6 deletions

View file

@ -76,11 +76,17 @@ extern "C" char *LLVMRustGetLastError(void) {
return Ret;
}
void LLVMRustSetLastError(const char *Err) {
extern "C" void LLVMRustSetLastError(const char *Err) {
free((void *)LastError);
LastError = strdup(Err);
}
extern "C" LLVMContextRef LLVMRustContextCreate(bool shouldDiscardNames) {
auto ctx = new LLVMContext();
ctx->setDiscardValueNames(shouldDiscardNames);
return wrap(ctx);
}
extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
const char *Triple) {
unwrap(M)->setTargetTriple(Triple::normalize(Triple));