[llvm-commits] [llvm] r169559 - in /llvm/trunk/utils/unittest/googletest: README.LLVM gtest-all.cc include/gtest/internal/gtest-internal.h

Alexey Samsonov samsonov at google.com
Thu Dec 6 15:04:41 PST 2012


Author: samsonov
Date: Thu Dec  6 17:04:41 2012
New Revision: 169559

URL: http://llvm.org/viewvc/llvm-project?rev=169559&view=rev
Log:
Modify the LLVM checkout of googletest:
1) don't delete gtest-all.cc (which is used to gather all gtest source
   files in a single file) 
2) make including LLVMSupport headers optional (on by default).
   Sanitizer tools may want to use their own versions of googletest
   compiled with specific flags, instead of the common googletest
   library used for all other LLVM/Clang unittests.

Added:
    llvm/trunk/utils/unittest/googletest/gtest-all.cc
Modified:
    llvm/trunk/utils/unittest/googletest/README.LLVM
    llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-internal.h

Modified: llvm/trunk/utils/unittest/googletest/README.LLVM
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/README.LLVM?rev=169559&r1=169558&r2=169559&view=diff
==============================================================================
--- llvm/trunk/utils/unittest/googletest/README.LLVM (original)
+++ llvm/trunk/utils/unittest/googletest/README.LLVM Thu Dec  6 17:04:41 2012
@@ -19,9 +19,10 @@
 $ mv *.h include/gtest/internal/
 
 # Update paths to the included files
+$ perl -pi -e 's|^#include "src/|#include "|' gtest-all.cc
 $ perl -pi -e 's|^#include "src/|#include "gtest/internal/|' *.cc
 
-$ rm -f gtest-all.cc gtest_main.cc
+$ rm -f gtest_main.cc
 
 $ mv COPYING LICENSE.TXT
 

Added: llvm/trunk/utils/unittest/googletest/gtest-all.cc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/gtest-all.cc?rev=169559&view=auto
==============================================================================
--- llvm/trunk/utils/unittest/googletest/gtest-all.cc (added)
+++ llvm/trunk/utils/unittest/googletest/gtest-all.cc Thu Dec  6 17:04:41 2012
@@ -0,0 +1,48 @@
+// Copyright 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: mheule at google.com (Markus Heule)
+//
+// Google C++ Testing Framework (Google Test)
+//
+// Sometimes it's desirable to build Google Test by compiling a single file.
+// This file serves this purpose.
+
+// This line ensures that gtest.h can be compiled on its own, even
+// when it's fused.
+#include "gtest/gtest.h"
+
+// The following lines pull in the real gtest *.cc files.
+#include "gtest.cc"
+#include "gtest-death-test.cc"
+#include "gtest-filepath.cc"
+#include "gtest-port.cc"
+#include "gtest-printers.cc"
+#include "gtest-test-part.cc"
+#include "gtest-typed-test.cc"

Modified: llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-internal.h?rev=169559&r1=169558&r2=169559&view=diff
==============================================================================
--- llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-internal.h (original)
+++ llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-internal.h Thu Dec  6 17:04:41 2012
@@ -56,7 +56,9 @@
 #include "gtest/internal/gtest-filepath.h"
 #include "gtest/internal/gtest-type-util.h"
 
+#if !GTEST_NO_LLVM_RAW_OSTREAM
 #include "llvm/Support/raw_os_ostream.h"
+#endif
 
 // Due to C++ preprocessor weirdness, we need double indirection to
 // concatenate two tokens when one of them is __LINE__.  Writing
@@ -100,6 +102,7 @@
 // std::ostream with an implicit conversion to raw_ostream& and stream
 // to that.  This causes the compiler to prefer std::ostream overloads
 // but still find raw_ostream& overloads.
+#if !GTEST_NO_LLVM_RAW_OSTREAM
 namespace llvm {
 class convertible_fwd_ostream : public std::ostream {
   raw_os_ostream ros_;
@@ -115,6 +118,12 @@
   llvm::convertible_fwd_ostream cos(*os);
   cos << val;
 }
+#else
+template <typename T>
+inline void GTestStreamToHelper(std::ostream* os, const T& val) {
+  *os << val;
+}
+#endif
 
 class ProtocolMessage;
 namespace proto2 { class Message; }





More information about the llvm-commits mailing list