diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-04-05 20:19:49 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-04-05 20:19:49 +0000 |
commit | 9a7a3bcf2955decb12cd642133eaa594f3cd121d (patch) | |
tree | 78315f78bc0109a6778d35838e0482c165cac9bd /tools/llvm-c-test | |
parent | fe34a372e1ab527f3102ec0521005a35eecdd229 (diff) |
Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.
Use anonymous namespaces in source files.
Differential revision: http://reviews.llvm.org/D18778
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-c-test')
-rw-r--r-- | tools/llvm-c-test/echo.cpp | 27 | ||||
-rw-r--r-- | tools/llvm-c-test/llvm-c-test.h | 9 |
2 files changed, 29 insertions, 7 deletions
diff --git a/tools/llvm-c-test/echo.cpp b/tools/llvm-c-test/echo.cpp index 1922b429eb2..b0e47d8f544 100644 --- a/tools/llvm-c-test/echo.cpp +++ b/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(); diff --git a/tools/llvm-c-test/llvm-c-test.h b/tools/llvm-c-test/llvm-c-test.h index 60edc0df4d1..fa5a9d04cca 100644 --- a/tools/llvm-c-test/llvm-c-test.h +++ b/tools/llvm-c-test/llvm-c-test.h @@ -10,10 +10,15 @@ |* Header file for llvm-c-test *| |* *| \*===----------------------------------------------------------------------===*/ + #ifndef LLVM_C_TEST_H #define LLVM_C_TEST_H +#ifdef __cplusplus +#include <cstdbool> +#else #include <stdbool.h> +#endif #include "llvm-c/Core.h" #ifdef __cplusplus @@ -51,6 +56,6 @@ int llvm_echo(void); #ifdef __cplusplus } -#endif /* !defined(__cplusplus) */ - #endif + +#endif // LLVM_C_TEST_H |