diff options
Diffstat (limited to 'llvm/unittests')
-rw-r--r-- | llvm/unittests/ADT/SCCIteratorTest.cpp | 13 | ||||
-rw-r--r-- | llvm/unittests/ADT/SmallStringTest.cpp | 7 | ||||
-rw-r--r-- | llvm/unittests/ADT/SmallVectorTest.cpp | 18 | ||||
-rw-r--r-- | llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp | 8 | ||||
-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 |
9 files changed, 56 insertions, 34 deletions
diff --git a/llvm/unittests/ADT/SCCIteratorTest.cpp b/llvm/unittests/ADT/SCCIteratorTest.cpp index da8c04483f9..95639940160 100644 --- a/llvm/unittests/ADT/SCCIteratorTest.cpp +++ b/llvm/unittests/ADT/SCCIteratorTest.cpp @@ -10,7 +10,10 @@ #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/GraphTraits.h" #include "gtest/gtest.h" -#include <limits.h> +#include <cassert> +#include <climits> +#include <utility> +#include <vector> using namespace llvm; @@ -27,13 +30,14 @@ private: static void ValidateIndex(unsigned Idx) { assert(Idx < N && "Invalid node index!"); } -public: +public: /// NodeSubset - A subset of the graph's nodes. class NodeSubset { typedef unsigned char BitVector; // Where the limitation N <= 8 comes from. BitVector Elements; NodeSubset(BitVector e) : Elements(e) {} + public: /// NodeSubset - Default constructor, creates an empty subset. NodeSubset() : Elements(0) { @@ -98,8 +102,8 @@ public: private: /// Nodes - The list of nodes for this graph. NodeType Nodes[N]; -public: +public: /// Graph - Default constructor. Creates an empty graph. Graph() { // Let each node know which node it is. This allows us to find the start of @@ -166,6 +170,7 @@ public: NodeSubset Children; ChildIterator(); // Disable default constructor. + protected: ChildIterator(NodeType *F, NodeSubset C) : FirstNode(F), Children(C) {} @@ -341,4 +346,4 @@ TEST(SCCIteratorTest, AllSmallGraphs) { } } -} +} // end namespace llvm diff --git a/llvm/unittests/ADT/SmallStringTest.cpp b/llvm/unittests/ADT/SmallStringTest.cpp index 995ef8e8127..b04437873e6 100644 --- a/llvm/unittests/ADT/SmallStringTest.cpp +++ b/llvm/unittests/ADT/SmallStringTest.cpp @@ -12,10 +12,9 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "gtest/gtest.h" -#include <climits> -#include <cstring> -#include <stdarg.h> using namespace llvm; @@ -204,4 +203,4 @@ TEST(StringRefTest, Comparisons) { EXPECT_EQ( 1, SmallString<10>("V8_q0").compare_numeric("V1_q0")); } -} +} // end anonymous namespace diff --git a/llvm/unittests/ADT/SmallVectorTest.cpp b/llvm/unittests/ADT/SmallVectorTest.cpp index 7367ad470e3..bf9de88ffc0 100644 --- a/llvm/unittests/ADT/SmallVectorTest.cpp +++ b/llvm/unittests/ADT/SmallVectorTest.cpp @@ -15,8 +15,10 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Compiler.h" #include "gtest/gtest.h" +#include <cstdarg> +#include <cstdlib> #include <list> -#include <stdarg.h> +#include <utility> using namespace llvm; @@ -141,9 +143,10 @@ int Constructable::numCopyAssignmentCalls; int Constructable::numMoveAssignmentCalls; struct NonCopyable { - NonCopyable() {} - NonCopyable(NonCopyable &&) {} + NonCopyable() = default; + NonCopyable(NonCopyable &&) = default; NonCopyable &operator=(NonCopyable &&) { return *this; } + private: NonCopyable(const NonCopyable &) = delete; NonCopyable &operator=(const NonCopyable &) = delete; @@ -200,7 +203,6 @@ protected: VectorT otherVector; }; - typedef ::testing::Types<SmallVector<Constructable, 0>, SmallVector<Constructable, 1>, SmallVector<Constructable, 2>, @@ -522,7 +524,6 @@ TYPED_TEST(SmallVectorTest, InsertRepeatedTest) { this->assertValuesInOrder(this->theVector, 6u, 1, 16, 16, 2, 3, 4); } - TYPED_TEST(SmallVectorTest, InsertRepeatedAtEndTest) { SCOPED_TRACE("InsertRepeatedTest"); @@ -581,7 +582,6 @@ TYPED_TEST(SmallVectorTest, InsertRangeTest) { this->assertValuesInOrder(this->theVector, 6u, 1, 77, 77, 77, 2, 3); } - TYPED_TEST(SmallVectorTest, InsertRangeAtEndTest) { SCOPED_TRACE("InsertRangeTest"); @@ -748,11 +748,14 @@ TEST(SmallVectorCustomTest, NoAssignTest) { struct MovedFrom { bool hasValue; + MovedFrom() : hasValue(true) { } + MovedFrom(MovedFrom&& m) : hasValue(m.hasValue) { m.hasValue = false; } + MovedFrom &operator=(MovedFrom&& m) { hasValue = m.hasValue; m.hasValue = false; @@ -775,6 +778,7 @@ enum EmplaceableArgState { EAS_RValue, EAS_Failure }; + template <int I> struct EmplaceableArg { EmplaceableArgState State; EmplaceableArg() : State(EAS_Defaulted) {} @@ -924,4 +928,4 @@ TEST(SmallVectorTest, InitializerList) { EXPECT_TRUE(makeArrayRef(V2).equals({4, 5, 3, 2})); } -} // end namespace +} // end anonymous namespace diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp index 776d26970a3..fa7d7780a8a 100644 --- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp @@ -13,10 +13,10 @@ #include "llvm-c/OrcBindings.h" #include "llvm-c/Target.h" #include "llvm-c/TargetMachine.h" +#include "llvm/ADT/Triple.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include <cstring> +#include <memory> namespace llvm { @@ -157,4 +157,4 @@ TEST_F(OrcCAPIExecutionTest, TestDirectCallbacksAPI) { LLVMOrcDisposeInstance(JIT); } -} // namespace llvm +} // end namespace llvm 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 |