Bug Summary

File:unittests/Support/raw_pwrite_stream_test.cpp
Location:line 29, column 3
Description:Function call argument is an uninitialized value

Annotated Source Code

1//===- raw_pwrite_stream_test.cpp - raw_pwrite_stream tests ---------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "gtest/gtest.h"
11#include "llvm/ADT/SmallString.h"
12#include "llvm/Support/FileSystem.h"
13#include "llvm/Support/raw_ostream.h"
14
15using namespace llvm;
16
17namespace {
18
19TEST(raw_pwrite_ostreamTest, TestSVector)class raw_pwrite_ostreamTest_TestSVector_Test : public ::testing
::Test { public: raw_pwrite_ostreamTest_TestSVector_Test() {}
private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); raw_pwrite_ostreamTest_TestSVector_Test
(raw_pwrite_ostreamTest_TestSVector_Test const &); void operator
=(raw_pwrite_ostreamTest_TestSVector_Test const &);};::testing
::TestInfo* const raw_pwrite_ostreamTest_TestSVector_Test ::test_info_
= ::testing::internal::MakeAndRegisterTestInfo( "raw_pwrite_ostreamTest"
, "TestSVector", __null, __null, (::testing::internal::GetTestTypeId
()), ::testing::Test::SetUpTestCase, ::testing::Test::TearDownTestCase
, new ::testing::internal::TestFactoryImpl< raw_pwrite_ostreamTest_TestSVector_Test
>);void raw_pwrite_ostreamTest_TestSVector_Test::TestBody(
)
{
20 SmallVector<char, 0> Buffer;
21 raw_svector_ostream OS(Buffer);
22 OS << "abcd";
23 StringRef Test = "test";
24 OS.pwrite(Test.data(), Test.size(), 0);
25 EXPECT_EQ(Test, OS.str())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing
::internal::IsNullLiteralHelper(Test)) == 1)>::Compare("Test"
, "OS.str()", Test, OS.str()))) ; else ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 25, gtest_ar.failure_message()) = ::testing::Message()
;
26
27#ifdef GTEST_HAS_DEATH_TEST1
28#ifndef NDEBUG
29 EXPECT_DEATH(OS.pwrite("12345", 5, 0),switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("We don't support extending the stream"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("OS.pwrite(\"12345\", 5, 0)", &
gtest_regex, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 30, &gtest_dt)) { goto gtest_label_30; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::internal::ExitedUnsuccessfully
(gtest_dt->Wait()))) { goto gtest_label_30; } break; case ::
testing::internal::DeathTest::EXECUTE_TEST: { ::testing::internal
::DeathTest::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing
::internal::AlwaysTrue()) { OS.pwrite("12345", 5, 0); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } } } } else gtest_label_30: ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 30, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message()
Within the expansion of the macro 'EXPECT_DEATH':
a
Function call argument is an uninitialized value
30 "We don't support extending the stream")switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("We don't support extending the stream"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("OS.pwrite(\"12345\", 5, 0)", &
gtest_regex, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 30, &gtest_dt)) { goto gtest_label_30; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::internal::ExitedUnsuccessfully
(gtest_dt->Wait()))) { goto gtest_label_30; } break; case ::
testing::internal::DeathTest::EXECUTE_TEST: { ::testing::internal
::DeathTest::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing
::internal::AlwaysTrue()) { OS.pwrite("12345", 5, 0); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } } } } else gtest_label_30: ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 30, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message()
;
31#endif
32#endif
33}
34
35TEST(raw_pwrite_ostreamTest, TestFD)class raw_pwrite_ostreamTest_TestFD_Test : public ::testing::
Test { public: raw_pwrite_ostreamTest_TestFD_Test() {} private
: virtual void TestBody(); static ::testing::TestInfo* const test_info_
__attribute__ ((unused)); raw_pwrite_ostreamTest_TestFD_Test
(raw_pwrite_ostreamTest_TestFD_Test const &); void operator
=(raw_pwrite_ostreamTest_TestFD_Test const &);};::testing
::TestInfo* const raw_pwrite_ostreamTest_TestFD_Test ::test_info_
= ::testing::internal::MakeAndRegisterTestInfo( "raw_pwrite_ostreamTest"
, "TestFD", __null, __null, (::testing::internal::GetTestTypeId
()), ::testing::Test::SetUpTestCase, ::testing::Test::TearDownTestCase
, new ::testing::internal::TestFactoryImpl< raw_pwrite_ostreamTest_TestFD_Test
>);void raw_pwrite_ostreamTest_TestFD_Test::TestBody()
{
36 SmallString<64> Path;
37 int FD;
38 sys::fs::createTemporaryFile("foo", "bar", FD, Path);
39 raw_fd_ostream OS(FD, true);
40 OS << "abcd";
41 StringRef Test = "test";
42 OS.pwrite(Test.data(), Test.size(), 0);
43 OS.pwrite(Test.data(), Test.size(), 0);
44
45#ifdef GTEST_HAS_DEATH_TEST1
46#ifndef NDEBUG
47 EXPECT_DEATH(OS.pwrite("12345", 5, 0),switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("We don't support extending the stream"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("OS.pwrite(\"12345\", 5, 0)", &
gtest_regex, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 48, &gtest_dt)) { goto gtest_label_48; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::internal::ExitedUnsuccessfully
(gtest_dt->Wait()))) { goto gtest_label_48; } break; case ::
testing::internal::DeathTest::EXECUTE_TEST: { ::testing::internal
::DeathTest::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing
::internal::AlwaysTrue()) { OS.pwrite("12345", 5, 0); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } } } } else gtest_label_48: ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 48, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message()
48 "We don't support extending the stream")switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("We don't support extending the stream"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("OS.pwrite(\"12345\", 5, 0)", &
gtest_regex, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 48, &gtest_dt)) { goto gtest_label_48; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::internal::ExitedUnsuccessfully
(gtest_dt->Wait()))) { goto gtest_label_48; } break; case ::
testing::internal::DeathTest::EXECUTE_TEST: { ::testing::internal
::DeathTest::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing
::internal::AlwaysTrue()) { OS.pwrite("12345", 5, 0); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } } } } else gtest_label_48: ::testing::internal::AssertHelper
(::testing::TestPartResult::kNonFatalFailure, "/tmp/buildd/llvm-toolchain-snapshot-3.8~svn255820/unittests/Support/raw_pwrite_stream_test.cpp"
, 48, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message()
;
49#endif
50#endif
51}
52
53#ifdef LLVM_ON_UNIX1
54TEST(raw_pwrite_ostreamTest, TestDevNull)class raw_pwrite_ostreamTest_TestDevNull_Test : public ::testing
::Test { public: raw_pwrite_ostreamTest_TestDevNull_Test() {}
private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); raw_pwrite_ostreamTest_TestDevNull_Test
(raw_pwrite_ostreamTest_TestDevNull_Test const &); void operator
=(raw_pwrite_ostreamTest_TestDevNull_Test const &);};::testing
::TestInfo* const raw_pwrite_ostreamTest_TestDevNull_Test ::test_info_
= ::testing::internal::MakeAndRegisterTestInfo( "raw_pwrite_ostreamTest"
, "TestDevNull", __null, __null, (::testing::internal::GetTestTypeId
()), ::testing::Test::SetUpTestCase, ::testing::Test::TearDownTestCase
, new ::testing::internal::TestFactoryImpl< raw_pwrite_ostreamTest_TestDevNull_Test
>);void raw_pwrite_ostreamTest_TestDevNull_Test::TestBody(
)
{
55 int FD;
56 sys::fs::openFileForWrite("/dev/null", FD, sys::fs::F_None);
57 raw_fd_ostream OS(FD, true);
58 OS << "abcd";
59 StringRef Test = "test";
60 OS.pwrite(Test.data(), Test.size(), 0);
61 OS.pwrite(Test.data(), Test.size(), 0);
62}
63#endif
64}