| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Identifiers in macros should never be rewritten, as the risk of things | 5 // Identifiers in macros should never be rewritten, as the risk of things |
| 6 // breaking is extremely high. | 6 // breaking is extremely high. |
| 7 | 7 |
| 8 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, predicate) \ | 8 #define DEFINE_TYPE_CASTS(thisType, argumentType, argumentName, predicate) \ |
| 9 inline thisType* to##thisType(argumentType* argumentName) { \ | 9 inline thisType* to##thisType(argumentType* argumentName) { \ |
| 10 if (!predicate) \ | 10 if (!predicate) \ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // a macro invocation. | 30 // a macro invocation. |
| 31 Derived* derivedPtr = toDerived(basePtr); | 31 Derived* derivedPtr = toDerived(basePtr); |
| 32 long long asInt = toInt(basePtr); | 32 long long asInt = toInt(basePtr); |
| 33 // 'derivedPtr' should be renamed: it's a reference to a declaration defined | 33 // 'derivedPtr' should be renamed: it's a reference to a declaration defined |
| 34 // outside a macro invocation. | 34 // outside a macro invocation. |
| 35 if (LIKELY(derivedPtr)) { | 35 if (LIKELY(derivedPtr)) { |
| 36 delete derivedPtr; | 36 delete derivedPtr; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 #define CALL_METHOD_FROM_MACRO() \ |
| 41 void callMethodFromMacro() { method(); } \ |
| 42 void pmethod() override {} |
| 43 |
| 44 struct WithMacroP { |
| 45 virtual void pmethod() {} |
| 46 }; |
| 47 |
| 48 struct WithMacro : public WithMacroP { |
| 49 void method() {} |
| 50 CALL_METHOD_FROM_MACRO(); |
| 51 }; |
| 52 |
| 40 } // namespace blink | 53 } // namespace blink |
| OLD | NEW |