OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Changes Blink-style names to Chrome-style names. Currently transforms: | 5 // Changes Blink-style names to Chrome-style names. Currently transforms: |
6 // fields: | 6 // fields: |
7 // int m_operationCount => int operation_count_ | 7 // int m_operationCount => int operation_count_ |
8 // variables (including parameters): | 8 // variables (including parameters): |
9 // int mySuperVariable => int my_super_variable | 9 // int mySuperVariable => int my_super_variable |
10 // constants: | 10 // constants: |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 468 |
469 bool IsProbablyConst(const clang::VarDecl& decl, | 469 bool IsProbablyConst(const clang::VarDecl& decl, |
470 const clang::ASTContext& context) { | 470 const clang::ASTContext& context) { |
471 clang::QualType type = decl.getType(); | 471 clang::QualType type = decl.getType(); |
472 if (!type.isConstQualified()) | 472 if (!type.isConstQualified()) |
473 return false; | 473 return false; |
474 | 474 |
475 if (type.isVolatileQualified()) | 475 if (type.isVolatileQualified()) |
476 return false; | 476 return false; |
477 | 477 |
| 478 if (decl.isConstexpr()) |
| 479 return true; |
| 480 |
478 // Parameters should not be renamed to |kFooBar| style (even if they are | 481 // Parameters should not be renamed to |kFooBar| style (even if they are |
479 // const and have an initializer (aka default value)). | 482 // const and have an initializer (aka default value)). |
480 if (clang::isa<clang::ParmVarDecl>(&decl)) | 483 if (clang::isa<clang::ParmVarDecl>(&decl)) |
481 return false; | 484 return false; |
482 | 485 |
483 // http://google.github.io/styleguide/cppguide.html#Constant_Names | 486 // http://google.github.io/styleguide/cppguide.html#Constant_Names |
484 // Static variables that are const-qualified should use kConstantStyle naming. | 487 // Static variables that are const-qualified should use kConstantStyle naming. |
485 if (decl.getStorageDuration() == clang::SD_Static) | 488 if (decl.getStorageDuration() == clang::SD_Static) |
486 return true; | 489 return true; |
487 | 490 |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 for (const auto& r : replacements) { | 1667 for (const auto& r : replacements) { |
1665 std::string replacement_text = r.getReplacementText().str(); | 1668 std::string replacement_text = r.getReplacementText().str(); |
1666 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); | 1669 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); |
1667 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() | 1670 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() |
1668 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; | 1671 << ":::" << r.getLength() << ":::" << replacement_text << "\n"; |
1669 } | 1672 } |
1670 llvm::outs() << "==== END EDITS ====\n"; | 1673 llvm::outs() << "==== END EDITS ====\n"; |
1671 | 1674 |
1672 return 0; | 1675 return 0; |
1673 } | 1676 } |
OLD | NEW |