diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2018-01-04 22:19:23 +0200 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2018-01-05 19:08:44 +0200 |
| commit | b719578f48c06047aea5f5b307ec1e3affb8f4ff (patch) | |
| tree | 67e426fd9cde4fbcc08b7f08256ed95a468a0245 /src/rustllvm/RustWrapper.cpp | |
| parent | 8e7a609e635b728eba65d471c985ab462dc4cfc7 (diff) | |
| download | rust-b719578f48c06047aea5f5b307ec1e3affb8f4ff.tar.gz rust-b719578f48c06047aea5f5b307ec1e3affb8f4ff.zip | |
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.
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 6f51ea67cb1..1ebbd73e6fe 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)); |
