diff options
| author | kennytm <kennytm@gmail.com> | 2018-01-07 02:36:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-07 02:36:06 +0800 |
| commit | f6125846b634d335ba74eb8392c4038e72b613c5 (patch) | |
| tree | 4c8569df17196b06d732d74b0affc722b9882fa4 /src/rustllvm/RustWrapper.cpp | |
| parent | e7192c1a4b884ddeb54c32678da1687558d51e1f (diff) | |
| parent | b719578f48c06047aea5f5b307ec1e3affb8f4ff (diff) | |
| download | rust-f6125846b634d335ba74eb8392c4038e72b613c5.tar.gz rust-f6125846b634d335ba74eb8392c4038e72b613c5.zip | |
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
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 96fb05ee06e..0fac7f7bf28 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -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)); |
