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 | 1760dc2a232bde2175606ba737938d3032f1e49d (patch) | |
tree | 3859bc6b8b21c8d5073ded16260d7a5b3ff99b8f /llvm/tools/llvm-c-test | |
parent | f2fdd013a29b26791490e3a33beda1bacfeec182 (diff) | |
download | bcm5719-llvm-1760dc2a232bde2175606ba737938d3032f1e49d.tar.gz bcm5719-llvm-1760dc2a232bde2175606ba737938d3032f1e49d.zip |
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
llvm-svn: 265454
Diffstat (limited to 'llvm/tools/llvm-c-test')
-rw-r--r-- | llvm/tools/llvm-c-test/echo.cpp | 27 | ||||
-rw-r--r-- | llvm/tools/llvm-c-test/llvm-c-test.h | 9 |
2 files changed, 29 insertions, 7 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(); diff --git a/llvm/tools/llvm-c-test/llvm-c-test.h b/llvm/tools/llvm-c-test/llvm-c-test.h index 60edc0df4d1..fa5a9d04cca 100644 --- a/llvm/tools/llvm-c-test/llvm-c-test.h +++ b/llvm/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 |