summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-c-test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-c-test')
-rw-r--r--llvm/tools/llvm-c-test/echo.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp
index b19ae951d4e..774e339879d 100644
--- a/llvm/tools/llvm-c-test/echo.cpp
+++ b/llvm/tools/llvm-c-test/echo.cpp
@@ -16,6 +16,7 @@
//===----------------------------------------------------------------------===//
#include "llvm-c-test.h"
+#include "llvm-c/Target.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/ErrorHandling.h"
@@ -629,6 +630,11 @@ int llvm_echo(void) {
LLVMContextRef Ctx = LLVMContextCreate();
LLVMModuleRef M = LLVMModuleCreateWithNameInContext("<stdin>", Ctx);
+ LLVMSetTarget(M, LLVMGetTarget(Src));
+ LLVMSetModuleDataLayout(M, LLVMGetModuleDataLayout(Src));
+ if (strcmp(LLVMGetDataLayoutStr(M), LLVMGetDataLayoutStr(Src)))
+ report_fatal_error("Inconsistent DataLayout string representation");
+
clone_functions(Src, M);
char *Str = LLVMPrintModuleToString(M);
fputs(Str, stdout);
OpenPOWER on IntegriCloud