diff options
Diffstat (limited to 'llvm/tools/llvm-c-test/echo.cpp')
| -rw-r--r-- | llvm/tools/llvm-c-test/echo.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp index 1922b429eb2..b0e47d8f544 100644 --- a/llvm/tools/llvm-c-test/echo.cpp +++ b/llvm/tools/llvm-c-test/echo.cpp @@ -16,12 +16,18 @@ //===----------------------------------------------------------------------===// #include "llvm-c-test.h" +#include "llvm-c/Core.h" +#include "llvm-c/ErrorHandling.h" #include "llvm-c/Target.h" +#include "llvm-c/Types.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/ErrorHandling.h" -#include <stdio.h> -#include <stdlib.h> +#include <cstdio> +#include <cstdlib> +#include <cstring> using namespace llvm; @@ -39,13 +45,16 @@ struct CAPIDenseMap<T*> { uintptr_t Val = static_cast<uintptr_t>(-1); return reinterpret_cast<T*>(Val); } + static inline T* getTombstoneKey() { uintptr_t Val = static_cast<uintptr_t>(-2); return reinterpret_cast<T*>(Val); } + static unsigned getHashValue(const T *PtrVal) { return hash_value(PtrVal); } + static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; } }; @@ -154,7 +163,9 @@ struct TypeCloner { } }; -static ValueMap clone_params(LLVMValueRef Src, LLVMValueRef Dst) { +namespace { + +ValueMap clone_params(LLVMValueRef Src, LLVMValueRef Dst) { unsigned Count = LLVMCountParams(Src); if (Count != LLVMCountParams(Dst)) report_fatal_error("Parameter count mismatch"); @@ -212,6 +223,8 @@ static ValueMap clone_params(LLVMValueRef Src, LLVMValueRef Dst) { return VMap; } +} // end anonymous namespace + LLVMValueRef clone_constant(LLVMValueRef Cst, LLVMModuleRef M) { if (!LLVMIsAConstant(Cst)) report_fatal_error("Expected a constant"); @@ -710,7 +723,9 @@ struct FunCloner { } }; -static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) { +namespace { + +void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) { LLVMValueRef Begin = LLVMGetFirstGlobal(Src); LLVMValueRef End = LLVMGetLastGlobal(Src); @@ -774,7 +789,7 @@ FunDecl: } } -static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) { +void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) { LLVMValueRef Begin = LLVMGetFirstGlobal(Src); LLVMValueRef End = LLVMGetLastGlobal(Src); @@ -861,6 +876,8 @@ FunClone: } } +} // end anonymous namespace + int llvm_echo(void) { LLVMEnablePrettyStackTrace(); |

