gtest-type-util.h (googletest-release-1.11.0) | : | gtest-type-util.h (googletest-release-1.12.0) | ||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
// Type utilities needed for implementing typed and type-parameterized | // Type utilities needed for implementing typed and type-parameterized | |||
// tests. | // tests. | |||
// GOOGLETEST_CM0001 DO NOT DELETE | // IWYU pragma: private, include "gtest/gtest.h" | |||
// IWYU pragma: friend gtest/.* | ||||
// IWYU pragma: friend gmock/.* | ||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ | |||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ | |||
#include "gtest/internal/gtest-port.h" | #include "gtest/internal/gtest-port.h" | |||
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using | // #ifdef __GNUC__ is too general here. It is possible to use gcc without using | |||
// libstdc++ (which is where cxxabi.h comes from). | // libstdc++ (which is where cxxabi.h comes from). | |||
# if GTEST_HAS_CXXABI_H_ | #if GTEST_HAS_CXXABI_H_ | |||
# include <cxxabi.h> | #include <cxxabi.h> | |||
# elif defined(__HP_aCC) | #elif defined(__HP_aCC) | |||
# include <acxx_demangle.h> | #include <acxx_demangle.h> | |||
# endif // GTEST_HASH_CXXABI_H_ | #endif // GTEST_HASH_CXXABI_H_ | |||
namespace testing { | namespace testing { | |||
namespace internal { | namespace internal { | |||
// Canonicalizes a given name with respect to the Standard C++ Library. | // Canonicalizes a given name with respect to the Standard C++ Library. | |||
// This handles removing the inline namespace within `std` that is | // This handles removing the inline namespace within `std` that is | |||
// used by various standard libraries (e.g., `std::__1`). Names outside | // used by various standard libraries (e.g., `std::__1`). Names outside | |||
// of namespace std are returned unmodified. | // of namespace std are returned unmodified. | |||
inline std::string CanonicalizeForStdLibVersioning(std::string s) { | inline std::string CanonicalizeForStdLibVersioning(std::string s) { | |||
static const char prefix[] = "std::__"; | static const char prefix[] = "std::__"; | |||
skipping to change at line 104 | skipping to change at line 106 | |||
#if GTEST_HAS_RTTI | #if GTEST_HAS_RTTI | |||
return GetTypeName(typeid(T)); | return GetTypeName(typeid(T)); | |||
#else | #else | |||
return "<type>"; | return "<type>"; | |||
#endif // GTEST_HAS_RTTI | #endif // GTEST_HAS_RTTI | |||
} | } | |||
// A unique type indicating an empty node | // A unique type indicating an empty node | |||
struct None {}; | struct None {}; | |||
# define GTEST_TEMPLATE_ template <typename T> class | #define GTEST_TEMPLATE_ \ | |||
template <typename T> \ | ||||
class | ||||
// The template "selector" struct TemplateSel<Tmpl> is used to | // The template "selector" struct TemplateSel<Tmpl> is used to | |||
// represent Tmpl, which must be a class template with one type | // represent Tmpl, which must be a class template with one type | |||
// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined | // parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined | |||
// as the type Tmpl<T>. This allows us to actually instantiate the | // as the type Tmpl<T>. This allows us to actually instantiate the | |||
// template "selected" by TemplateSel<Tmpl>. | // template "selected" by TemplateSel<Tmpl>. | |||
// | // | |||
// This trick is necessary for simulating typedef for class templates, | // This trick is necessary for simulating typedef for class templates, | |||
// which C++ doesn't support directly. | // which C++ doesn't support directly. | |||
template <GTEST_TEMPLATE_ Tmpl> | template <GTEST_TEMPLATE_ Tmpl> | |||
struct TemplateSel { | struct TemplateSel { | |||
template <typename T> | template <typename T> | |||
struct Bind { | struct Bind { | |||
typedef Tmpl<T> type; | typedef Tmpl<T> type; | |||
}; | }; | |||
}; | }; | |||
# define GTEST_BIND_(TmplSel, T) \ | #define GTEST_BIND_(TmplSel, T) TmplSel::template Bind<T>::type | |||
TmplSel::template Bind<T>::type | ||||
template <GTEST_TEMPLATE_ Head_, GTEST_TEMPLATE_... Tail_> | template <GTEST_TEMPLATE_ Head_, GTEST_TEMPLATE_... Tail_> | |||
struct Templates { | struct Templates { | |||
using Head = TemplateSel<Head_>; | using Head = TemplateSel<Head_>; | |||
using Tail = Templates<Tail_...>; | using Tail = Templates<Tail_...>; | |||
}; | }; | |||
template <GTEST_TEMPLATE_ Head_> | template <GTEST_TEMPLATE_ Head_> | |||
struct Templates<Head_> { | struct Templates<Head_> { | |||
using Head = TemplateSel<Head_>; | using Head = TemplateSel<Head_>; | |||
End of changes. 4 change blocks. | ||||
9 lines changed or deleted | 12 lines changed or added |