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

Side by Side Diff: tools/clang/value_cleanup/ListValueRewriter.cpp

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months 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 unified diff | Download patch
OLDNEW
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 #include "ListValueRewriter.h" 5 #include "ListValueRewriter.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "clang/AST/ASTContext.h" 10 #include "clang/AST/ASTContext.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 cxxNewExpr(has(cxxConstructExpr( 401 cxxNewExpr(has(cxxConstructExpr(
402 hasDeclaration(cxxMethodDecl( 402 hasDeclaration(cxxMethodDecl(
403 hasName("::base::Value::FundamentalValue"))), 403 hasName("::base::Value::FundamentalValue"))),
404 argumentCountIs(1), 404 argumentCountIs(1),
405 hasArgument( 405 hasArgument(
406 0, id("argExpr", 406 0, id("argExpr",
407 expr(hasType( 407 expr(hasType(
408 realFloatingPointType())))))))))))), 408 realFloatingPointType())))))))))))),
409 &append_double_callback_); 409 &append_double_callback_);
410 410
411 // base::ListValue::Append(new base::StringValue(...)) 411 // base::ListValue::Append(new base::Value(...))
412 // => base::ListValue::AppendString() 412 // => base::ListValue::AppendString()
413 match_finder->addMatcher( 413 match_finder->addMatcher(
414 id("callExpr", 414 id("callExpr",
415 cxxMemberCallExpr( 415 cxxMemberCallExpr(
416 is_list_append, 416 is_list_append,
417 hasArgument( 417 hasArgument(
418 0, ignoringParenImpCasts(id( 418 0, ignoringParenImpCasts(
419 "newExpr", 419 id("newExpr",
420 cxxNewExpr(has(cxxConstructExpr( 420 cxxNewExpr(has(cxxConstructExpr(
421 hasDeclaration(cxxMethodDecl( 421 hasDeclaration(cxxMethodDecl(
422 hasName("::base::StringValue::StringValue"))), 422 hasName("::base::Value::StringValue"))),
423 argumentCountIs(1), 423 argumentCountIs(1),
424 hasArgument(0, id("argExpr", expr())))))))))), 424 hasArgument(0, id("argExpr", expr())))))))))),
425 &append_string_callback_); 425 &append_string_callback_);
426 426
427 auto is_unique_ptr_release = 427 auto is_unique_ptr_release =
428 allOf(callee(cxxMethodDecl( 428 allOf(callee(cxxMethodDecl(
429 hasName("release"), 429 hasName("release"),
430 ofClass(cxxRecordDecl(hasName("::std::unique_ptr"))))), 430 ofClass(cxxRecordDecl(hasName("::std::unique_ptr"))))),
431 argumentCountIs(0)); 431 argumentCountIs(0));
432 432
433 // base::ListValue::Append(ReturnsUniquePtr().release()) 433 // base::ListValue::Append(ReturnsUniquePtr().release())
434 // => base::ListValue::Append(ReturnsUniquePtr()) 434 // => base::ListValue::Append(ReturnsUniquePtr())
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 anyOf(hasInitializer( 473 anyOf(hasInitializer(
474 // Note this won't match C++11 uniform 474 // Note this won't match C++11 uniform
475 // initialization syntax, since the 475 // initialization syntax, since the
476 // CXXNewExpr is wrapped in an 476 // CXXNewExpr is wrapped in an
477 // InitListExpr in that case. 477 // InitListExpr in that case.
478 ignoringParenImpCasts(cxxNewExpr())), 478 ignoringParenImpCasts(cxxNewExpr())),
479 unless(hasInitializer(expr()))), 479 unless(hasInitializer(expr()))),
480 unless(parmVarDecl()))))))))), 480 unless(parmVarDecl()))))))))),
481 &append_raw_ptr_callback_); 481 &append_raw_ptr_callback_);
482 } 482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698