diff options
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 15 | ||||
-rw-r--r-- | llvm/unittests/Support/ProgramTest.cpp | 14 | ||||
-rw-r--r-- | llvm/unittests/Support/StreamingMemoryObjectTest.cpp | 4 | ||||
-rw-r--r-- | llvm/unittests/Support/TimeValueTest.cpp | 7 | ||||
-rw-r--r-- | llvm/unittests/Support/TimerTest.cpp | 4 |
5 files changed, 29 insertions, 15 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index eac669f467b..bb8a9487402 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -7,12 +7,17 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Config/config.h" +#include "llvm/Support/Allocator.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/StringSaver.h" #include "gtest/gtest.h" -#include <stdlib.h> +#include <cstdlib> #include <string> using namespace llvm; @@ -20,7 +25,7 @@ using namespace llvm; namespace { class TempEnvVar { - public: +public: TempEnvVar(const char *name, const char *value) : name(name) { const char *old_value = getenv(name); @@ -41,13 +46,14 @@ class TempEnvVar { #endif } - private: +private: const char *const name; }; template <typename T> class StackOption : public cl::opt<T> { typedef cl::opt<T> Base; + public: // One option... template<class M0t> @@ -69,7 +75,6 @@ public: ~StackOption() override { this->removeArgument(); } }; - cl::OptionCategory TestCategory("Test Options", "Description"); TEST(CommandLineTest, ModifyExisitingOption) { StackOption<int> TestOption("test-option", cl::desc("old description")); @@ -265,4 +270,4 @@ TEST(CommandLineTest, HideUnrelatedOptionsMulti) { << "Hid default option that should be visable."; } -} // anonymous namespace +} // end anonymous namespace diff --git a/llvm/unittests/Support/ProgramTest.cpp b/llvm/unittests/Support/ProgramTest.cpp index deadaadec1d..cee9f0bddae 100644 --- a/llvm/unittests/Support/ProgramTest.cpp +++ b/llvm/unittests/Support/ProgramTest.cpp @@ -7,13 +7,19 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/ConvertUTF.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" +#include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" -#include <stdlib.h> +#include <cstdlib> +#include <cstring> +#include <string> +#include <vector> #if defined(__APPLE__) # include <crt_externs.h> #elif !defined(_MSC_VER) @@ -45,6 +51,7 @@ void sleep_for(unsigned int seconds) { GTEST_FATAL_FAILURE_(MessageStorage.c_str()); \ } else { \ } + // From TestMain.cpp. extern const char *TestMainArgv0; @@ -53,9 +60,9 @@ namespace { using namespace llvm; using namespace sys; -static cl::opt<std::string> +cl::opt<std::string> ProgramTestStringArg1("program-test-string-arg1"); -static cl::opt<std::string> +cl::opt<std::string> ProgramTestStringArg2("program-test-string-arg2"); class ProgramEnvTest : public testing::Test { @@ -309,7 +316,6 @@ TEST(ProgramTest, TestExecuteNegative) { ASSERT_TRUE(ExecutionFailed); ASSERT_FALSE(Error.empty()); } - } #ifdef LLVM_ON_WIN32 diff --git a/llvm/unittests/Support/StreamingMemoryObjectTest.cpp b/llvm/unittests/Support/StreamingMemoryObjectTest.cpp index 836dfa9084f..cb1520b2edc 100644 --- a/llvm/unittests/Support/StreamingMemoryObjectTest.cpp +++ b/llvm/unittests/Support/StreamingMemoryObjectTest.cpp @@ -11,7 +11,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/StreamingMemoryObject.h" #include "gtest/gtest.h" -#include <string.h> +#include <cstring> using namespace llvm; @@ -65,4 +65,4 @@ TEST(StreamingMemoryObjectTest, getPointer) { EXPECT_TRUE(std::equal(InputBuffer, InputBuffer + 8, O.getPointer(0, 20))); } -} // end namespace +} // end anonymous namespace diff --git a/llvm/unittests/Support/TimeValueTest.cpp b/llvm/unittests/Support/TimeValueTest.cpp index 3d2b9780c06..59af5c3044d 100644 --- a/llvm/unittests/Support/TimeValueTest.cpp +++ b/llvm/unittests/Support/TimeValueTest.cpp @@ -9,9 +9,12 @@ #include "gtest/gtest.h" #include "llvm/Support/TimeValue.h" -#include <time.h> +#include <cstdint> +#include <cstdlib> +#include <ctime> using namespace llvm; + namespace { TEST(TimeValue, time_t) { @@ -37,4 +40,4 @@ TEST(TimeValue, Win32FILETIME) { EXPECT_EQ(ft1970, epoch.toWin32Time()); } -} +} // end anonymous namespace diff --git a/llvm/unittests/Support/TimerTest.cpp b/llvm/unittests/Support/TimerTest.cpp index f556a3f72c6..8f05b353476 100644 --- a/llvm/unittests/Support/TimerTest.cpp +++ b/llvm/unittests/Support/TimerTest.cpp @@ -13,7 +13,7 @@ #if LLVM_ON_WIN32 #include <windows.h> #else -#include <time.h> +#include <ctime> #endif using namespace llvm; @@ -62,4 +62,4 @@ TEST(Timer, CheckIfTriggered) { EXPECT_FALSE(T1.hasTriggered()); } -} // end anon namespace +} // end anonymous namespace |