Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: tools/clang/rewrite_to_chrome_style/tests/function-templates-expected.cc

Issue 2256913002: Handling of DependentScopeDeclRefExpr and CXXDependentScopeMemberExpr nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-style-new-clang
Patch Set: Tweaked a comment + fixed a typo. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/clang/rewrite_to_chrome_style/tests/function-templates-expected.cc
diff --git a/tools/clang/rewrite_to_chrome_style/tests/function-templates-expected.cc b/tools/clang/rewrite_to_chrome_style/tests/function-templates-expected.cc
index 69a3349583038f79f237f6503c2bb9ef57f78056..8d064a1816cfc8a15efd8c48d8507161c109141f 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/function-templates-expected.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/function-templates-expected.cc
@@ -21,14 +21,11 @@ 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))
- this->overflowed();
- value_ = static_cast<T>(rhs.m_value);
+ if (rhs.HasOverflowed())
+ this->Overflowed();
+ if (!IsInBounds<T>(rhs.value_))
+ this->Overflowed();
+ value_ = static_cast<T>(rhs.value_);
}
bool HasOverflowed() const { return false; }
@@ -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;

Powered by Google App Engine
This is Rietveld 408576698