aboutsummaryrefslogtreecommitdiff
path: root/tools/clang/rewrite_to_chrome_style/tests/function-templates-original.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/clang/rewrite_to_chrome_style/tests/function-templates-original.cc')
-rw-r--r--tools/clang/rewrite_to_chrome_style/tests/function-templates-original.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/tools/clang/rewrite_to_chrome_style/tests/function-templates-original.cc b/tools/clang/rewrite_to_chrome_style/tests/function-templates-original.cc
index 71267b0a..80e244ba 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/function-templates-original.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/function-templates-original.cc
@@ -21,9 +21,6 @@ class Checked {
public:
template<typename U, typename V>
Checked(const Checked<U, V>& rhs){
- // This (incorrectly) doesn't get rewritten, since it's not instantiated. In
- // this case, the AST representation contains a bunch of
- // CXXDependentScopeMemberExpr nodes.
if (rhs.hasOverflowed())
this->overflowed();
if (!isInBounds<T>(rhs.m_value))
@@ -40,11 +37,28 @@ class Checked {
template<typename To, typename From>
To bitwise_cast(From from) {
- static_assert(sizeof(To) == sizeof(From));
+ static_assert(sizeof(To) == sizeof(From), "msg");
return reinterpret_cast<To>(from);
}
} // namespace WTF
+namespace mojo {
+
+template <typename U>
+struct ArrayTraits;
+
+template <typename U>
+struct ArrayTraits<WTF::Checked<U, int>> {
+ static bool HasOverflowed(WTF::Checked<U, int>& input) {
+ // |hasOverflowed| below should be rewritten to |HasOverflowed|
+ // (because this is a method of WTF::Checked; it doesn't matter
+ // that we are not in WTF namespace *here*).
+ return input.hasOverflowed();
+ }
+};
+
+} // namespace mojo
+
using WTF::bitwise_cast;
using WTF::safeCast;