diff options
| author | Dan Willemsen <dwillemsen@google.com> | 2016-11-01 14:49:08 -0700 |
|---|---|---|
| committer | Dan Willemsen <dwillemsen@google.com> | 2016-11-01 14:49:46 -0700 |
| commit | cb2ff8558ced3ddc021823a3c86bc7ce02dcbdc3 (patch) | |
| tree | a1c65ac2a0f2ef41fbb29ea16c27f1ad5ccdc2d4 | |
| parent | ba9de4bc7eb7327d1177270d0956d6cb7aaf1d9c (diff) | |
Fix some possible performance issues found by clang-tidy
No obvious time differences when building AOSP, but these all seem like
reasonable changes.
| -rw-r--r-- | Android.bp | 5 | ||||
| -rw-r--r-- | dep.cc | 2 | ||||
| -rw-r--r-- | rule.cc | 2 | ||||
| -rw-r--r-- | rule.h | 2 | ||||
| -rw-r--r-- | strutil.cc | 2 | ||||
| -rw-r--r-- | strutil.h | 2 |
6 files changed, 10 insertions, 5 deletions
@@ -25,6 +25,11 @@ cc_defaults { host_ldlibs: ["-lrt", "-lpthread"], }, }, + tidy_checks: [ + "-google-global-names-in-headers", + "-google-build-using-namespace", + "-google-explicit-constructor", + ], } cc_library_host_static { @@ -534,7 +534,7 @@ class DepBuilder { if (found == suffix_rules_.end()) return rule_merger; - for (shared_ptr<Rule> irule : found->second) { + for (const shared_ptr<Rule> &irule : found->second) { CHECK(irule->inputs.size() == 1); Symbol input = ReplaceSuffix(output, irule->inputs[0]); if (!Exists(input)) @@ -54,7 +54,7 @@ Rule::Rule() } void ParseRule(Loc& loc, StringPiece line, char term, - function<string()> after_term_fn, + const function<string()> &after_term_fn, Rule** out_rule, RuleVarAssignment* rule_var) { size_t index = line.find(':'); if (index == string::npos) { @@ -65,7 +65,7 @@ struct RuleVarAssignment { // |term| is '='), |after_term_fn| will be called to obtain the right // hand side. void ParseRule(Loc& loc, StringPiece line, char term, - function<string()> after_term_fn, + const function<string()> &after_term_fn, Rule** rule, RuleVarAssignment* rule_var); #endif // RULE_H_ @@ -500,7 +500,7 @@ string ConcatDir(StringPiece b, StringPiece n) { return r; } -string EchoEscape(const string str) { +string EchoEscape(const string &str) { const char *in = str.c_str(); string buf; for (; *in; in++) { @@ -140,7 +140,7 @@ string SortWordsInString(StringPiece s); string ConcatDir(StringPiece b, StringPiece n); -string EchoEscape(const string str); +string EchoEscape(const string &str); void EscapeShell(string* s); |
