mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 17:40:14 +01:00
Note, not trying to address every last error, just some obvious/easy ones.
```
/usr/local/google/home/jperkins/dev/carbon-lang/common/string_helpers.cpp:200:13: warning: prefer transparent functors 'less_equal<>' [modernize-use-transparent-functors]
auto le = std::less_equal<const char*>();
^
/usr/local/google/home/jperkins/dev/carbon-lang/toolchain/semantics/nodes/function.h:22:45: warning: pass by value and use std::move [modernize-pass-by-value]
Function(ParseTree::Node node, NodeId id, llvm::SmallVector<NodeRef> body)
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/ast/declaration.cpp:230:14: warning: static member accessed through instance [readability-static-accessed-through-instance]
return cast<SelfDeclaration>(declaration).name();
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/interpreter/type_checker.cpp:1104:33: warning: std::move of the variable 'impl' of the trivially-copyable type 'ConstraintType::ImplConstraint' has no effect [performance-move-const-arg]
impl_constraints_.push_back(std::move(impl));
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/interpreter/type_checker.cpp:1145:36: warning: std::move of the variable 'rewrite' of the trivially-copyable type 'ConstraintType::RewriteConstraint' has no effect [performance-move-const-arg]
rewrite_constraints_.push_back(std::move(rewrite));
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/interpreter/type_checker.cpp:1156:32: warning: std::move of the variable 'context' of the trivially-copyable type 'ConstraintType::LookupContext' has no effect [performance-move-const-arg]
lookup_contexts_.push_back(std::move(context));
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/fuzzing/fuzzverter.cpp:74:42: warning: argument name 'trace' in comment does not match parameter name 'parser_debug' [bugprone-argument-comment]
/*trace=*/false);
^
./explorer/syntax/parse.h:19:17: note: 'parser_debug' declared here
bool parser_debug) -> ErrorOr<Carbon::AST>;
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/fuzzing/proto_to_carbon_test.cpp:34:55: warning: argument name 'trace' in comment does not match parameter name 'parser_debug' [bugprone-argument-comment]
const ErrorOr<AST> ast = Carbon::Parse(&arena, f, /*trace=*/false);
^
./explorer/syntax/parse.h:19:17: note: 'parser_debug' declared here
bool parser_debug) -> ErrorOr<Carbon::AST>;
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/fuzzing/proto_to_carbon_test.cpp:42:41: warning: argument name 'trace' in comment does not match parameter name 'parser_debug' [bugprone-argument-comment]
&arena, f, source_from_proto, /*trace=*/false);
^
./explorer/syntax/parse.h:25:59: note: 'parser_debug' declared here
std::string_view file_contents, bool parser_debug)
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/syntax/parse_test.cpp:27:60: warning: argument name 'trace' in comment does not match parameter name 'parser_debug' [bugprone-argument-comment]
ParseFromString(&arena, "file.carbon", FileContents, /*trace=*/false);
^
./explorer/syntax/parse.h:25:59: note: 'parser_debug' declared here
std::string_view file_contents, bool parser_debug)
^
/usr/local/google/home/jperkins/dev/carbon-lang/migrate_cpp/cpp_refactoring/var_decl.cpp:57:58: warning: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation]
segments.push_back({type_loc_class, qual_str + " " + range_str});
^
/usr/local/google/home/jperkins/dev/carbon-lang/explorer/fuzzing/ast_to_proto_test.cpp:105:55: warning: argument name 'trace' in comment does not match parameter name 'parser_debug' [bugprone-argument-comment]
const ErrorOr<AST> ast = Carbon::Parse(&arena, f, /*trace=*/false);
^
./explorer/syntax/parse.h:19:17: note: 'parser_debug' declared here
bool parser_debug) -> ErrorOr<Carbon::AST>;
^
```
116 lines
2.5 KiB
Python
116 lines
2.5 KiB
Python
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
cc_binary(
|
|
name = "cpp_refactoring",
|
|
srcs = ["main.cpp"],
|
|
deps = [
|
|
":fn_inserter",
|
|
":for_range",
|
|
":matcher",
|
|
":var_decl",
|
|
"@llvm-project//clang:tooling",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "matcher",
|
|
srcs = ["matcher.cpp"],
|
|
hdrs = [
|
|
"matcher.h",
|
|
"matcher_manager.h",
|
|
],
|
|
deps = [
|
|
"@llvm-project//clang:ast_matchers",
|
|
"@llvm-project//clang:basic",
|
|
"@llvm-project//clang:lex",
|
|
"@llvm-project//clang:tooling_core",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "matcher_test_base",
|
|
testonly = 1,
|
|
hdrs = ["matcher_test_base.h"],
|
|
deps = [
|
|
":matcher",
|
|
"@com_google_googletest//:gtest",
|
|
"@llvm-project//clang:ast_matchers",
|
|
"@llvm-project//clang:tooling",
|
|
"@llvm-project//clang:tooling_core",
|
|
],
|
|
)
|
|
|
|
# Individual matchers
|
|
|
|
cc_library(
|
|
name = "fn_inserter",
|
|
srcs = ["fn_inserter.cpp"],
|
|
hdrs = ["fn_inserter.h"],
|
|
deps = [
|
|
":matcher",
|
|
"@llvm-project//clang:ast_matchers",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "fn_inserter_test",
|
|
srcs = ["fn_inserter_test.cpp"],
|
|
deps = [
|
|
":fn_inserter",
|
|
":matcher_test_base",
|
|
"//common:gtest_main",
|
|
"@com_google_googletest//:gtest",
|
|
"@llvm-project//clang:tooling",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "for_range",
|
|
srcs = ["for_range.cpp"],
|
|
hdrs = ["for_range.h"],
|
|
deps = [
|
|
":matcher",
|
|
"@llvm-project//clang:ast_matchers",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "for_range_test",
|
|
srcs = ["for_range_test.cpp"],
|
|
deps = [
|
|
":for_range",
|
|
":matcher_test_base",
|
|
"//common:gtest_main",
|
|
"@com_google_googletest//:gtest",
|
|
"@llvm-project//clang:tooling",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "var_decl",
|
|
srcs = ["var_decl.cpp"],
|
|
hdrs = ["var_decl.h"],
|
|
deps = [
|
|
":matcher",
|
|
"@llvm-project//clang:ast_matchers",
|
|
"@llvm-project//clang:type_nodes_gen",
|
|
"@llvm-project//llvm:Support",
|
|
],
|
|
)
|
|
|
|
cc_test(
|
|
name = "var_decl_test",
|
|
srcs = ["var_decl_test.cpp"],
|
|
deps = [
|
|
":matcher_test_base",
|
|
":var_decl",
|
|
"//common:gtest_main",
|
|
"@com_google_googletest//:gtest",
|
|
"@llvm-project//clang:tooling",
|
|
],
|
|
)
|