cpplint: Cleanup errors
Cleanup errors from upstream cpplint in preparation
for moving art's cpplint fork to upstream tip-of-tree cpplint.
Test: cd art && mm
Bug: 68951293
Change-Id: I15faed4594cbcb8399850f8bdee39d42c0c5b956
diff --git a/cmdline/cmdline_result.h b/cmdline/cmdline_result.h
index 963dfc1..e41043a 100644
--- a/cmdline/cmdline_result.h
+++ b/cmdline/cmdline_result.h
@@ -21,83 +21,82 @@
#include <utils.h>
namespace art {
- // Result of an attempt to process the command line arguments. If fails, specifies
- // the specific error code and an error message.
- // Use the value-carrying CmdlineParseResult<T> to get an additional value out in a success case.
- struct CmdlineResult {
- enum Status {
- kSuccess,
- // Error codes:
- kUsage,
- kFailure,
- kOutOfRange,
- kUnknown,
- };
-
- // Short-hand for checking if the result was successful.
- operator bool() const {
- return IsSuccess();
- }
-
- // Check if the operation has succeeded.
- bool IsSuccess() const { return status_ == kSuccess; }
- // Check if the operation was not a success.
- bool IsError() const { return status_ != kSuccess; }
- // Get the specific status, regardless of whether it's failure or success.
- Status GetStatus() const { return status_; }
-
- // Get the error message, *must* only be called for error status results.
- const std::string& GetMessage() const { assert(IsError()); return message_; }
-
- // Constructor any status. No message.
- explicit CmdlineResult(Status status) : status_(status) {}
-
- // Constructor with an error status, copying the message.
- CmdlineResult(Status status, const std::string& message)
- : status_(status), message_(message) {
- assert(status != kSuccess);
- }
-
- // Constructor with an error status, taking over the message.
- CmdlineResult(Status status, std::string&& message)
- : status_(status), message_(message) {
- assert(status != kSuccess);
- }
-
- // Make sure copying exists
- CmdlineResult(const CmdlineResult&) = default;
- // Make sure moving is cheap
- CmdlineResult(CmdlineResult&&) = default;
-
- private:
- const Status status_;
- const std::string message_;
+// Result of an attempt to process the command line arguments. If fails, specifies
+// the specific error code and an error message.
+// Use the value-carrying CmdlineParseResult<T> to get an additional value out in a success case.
+struct CmdlineResult {
+ enum Status {
+ kSuccess,
+ // Error codes:
+ kUsage,
+ kFailure,
+ kOutOfRange,
+ kUnknown,
};
- // TODO: code-generate this
- static inline std::ostream& operator<<(std::ostream& stream, CmdlineResult::Status status) {
- switch (status) {
- case CmdlineResult::kSuccess:
- stream << "kSuccess";
- break;
- case CmdlineResult::kUsage:
- stream << "kUsage";
- break;
- case CmdlineResult::kFailure:
- stream << "kFailure";
- break;
- case CmdlineResult::kOutOfRange:
- stream << "kOutOfRange";
- break;
- case CmdlineResult::kUnknown:
- stream << "kUnknown";
- break;
- default:
- UNREACHABLE();
- }
- return stream;
+ // Short-hand for checking if the result was successful.
+ operator bool() const {
+ return IsSuccess();
}
+ // Check if the operation has succeeded.
+ bool IsSuccess() const { return status_ == kSuccess; }
+ // Check if the operation was not a success.
+ bool IsError() const { return status_ != kSuccess; }
+ // Get the specific status, regardless of whether it's failure or success.
+ Status GetStatus() const { return status_; }
+
+ // Get the error message, *must* only be called for error status results.
+ const std::string& GetMessage() const { assert(IsError()); return message_; }
+
+ // Constructor any status. No message.
+ explicit CmdlineResult(Status status) : status_(status) {}
+
+ // Constructor with an error status, copying the message.
+ CmdlineResult(Status status, const std::string& message)
+ : status_(status), message_(message) {
+ assert(status != kSuccess);
+ }
+
+ // Constructor with an error status, taking over the message.
+ CmdlineResult(Status status, std::string&& message)
+ : status_(status), message_(message) {
+ assert(status != kSuccess);
+ }
+
+ // Make sure copying exists
+ CmdlineResult(const CmdlineResult&) = default;
+ // Make sure moving is cheap
+ CmdlineResult(CmdlineResult&&) = default;
+
+ private:
+ const Status status_;
+ const std::string message_;
+};
+
+// TODO: code-generate this
+static inline std::ostream& operator<<(std::ostream& stream, CmdlineResult::Status status) {
+ switch (status) {
+ case CmdlineResult::kSuccess:
+ stream << "kSuccess";
+ break;
+ case CmdlineResult::kUsage:
+ stream << "kUsage";
+ break;
+ case CmdlineResult::kFailure:
+ stream << "kFailure";
+ break;
+ case CmdlineResult::kOutOfRange:
+ stream << "kOutOfRange";
+ break;
+ case CmdlineResult::kUnknown:
+ stream << "kUnknown";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return stream;
+}
} // namespace art
#endif // ART_CMDLINE_CMDLINE_RESULT_H_
diff --git a/cmdline/detail/cmdline_debug_detail.h b/cmdline/detail/cmdline_debug_detail.h
index 79028f4..e69d5dc 100644
--- a/cmdline/detail/cmdline_debug_detail.h
+++ b/cmdline/detail/cmdline_debug_detail.h
@@ -25,16 +25,16 @@
#endif
namespace art {
- // Implementation details for some template querying. Don't look inside if you hate templates.
- namespace detail {
- struct debug_log_ignore {
- // Ignore most of the normal operator<< usage.
- template <typename T>
- debug_log_ignore& operator<<(const T&) { return *this; }
- // Ignore std::endl and the like.
- debug_log_ignore& operator<<(std::ostream& (*)(std::ostream&) ) { return *this; }
- };
- } // namespace detail // NOLINT [readability/namespace] [5]
+// Implementation details for some template querying. Don't look inside if you hate templates.
+namespace detail {
+struct debug_log_ignore {
+ // Ignore most of the normal operator<< usage.
+ template <typename T>
+ debug_log_ignore& operator<<(const T&) { return *this; }
+ // Ignore std::endl and the like.
+ debug_log_ignore& operator<<(std::ostream& (*)(std::ostream&) ) { return *this; }
+};
+} // namespace detail // NOLINT [readability/namespace] [5]
} // namespace art
#endif // ART_CMDLINE_DETAIL_CMDLINE_DEBUG_DETAIL_H_
diff --git a/cmdline/detail/cmdline_parse_argument_detail.h b/cmdline/detail/cmdline_parse_argument_detail.h
index ceb6fa7..2fee27c 100644
--- a/cmdline/detail/cmdline_parse_argument_detail.h
+++ b/cmdline/detail/cmdline_parse_argument_detail.h
@@ -33,473 +33,473 @@
#include "unit.h"
namespace art {
- // Implementation details for the parser. Do not look inside if you hate templates.
- namespace detail {
- // A non-templated base class for argument parsers. Used by the general parser
- // to parse arguments, without needing to know the argument type at compile time.
- //
- // This is an application of the type erasure idiom.
- struct CmdlineParseArgumentAny {
- virtual ~CmdlineParseArgumentAny() {}
+// Implementation details for the parser. Do not look inside if you hate templates.
+namespace detail {
+// A non-templated base class for argument parsers. Used by the general parser
+// to parse arguments, without needing to know the argument type at compile time.
+//
+// This is an application of the type erasure idiom.
+struct CmdlineParseArgumentAny {
+ virtual ~CmdlineParseArgumentAny() {}
- // Attempt to parse this argument starting at arguments[position].
- // If the parsing succeeds, the parsed value will be saved as a side-effect.
- //
- // In most situations, the parsing will not match by returning kUnknown. In this case,
- // no tokens were consumed and the position variable will not be updated.
- //
- // At other times, parsing may fail due to validation but the initial token was still matched
- // (for example an out of range value, or passing in a string where an int was expected).
- // In this case the tokens are still consumed, and the position variable will get incremented
- // by all the consumed tokens.
- //
- // The # of tokens consumed by the parse attempt will be set as an out-parameter into
- // consumed_tokens. The parser should skip this many tokens before parsing the next
- // argument.
- virtual CmdlineResult ParseArgument(const TokenRange& arguments, size_t* consumed_tokens) = 0;
- // How many tokens should be taken off argv for parsing this argument.
- // For example "--help" is just 1, "-compiler-option _" would be 2 (since there's a space).
- //
- // A [min,max] range is returned to represent argument definitions with multiple
- // value tokens. (e.g. {"-h", "-h " } would return [1,2]).
- virtual std::pair<size_t, size_t> GetNumTokens() const = 0;
- // Get the run-time typename of the argument type.
- virtual const char* GetTypeName() const = 0;
- // Try to do a close match, returning how many tokens were matched against this argument
- // definition. More tokens is better.
- //
- // Do a quick match token-by-token, and see if they match.
- // Any tokens with a wildcard in them are only matched up until the wildcard.
- // If this is true, then the wildcard matching later on can still fail, so this is not
- // a guarantee that the argument is correct, it's more of a strong hint that the
- // user-provided input *probably* was trying to match this argument.
- //
- // Returns how many tokens were either matched (or ignored because there was a
- // wildcard present). 0 means no match. If the Size() tokens are returned.
- virtual size_t MaybeMatches(const TokenRange& tokens) = 0;
- };
+ // Attempt to parse this argument starting at arguments[position].
+ // If the parsing succeeds, the parsed value will be saved as a side-effect.
+ //
+ // In most situations, the parsing will not match by returning kUnknown. In this case,
+ // no tokens were consumed and the position variable will not be updated.
+ //
+ // At other times, parsing may fail due to validation but the initial token was still matched
+ // (for example an out of range value, or passing in a string where an int was expected).
+ // In this case the tokens are still consumed, and the position variable will get incremented
+ // by all the consumed tokens.
+ //
+ // The # of tokens consumed by the parse attempt will be set as an out-parameter into
+ // consumed_tokens. The parser should skip this many tokens before parsing the next
+ // argument.
+ virtual CmdlineResult ParseArgument(const TokenRange& arguments, size_t* consumed_tokens) = 0;
+ // How many tokens should be taken off argv for parsing this argument.
+ // For example "--help" is just 1, "-compiler-option _" would be 2 (since there's a space).
+ //
+ // A [min,max] range is returned to represent argument definitions with multiple
+ // value tokens. (e.g. {"-h", "-h " } would return [1,2]).
+ virtual std::pair<size_t, size_t> GetNumTokens() const = 0;
+ // Get the run-time typename of the argument type.
+ virtual const char* GetTypeName() const = 0;
+ // Try to do a close match, returning how many tokens were matched against this argument
+ // definition. More tokens is better.
+ //
+ // Do a quick match token-by-token, and see if they match.
+ // Any tokens with a wildcard in them are only matched up until the wildcard.
+ // If this is true, then the wildcard matching later on can still fail, so this is not
+ // a guarantee that the argument is correct, it's more of a strong hint that the
+ // user-provided input *probably* was trying to match this argument.
+ //
+ // Returns how many tokens were either matched (or ignored because there was a
+ // wildcard present). 0 means no match. If the Size() tokens are returned.
+ virtual size_t MaybeMatches(const TokenRange& tokens) = 0;
+};
- template <typename T>
- using EnableIfNumeric = std::enable_if<std::is_arithmetic<T>::value>;
+template <typename T>
+using EnableIfNumeric = std::enable_if<std::is_arithmetic<T>::value>;
- template <typename T>
- using DisableIfNumeric = std::enable_if<!std::is_arithmetic<T>::value>;
+template <typename T>
+using DisableIfNumeric = std::enable_if<!std::is_arithmetic<T>::value>;
- // Argument definition information, created by an ArgumentBuilder and an UntypedArgumentBuilder.
- template <typename TArg>
- struct CmdlineParserArgumentInfo {
- // This version will only be used if TArg is arithmetic and thus has the <= operators.
- template <typename T = TArg> // Necessary to get SFINAE to kick in.
- bool CheckRange(const TArg& value, typename EnableIfNumeric<T>::type* = 0) {
- if (has_range_) {
- return min_ <= value && value <= max_;
- }
- return true;
+// Argument definition information, created by an ArgumentBuilder and an UntypedArgumentBuilder.
+template <typename TArg>
+struct CmdlineParserArgumentInfo {
+ // This version will only be used if TArg is arithmetic and thus has the <= operators.
+ template <typename T = TArg> // Necessary to get SFINAE to kick in.
+ bool CheckRange(const TArg& value, typename EnableIfNumeric<T>::type* = 0) {
+ if (has_range_) {
+ return min_ <= value && value <= max_;
+ }
+ return true;
+ }
+
+ // This version will be used at other times when TArg is not arithmetic.
+ template <typename T = TArg>
+ bool CheckRange(const TArg&, typename DisableIfNumeric<T>::type* = 0) {
+ assert(!has_range_);
+ return true;
+ }
+
+ // Do a quick match token-by-token, and see if they match.
+ // Any tokens with a wildcard in them only match the prefix up until the wildcard.
+ //
+ // If this is true, then the wildcard matching later on can still fail, so this is not
+ // a guarantee that the argument is correct, it's more of a strong hint that the
+ // user-provided input *probably* was trying to match this argument.
+ size_t MaybeMatches(const TokenRange& token_list) const {
+ auto best_match = FindClosestMatch(token_list);
+
+ return best_match.second;
+ }
+
+ // Attempt to find the closest match (see MaybeMatches).
+ //
+ // Returns the token range that was the closest match and the # of tokens that
+ // this range was matched up until.
+ std::pair<const TokenRange*, size_t> FindClosestMatch(const TokenRange& token_list) const {
+ const TokenRange* best_match_ptr = nullptr;
+
+ size_t best_match = 0;
+ for (auto&& token_range : tokenized_names_) {
+ size_t this_match = token_range.MaybeMatches(token_list, std::string("_"));
+
+ if (this_match > best_match) {
+ best_match_ptr = &token_range;
+ best_match = this_match;
+ }
+ }
+
+ return std::make_pair(best_match_ptr, best_match);
+ }
+
+ // Mark the argument definition as completed, do not mutate the object anymore after this
+ // call is done.
+ //
+ // Performs several sanity checks and token calculations.
+ void CompleteArgument() {
+ assert(names_.size() >= 1);
+ assert(!is_completed_);
+
+ is_completed_ = true;
+
+ size_t blank_count = 0;
+ size_t token_count = 0;
+
+ size_t global_blank_count = 0;
+ size_t global_token_count = 0;
+ for (auto&& name : names_) {
+ std::string s(name);
+
+ size_t local_blank_count = std::count(s.begin(), s.end(), '_');
+ size_t local_token_count = std::count(s.begin(), s.end(), ' ');
+
+ if (global_blank_count != 0) {
+ assert(local_blank_count == global_blank_count
+ && "Every argument descriptor string must have same amount of blanks (_)");
}
- // This version will be used at other times when TArg is not arithmetic.
- template <typename T = TArg>
- bool CheckRange(const TArg&, typename DisableIfNumeric<T>::type* = 0) {
- assert(!has_range_);
- return true;
+ if (local_blank_count != 0) {
+ global_blank_count = local_blank_count;
+ blank_count++;
+
+ assert(local_blank_count == 1 && "More than one blank is not supported");
+ assert(s.back() == '_' && "The blank character must only be at the end of the string");
}
- // Do a quick match token-by-token, and see if they match.
- // Any tokens with a wildcard in them only match the prefix up until the wildcard.
- //
- // If this is true, then the wildcard matching later on can still fail, so this is not
- // a guarantee that the argument is correct, it's more of a strong hint that the
- // user-provided input *probably* was trying to match this argument.
- size_t MaybeMatches(const TokenRange& token_list) const {
- auto best_match = FindClosestMatch(token_list);
-
- return best_match.second;
+ if (global_token_count != 0) {
+ assert(local_token_count == global_token_count
+ && "Every argument descriptor string must have same amount of tokens (spaces)");
}
- // Attempt to find the closest match (see MaybeMatches).
- //
- // Returns the token range that was the closest match and the # of tokens that
- // this range was matched up until.
- std::pair<const TokenRange*, size_t> FindClosestMatch(const TokenRange& token_list) const {
- const TokenRange* best_match_ptr = nullptr;
-
- size_t best_match = 0;
- for (auto&& token_range : tokenized_names_) {
- size_t this_match = token_range.MaybeMatches(token_list, std::string("_"));
-
- if (this_match > best_match) {
- best_match_ptr = &token_range;
- best_match = this_match;
- }
- }
-
- return std::make_pair(best_match_ptr, best_match);
+ if (local_token_count != 0) {
+ global_token_count = local_token_count;
+ token_count++;
}
- // Mark the argument definition as completed, do not mutate the object anymore after this
- // call is done.
- //
- // Performs several sanity checks and token calculations.
- void CompleteArgument() {
- assert(names_.size() >= 1);
- assert(!is_completed_);
-
- is_completed_ = true;
-
- size_t blank_count = 0;
- size_t token_count = 0;
-
- size_t global_blank_count = 0;
- size_t global_token_count = 0;
- for (auto&& name : names_) {
- std::string s(name);
-
- size_t local_blank_count = std::count(s.begin(), s.end(), '_');
- size_t local_token_count = std::count(s.begin(), s.end(), ' ');
-
- if (global_blank_count != 0) {
- assert(local_blank_count == global_blank_count
- && "Every argument descriptor string must have same amount of blanks (_)");
- }
-
- if (local_blank_count != 0) {
- global_blank_count = local_blank_count;
- blank_count++;
-
- assert(local_blank_count == 1 && "More than one blank is not supported");
- assert(s.back() == '_' && "The blank character must only be at the end of the string");
- }
-
- if (global_token_count != 0) {
- assert(local_token_count == global_token_count
- && "Every argument descriptor string must have same amount of tokens (spaces)");
- }
-
- if (local_token_count != 0) {
- global_token_count = local_token_count;
- token_count++;
- }
-
- // Tokenize every name, turning it from a string to a token list.
- tokenized_names_.clear();
- for (auto&& name1 : names_) {
- // Split along ' ' only, removing any duplicated spaces.
- tokenized_names_.push_back(
- TokenRange::Split(name1, {' '}).RemoveToken(" "));
- }
-
- // remove the _ character from each of the token ranges
- // we will often end up with an empty token (i.e. ["-XX", "_"] -> ["-XX", ""]
- // and this is OK because we still need an empty token to simplify
- // range comparisons
- simple_names_.clear();
-
- for (auto&& tokenized_name : tokenized_names_) {
- simple_names_.push_back(tokenized_name.RemoveCharacter('_'));
- }
- }
-
- if (token_count != 0) {
- assert(("Every argument descriptor string must have equal amount of tokens (spaces)" &&
- token_count == names_.size()));
- }
-
- if (blank_count != 0) {
- assert(("Every argument descriptor string must have an equal amount of blanks (_)" &&
- blank_count == names_.size()));
- }
-
- using_blanks_ = blank_count > 0;
- {
- size_t smallest_name_token_range_size =
- std::accumulate(tokenized_names_.begin(), tokenized_names_.end(), ~(0u),
- [](size_t min, const TokenRange& cur) {
- return std::min(min, cur.Size());
- });
- size_t largest_name_token_range_size =
- std::accumulate(tokenized_names_.begin(), tokenized_names_.end(), 0u,
- [](size_t max, const TokenRange& cur) {
- return std::max(max, cur.Size());
- });
-
- token_range_size_ = std::make_pair(smallest_name_token_range_size,
- largest_name_token_range_size);
- }
-
- if (has_value_list_) {
- assert(names_.size() == value_list_.size()
- && "Number of arg descriptors must match number of values");
- assert(!has_value_map_);
- }
- if (has_value_map_) {
- if (!using_blanks_) {
- assert(names_.size() == value_map_.size() &&
- "Since no blanks were specified, each arg is mapped directly into a mapped "
- "value without parsing; sizes must match");
- }
-
- assert(!has_value_list_);
- }
-
- if (!using_blanks_ && !CmdlineType<TArg>::kCanParseBlankless) {
- assert((has_value_map_ || has_value_list_) &&
- "Arguments without a blank (_) must provide either a value map or a value list");
- }
-
- TypedCheck();
+ // Tokenize every name, turning it from a string to a token list.
+ tokenized_names_.clear();
+ for (auto&& name1 : names_) {
+ // Split along ' ' only, removing any duplicated spaces.
+ tokenized_names_.push_back(
+ TokenRange::Split(name1, {' '}).RemoveToken(" "));
}
- // List of aliases for a single argument definition, e.g. {"-Xdex2oat", "-Xnodex2oat"}.
- std::vector<const char*> names_;
- // Is there at least 1 wildcard '_' in the argument definition?
- bool using_blanks_ = false;
- // [min, max] token counts in each arg def
- std::pair<size_t, size_t> token_range_size_;
+ // remove the _ character from each of the token ranges
+ // we will often end up with an empty token (i.e. ["-XX", "_"] -> ["-XX", ""]
+ // and this is OK because we still need an empty token to simplify
+ // range comparisons
+ simple_names_.clear();
- // contains all the names in a tokenized form, i.e. as a space-delimited list
- std::vector<TokenRange> tokenized_names_;
+ for (auto&& tokenized_name : tokenized_names_) {
+ simple_names_.push_back(tokenized_name.RemoveCharacter('_'));
+ }
+ }
- // contains the tokenized names, but with the _ character stripped
- std::vector<TokenRange> simple_names_;
+ if (token_count != 0) {
+ assert(("Every argument descriptor string must have equal amount of tokens (spaces)" &&
+ token_count == names_.size()));
+ }
- // For argument definitions created with '.AppendValues()'
- // Meaning that parsing should mutate the existing value in-place if possible.
- bool appending_values_ = false;
+ if (blank_count != 0) {
+ assert(("Every argument descriptor string must have an equal amount of blanks (_)" &&
+ blank_count == names_.size()));
+ }
- // For argument definitions created with '.WithRange(min, max)'
- bool has_range_ = false;
- TArg min_;
- TArg max_;
+ using_blanks_ = blank_count > 0;
+ {
+ size_t smallest_name_token_range_size =
+ std::accumulate(tokenized_names_.begin(), tokenized_names_.end(), ~(0u),
+ [](size_t min, const TokenRange& cur) {
+ return std::min(min, cur.Size());
+ });
+ size_t largest_name_token_range_size =
+ std::accumulate(tokenized_names_.begin(), tokenized_names_.end(), 0u,
+ [](size_t max, const TokenRange& cur) {
+ return std::max(max, cur.Size());
+ });
- // For argument definitions created with '.WithValueMap'
- bool has_value_map_ = false;
- std::vector<std::pair<const char*, TArg>> value_map_;
+ token_range_size_ = std::make_pair(smallest_name_token_range_size,
+ largest_name_token_range_size);
+ }
- // For argument definitions created with '.WithValues'
- bool has_value_list_ = false;
- std::vector<TArg> value_list_;
-
- // Make sure there's a default constructor.
- CmdlineParserArgumentInfo() = default;
-
- // Ensure there's a default move constructor.
- CmdlineParserArgumentInfo(CmdlineParserArgumentInfo&&) = default;
-
- private:
- // Perform type-specific checks at runtime.
- template <typename T = TArg>
- void TypedCheck(typename std::enable_if<std::is_same<Unit, T>::value>::type* = 0) {
- assert(!using_blanks_ &&
- "Blanks are not supported in Unit arguments; since a Unit has no parse-able value");
+ if (has_value_list_) {
+ assert(names_.size() == value_list_.size()
+ && "Number of arg descriptors must match number of values");
+ assert(!has_value_map_);
+ }
+ if (has_value_map_) {
+ if (!using_blanks_) {
+ assert(names_.size() == value_map_.size() &&
+ "Since no blanks were specified, each arg is mapped directly into a mapped "
+ "value without parsing; sizes must match");
}
- void TypedCheck() {}
+ assert(!has_value_list_);
+ }
- bool is_completed_ = false;
- };
+ if (!using_blanks_ && !CmdlineType<TArg>::kCanParseBlankless) {
+ assert((has_value_map_ || has_value_list_) &&
+ "Arguments without a blank (_) must provide either a value map or a value list");
+ }
- // A virtual-implementation of the necessary argument information in order to
- // be able to parse arguments.
- template <typename TArg>
- struct CmdlineParseArgument : CmdlineParseArgumentAny {
- CmdlineParseArgument(CmdlineParserArgumentInfo<TArg>&& argument_info,
- std::function<void(TArg&)>&& save_argument,
- std::function<TArg&(void)>&& load_argument)
- : argument_info_(std::forward<decltype(argument_info)>(argument_info)),
- save_argument_(std::forward<decltype(save_argument)>(save_argument)),
- load_argument_(std::forward<decltype(load_argument)>(load_argument)) {
- }
+ TypedCheck();
+ }
- using UserTypeInfo = CmdlineType<TArg>;
+ // List of aliases for a single argument definition, e.g. {"-Xdex2oat", "-Xnodex2oat"}.
+ std::vector<const char*> names_;
+ // Is there at least 1 wildcard '_' in the argument definition?
+ bool using_blanks_ = false;
+ // [min, max] token counts in each arg def
+ std::pair<size_t, size_t> token_range_size_;
- virtual CmdlineResult ParseArgument(const TokenRange& arguments, size_t* consumed_tokens) {
- assert(arguments.Size() > 0);
- assert(consumed_tokens != nullptr);
+ // contains all the names in a tokenized form, i.e. as a space-delimited list
+ std::vector<TokenRange> tokenized_names_;
- auto closest_match_res = argument_info_.FindClosestMatch(arguments);
- size_t best_match_size = closest_match_res.second;
- const TokenRange* best_match_arg_def = closest_match_res.first;
+ // contains the tokenized names, but with the _ character stripped
+ std::vector<TokenRange> simple_names_;
- if (best_match_size > arguments.Size()) {
- // The best match has more tokens than were provided.
- // Shouldn't happen in practice since the outer parser does this check.
- return CmdlineResult(CmdlineResult::kUnknown, "Size mismatch");
- }
+ // For argument definitions created with '.AppendValues()'
+ // Meaning that parsing should mutate the existing value in-place if possible.
+ bool appending_values_ = false;
- assert(best_match_arg_def != nullptr);
- *consumed_tokens = best_match_arg_def->Size();
+ // For argument definitions created with '.WithRange(min, max)'
+ bool has_range_ = false;
+ TArg min_;
+ TArg max_;
- if (!argument_info_.using_blanks_) {
- return ParseArgumentSingle(arguments.Join(' '));
- }
+ // For argument definitions created with '.WithValueMap'
+ bool has_value_map_ = false;
+ std::vector<std::pair<const char*, TArg>> value_map_;
- // Extract out the blank value from arguments
- // e.g. for a def of "foo:_" and input "foo:bar", blank_value == "bar"
- std::string blank_value = "";
- size_t idx = 0;
- for (auto&& def_token : *best_match_arg_def) {
- auto&& arg_token = arguments[idx];
+ // For argument definitions created with '.WithValues'
+ bool has_value_list_ = false;
+ std::vector<TArg> value_list_;
- // Does this definition-token have a wildcard in it?
- if (def_token.find('_') == std::string::npos) {
- // No, regular token. Match 1:1 against the argument token.
- bool token_match = def_token == arg_token;
+ // Make sure there's a default constructor.
+ CmdlineParserArgumentInfo() = default;
- if (!token_match) {
- return CmdlineResult(CmdlineResult::kFailure,
- std::string("Failed to parse ") + best_match_arg_def->GetToken(0)
- + " at token " + std::to_string(idx));
- }
- } else {
- // This is a wild-carded token.
- TokenRange def_split_wildcards = TokenRange::Split(def_token, {'_'});
+ // Ensure there's a default move constructor.
+ CmdlineParserArgumentInfo(CmdlineParserArgumentInfo&&) = default;
- // Extract the wildcard contents out of the user-provided arg_token.
- std::unique_ptr<TokenRange> arg_matches =
- def_split_wildcards.MatchSubstrings(arg_token, "_");
- if (arg_matches == nullptr) {
- return CmdlineResult(CmdlineResult::kFailure,
- std::string("Failed to parse ") + best_match_arg_def->GetToken(0)
- + ", with a wildcard pattern " + def_token
- + " at token " + std::to_string(idx));
- }
+ private:
+ // Perform type-specific checks at runtime.
+ template <typename T = TArg>
+ void TypedCheck(typename std::enable_if<std::is_same<Unit, T>::value>::type* = 0) {
+ assert(!using_blanks_ &&
+ "Blanks are not supported in Unit arguments; since a Unit has no parse-able value");
+ }
- // Get the corresponding wildcard tokens from arg_matches,
- // and concatenate it to blank_value.
- for (size_t sub_idx = 0;
- sub_idx < def_split_wildcards.Size() && sub_idx < arg_matches->Size(); ++sub_idx) {
- if (def_split_wildcards[sub_idx] == "_") {
- blank_value += arg_matches->GetToken(sub_idx);
- }
- }
- }
+ void TypedCheck() {}
- ++idx;
- }
+ bool is_completed_ = false;
+};
- return ParseArgumentSingle(blank_value);
- }
+// A virtual-implementation of the necessary argument information in order to
+// be able to parse arguments.
+template <typename TArg>
+struct CmdlineParseArgument : CmdlineParseArgumentAny {
+ CmdlineParseArgument(CmdlineParserArgumentInfo<TArg>&& argument_info,
+ std::function<void(TArg&)>&& save_argument,
+ std::function<TArg&(void)>&& load_argument)
+ : argument_info_(std::forward<decltype(argument_info)>(argument_info)),
+ save_argument_(std::forward<decltype(save_argument)>(save_argument)),
+ load_argument_(std::forward<decltype(load_argument)>(load_argument)) {
+ }
- private:
- virtual CmdlineResult ParseArgumentSingle(const std::string& argument) {
- // TODO: refactor to use LookupValue for the value lists/maps
+ using UserTypeInfo = CmdlineType<TArg>;
- // Handle the 'WithValueMap(...)' argument definition
- if (argument_info_.has_value_map_) {
- for (auto&& value_pair : argument_info_.value_map_) {
- const char* name = value_pair.first;
+ virtual CmdlineResult ParseArgument(const TokenRange& arguments, size_t* consumed_tokens) {
+ assert(arguments.Size() > 0);
+ assert(consumed_tokens != nullptr);
- if (argument == name) {
- return SaveArgument(value_pair.second);
- }
- }
+ auto closest_match_res = argument_info_.FindClosestMatch(arguments);
+ size_t best_match_size = closest_match_res.second;
+ const TokenRange* best_match_arg_def = closest_match_res.first;
- // Error case: Fail, telling the user what the allowed values were.
- std::vector<std::string> allowed_values;
- for (auto&& value_pair : argument_info_.value_map_) {
- const char* name = value_pair.first;
- allowed_values.push_back(name);
- }
+ if (best_match_size > arguments.Size()) {
+ // The best match has more tokens than were provided.
+ // Shouldn't happen in practice since the outer parser does this check.
+ return CmdlineResult(CmdlineResult::kUnknown, "Size mismatch");
+ }
- std::string allowed_values_flat = android::base::Join(allowed_values, ',');
+ assert(best_match_arg_def != nullptr);
+ *consumed_tokens = best_match_arg_def->Size();
+
+ if (!argument_info_.using_blanks_) {
+ return ParseArgumentSingle(arguments.Join(' '));
+ }
+
+ // Extract out the blank value from arguments
+ // e.g. for a def of "foo:_" and input "foo:bar", blank_value == "bar"
+ std::string blank_value = "";
+ size_t idx = 0;
+ for (auto&& def_token : *best_match_arg_def) {
+ auto&& arg_token = arguments[idx];
+
+ // Does this definition-token have a wildcard in it?
+ if (def_token.find('_') == std::string::npos) {
+ // No, regular token. Match 1:1 against the argument token.
+ bool token_match = def_token == arg_token;
+
+ if (!token_match) {
return CmdlineResult(CmdlineResult::kFailure,
- "Argument value '" + argument + "' does not match any of known valid"
- "values: {" + allowed_values_flat + "}");
+ std::string("Failed to parse ") + best_match_arg_def->GetToken(0)
+ + " at token " + std::to_string(idx));
}
+ } else {
+ // This is a wild-carded token.
+ TokenRange def_split_wildcards = TokenRange::Split(def_token, {'_'});
- // Handle the 'WithValues(...)' argument definition
- if (argument_info_.has_value_list_) {
- size_t arg_def_idx = 0;
- for (auto&& value : argument_info_.value_list_) {
- auto&& arg_def_token = argument_info_.names_[arg_def_idx];
-
- if (arg_def_token == argument) {
- return SaveArgument(value);
- }
- ++arg_def_idx;
- }
-
- assert(arg_def_idx + 1 == argument_info_.value_list_.size() &&
- "Number of named argument definitions must match number of values defined");
-
- // Error case: Fail, telling the user what the allowed values were.
- std::vector<std::string> allowed_values;
- for (auto&& arg_name : argument_info_.names_) {
- allowed_values.push_back(arg_name);
- }
-
- std::string allowed_values_flat = android::base::Join(allowed_values, ',');
+ // Extract the wildcard contents out of the user-provided arg_token.
+ std::unique_ptr<TokenRange> arg_matches =
+ def_split_wildcards.MatchSubstrings(arg_token, "_");
+ if (arg_matches == nullptr) {
return CmdlineResult(CmdlineResult::kFailure,
- "Argument value '" + argument + "' does not match any of known valid"
- "values: {" + allowed_values_flat + "}");
+ std::string("Failed to parse ") + best_match_arg_def->GetToken(0)
+ + ", with a wildcard pattern " + def_token
+ + " at token " + std::to_string(idx));
}
- // Handle the regular case where we parsed an unknown value from a blank.
- UserTypeInfo type_parser;
-
- if (argument_info_.appending_values_) {
- TArg& existing = load_argument_();
- CmdlineParseResult<TArg> result = type_parser.ParseAndAppend(argument, existing);
-
- assert(!argument_info_.has_range_);
-
- return result;
- }
-
- CmdlineParseResult<TArg> result = type_parser.Parse(argument);
-
- if (result.IsSuccess()) {
- TArg& value = result.GetValue();
-
- // Do a range check for 'WithRange(min,max)' argument definition.
- if (!argument_info_.CheckRange(value)) {
- return CmdlineParseResult<TArg>::OutOfRange(
- value, argument_info_.min_, argument_info_.max_);
+ // Get the corresponding wildcard tokens from arg_matches,
+ // and concatenate it to blank_value.
+ for (size_t sub_idx = 0;
+ sub_idx < def_split_wildcards.Size() && sub_idx < arg_matches->Size(); ++sub_idx) {
+ if (def_split_wildcards[sub_idx] == "_") {
+ blank_value += arg_matches->GetToken(sub_idx);
}
+ }
+ }
+ ++idx;
+ }
+
+ return ParseArgumentSingle(blank_value);
+ }
+
+ private:
+ virtual CmdlineResult ParseArgumentSingle(const std::string& argument) {
+ // TODO: refactor to use LookupValue for the value lists/maps
+
+ // Handle the 'WithValueMap(...)' argument definition
+ if (argument_info_.has_value_map_) {
+ for (auto&& value_pair : argument_info_.value_map_) {
+ const char* name = value_pair.first;
+
+ if (argument == name) {
+ return SaveArgument(value_pair.second);
+ }
+ }
+
+ // Error case: Fail, telling the user what the allowed values were.
+ std::vector<std::string> allowed_values;
+ for (auto&& value_pair : argument_info_.value_map_) {
+ const char* name = value_pair.first;
+ allowed_values.push_back(name);
+ }
+
+ std::string allowed_values_flat = android::base::Join(allowed_values, ',');
+ return CmdlineResult(CmdlineResult::kFailure,
+ "Argument value '" + argument + "' does not match any of known valid"
+ "values: {" + allowed_values_flat + "}");
+ }
+
+ // Handle the 'WithValues(...)' argument definition
+ if (argument_info_.has_value_list_) {
+ size_t arg_def_idx = 0;
+ for (auto&& value : argument_info_.value_list_) {
+ auto&& arg_def_token = argument_info_.names_[arg_def_idx];
+
+ if (arg_def_token == argument) {
return SaveArgument(value);
}
-
- // Some kind of type-specific parse error. Pass the result as-is.
- CmdlineResult raw_result = std::move(result);
- return raw_result;
+ ++arg_def_idx;
}
- public:
- virtual const char* GetTypeName() const {
- // TODO: Obviate the need for each type specialization to hardcode the type name
- return UserTypeInfo::Name();
+ assert(arg_def_idx + 1 == argument_info_.value_list_.size() &&
+ "Number of named argument definitions must match number of values defined");
+
+ // Error case: Fail, telling the user what the allowed values were.
+ std::vector<std::string> allowed_values;
+ for (auto&& arg_name : argument_info_.names_) {
+ allowed_values.push_back(arg_name);
}
- // How many tokens should be taken off argv for parsing this argument.
- // For example "--help" is just 1, "-compiler-option _" would be 2 (since there's a space).
- //
- // A [min,max] range is returned to represent argument definitions with multiple
- // value tokens. (e.g. {"-h", "-h " } would return [1,2]).
- virtual std::pair<size_t, size_t> GetNumTokens() const {
- return argument_info_.token_range_size_;
+ std::string allowed_values_flat = android::base::Join(allowed_values, ',');
+ return CmdlineResult(CmdlineResult::kFailure,
+ "Argument value '" + argument + "' does not match any of known valid"
+ "values: {" + allowed_values_flat + "}");
+ }
+
+ // Handle the regular case where we parsed an unknown value from a blank.
+ UserTypeInfo type_parser;
+
+ if (argument_info_.appending_values_) {
+ TArg& existing = load_argument_();
+ CmdlineParseResult<TArg> result = type_parser.ParseAndAppend(argument, existing);
+
+ assert(!argument_info_.has_range_);
+
+ return result;
+ }
+
+ CmdlineParseResult<TArg> result = type_parser.Parse(argument);
+
+ if (result.IsSuccess()) {
+ TArg& value = result.GetValue();
+
+ // Do a range check for 'WithRange(min,max)' argument definition.
+ if (!argument_info_.CheckRange(value)) {
+ return CmdlineParseResult<TArg>::OutOfRange(
+ value, argument_info_.min_, argument_info_.max_);
}
- // See if this token range might begin the same as the argument definition.
- virtual size_t MaybeMatches(const TokenRange& tokens) {
- return argument_info_.MaybeMatches(tokens);
- }
+ return SaveArgument(value);
+ }
- private:
- CmdlineResult SaveArgument(const TArg& value) {
- assert(!argument_info_.appending_values_
- && "If the values are being appended, then the updated parse value is "
- "updated by-ref as a side effect and shouldn't be stored directly");
- TArg val = value;
- save_argument_(val);
- return CmdlineResult(CmdlineResult::kSuccess);
- }
+ // Some kind of type-specific parse error. Pass the result as-is.
+ CmdlineResult raw_result = std::move(result);
+ return raw_result;
+ }
- CmdlineParserArgumentInfo<TArg> argument_info_;
- std::function<void(TArg&)> save_argument_;
- std::function<TArg&(void)> load_argument_;
- };
- } // namespace detail // NOLINT [readability/namespace] [5]
+ public:
+ virtual const char* GetTypeName() const {
+ // TODO: Obviate the need for each type specialization to hardcode the type name
+ return UserTypeInfo::Name();
+ }
+
+ // How many tokens should be taken off argv for parsing this argument.
+ // For example "--help" is just 1, "-compiler-option _" would be 2 (since there's a space).
+ //
+ // A [min,max] range is returned to represent argument definitions with multiple
+ // value tokens. (e.g. {"-h", "-h " } would return [1,2]).
+ virtual std::pair<size_t, size_t> GetNumTokens() const {
+ return argument_info_.token_range_size_;
+ }
+
+ // See if this token range might begin the same as the argument definition.
+ virtual size_t MaybeMatches(const TokenRange& tokens) {
+ return argument_info_.MaybeMatches(tokens);
+ }
+
+ private:
+ CmdlineResult SaveArgument(const TArg& value) {
+ assert(!argument_info_.appending_values_
+ && "If the values are being appended, then the updated parse value is "
+ "updated by-ref as a side effect and shouldn't be stored directly");
+ TArg val = value;
+ save_argument_(val);
+ return CmdlineResult(CmdlineResult::kSuccess);
+ }
+
+ CmdlineParserArgumentInfo<TArg> argument_info_;
+ std::function<void(TArg&)> save_argument_;
+ std::function<TArg&(void)> load_argument_;
+};
+} // namespace detail // NOLINT [readability/namespace] [5]
} // namespace art
#endif // ART_CMDLINE_DETAIL_CMDLINE_PARSE_ARGUMENT_DETAIL_H_
diff --git a/cmdline/detail/cmdline_parser_detail.h b/cmdline/detail/cmdline_parser_detail.h
index 118628f..4c26ba3 100644
--- a/cmdline/detail/cmdline_parser_detail.h
+++ b/cmdline/detail/cmdline_parser_detail.h
@@ -22,107 +22,107 @@
#include <vector>
namespace art {
- // Implementation details for some template querying. Don't look inside if you hate templates.
- namespace detail {
- template <typename T>
- typename std::remove_reference<T>::type& FakeReference();
+// Implementation details for some template querying. Don't look inside if you hate templates.
+namespace detail {
+template <typename T>
+typename std::remove_reference<T>::type& FakeReference();
- // SupportsInsertionOperator<T, TStream>::value will evaluate to a boolean,
- // whose value is true if the TStream class supports the << operator against T,
- // and false otherwise.
- template <typename T2, typename TStream2 = std::ostream>
- struct SupportsInsertionOperator {
- private:
- template <typename TStream, typename T>
- static std::true_type InsertionOperatorTest(TStream& os, const T& value,
- std::remove_reference<decltype(os << value)>* = 0); // NOLINT [whitespace/operators] [3]
+// SupportsInsertionOperator<T, TStream>::value will evaluate to a boolean,
+// whose value is true if the TStream class supports the << operator against T,
+// and false otherwise.
+template <typename T2, typename TStream2 = std::ostream>
+struct SupportsInsertionOperator {
+ private:
+ template <typename TStream, typename T>
+ static std::true_type InsertionOperatorTest(TStream& os, const T& value,
+ std::remove_reference<decltype(os << value)>* = 0); // NOLINT [whitespace/operators] [3]
- template <typename TStream, typename ... T>
- static std::false_type InsertionOperatorTest(TStream& os, const T& ... args);
+ template <typename TStream, typename ... T>
+ static std::false_type InsertionOperatorTest(TStream& os, const T& ... args);
- public:
- static constexpr bool value =
- decltype(InsertionOperatorTest(FakeReference<TStream2>(), std::declval<T2>()))::value;
- };
+ public:
+ static constexpr bool value =
+ decltype(InsertionOperatorTest(FakeReference<TStream2>(), std::declval<T2>()))::value;
+};
- template <typename TLeft, typename TRight = TLeft, bool IsFloatingPoint = false>
- struct SupportsEqualityOperatorImpl;
+template <typename TLeft, typename TRight = TLeft, bool IsFloatingPoint = false>
+struct SupportsEqualityOperatorImpl;
- template <typename TLeft, typename TRight>
- struct SupportsEqualityOperatorImpl<TLeft, TRight, false> {
- private:
- template <typename TL, typename TR>
- static std::true_type EqualityOperatorTest(const TL& left, const TR& right,
- std::remove_reference<decltype(left == right)>* = 0); // NOLINT [whitespace/operators] [3]
+template <typename TLeft, typename TRight>
+struct SupportsEqualityOperatorImpl<TLeft, TRight, false> {
+ private:
+ template <typename TL, typename TR>
+ static std::true_type EqualityOperatorTest(const TL& left, const TR& right,
+ std::remove_reference<decltype(left == right)>* = 0); // NOLINT [whitespace/operators] [3]
- template <typename TL, typename ... T>
- static std::false_type EqualityOperatorTest(const TL& left, const T& ... args);
+ template <typename TL, typename ... T>
+ static std::false_type EqualityOperatorTest(const TL& left, const T& ... args);
- public:
- static constexpr bool value =
- decltype(EqualityOperatorTest(std::declval<TLeft>(), std::declval<TRight>()))::value;
- };
+ public:
+ static constexpr bool value =
+ decltype(EqualityOperatorTest(std::declval<TLeft>(), std::declval<TRight>()))::value;
+};
- // Partial specialization when TLeft/TRight are both floating points.
- // This is a work-around because decltype(floatvar1 == floatvar2)
- // will not compile with clang:
- // error: comparing floating point with == or != is unsafe [-Werror,-Wfloat-equal]
- template <typename TLeft, typename TRight>
- struct SupportsEqualityOperatorImpl<TLeft, TRight, true> {
- static constexpr bool value = true;
- };
+// Partial specialization when TLeft/TRight are both floating points.
+// This is a work-around because decltype(floatvar1 == floatvar2)
+// will not compile with clang:
+// error: comparing floating point with == or != is unsafe [-Werror,-Wfloat-equal]
+template <typename TLeft, typename TRight>
+struct SupportsEqualityOperatorImpl<TLeft, TRight, true> {
+ static constexpr bool value = true;
+};
- // SupportsEqualityOperatorImpl<T1, T2>::value will evaluate to a boolean,
- // whose value is true if T1 can be compared against T2 with ==,
- // and false otherwise.
- template <typename TLeft, typename TRight = TLeft>
- struct SupportsEqualityOperator :
- SupportsEqualityOperatorImpl<TLeft, TRight,
- std::is_floating_point<TLeft>::value
- && std::is_floating_point<TRight>::value> {
- };
+// SupportsEqualityOperatorImpl<T1, T2>::value will evaluate to a boolean,
+// whose value is true if T1 can be compared against T2 with ==,
+// and false otherwise.
+template <typename TLeft, typename TRight = TLeft>
+struct SupportsEqualityOperator : // NOLINT [whitespace/labels] [4]
+ SupportsEqualityOperatorImpl<TLeft, TRight,
+ std::is_floating_point<TLeft>::value
+ && std::is_floating_point<TRight>::value> {
+};
- // Convert any kind of type to an std::string, even if there's no
- // serialization support for it. Unknown types get converted to an
- // an arbitrary value.
- //
- // Meant for printing user-visible errors or unit test failures only.
- template <typename T>
- std::string ToStringAny(const T& value,
- typename std::enable_if<
- SupportsInsertionOperator<T>::value>::type* = 0) {
- std::stringstream stream;
- stream << value;
- return stream.str();
+// Convert any kind of type to an std::string, even if there's no
+// serialization support for it. Unknown types get converted to an
+// an arbitrary value.
+//
+// Meant for printing user-visible errors or unit test failures only.
+template <typename T>
+std::string ToStringAny(const T& value,
+ typename std::enable_if<
+ SupportsInsertionOperator<T>::value>::type* = 0) {
+ std::stringstream stream;
+ stream << value;
+ return stream.str();
+}
+
+template <typename T>
+std::string ToStringAny(const std::vector<T> value,
+ typename std::enable_if<
+ SupportsInsertionOperator<T>::value>::type* = 0) {
+ std::stringstream stream;
+ stream << "vector{";
+
+ for (size_t i = 0; i < value.size(); ++i) {
+ stream << ToStringAny(value[i]);
+
+ if (i != value.size() - 1) {
+ stream << ',';
}
+ }
- template <typename T>
- std::string ToStringAny(const std::vector<T> value,
- typename std::enable_if<
- SupportsInsertionOperator<T>::value>::type* = 0) {
- std::stringstream stream;
- stream << "vector{";
+ stream << "}";
+ return stream.str();
+}
- for (size_t i = 0; i < value.size(); ++i) {
- stream << ToStringAny(value[i]);
-
- if (i != value.size() - 1) {
- stream << ',';
- }
- }
-
- stream << "}";
- return stream.str();
- }
-
- template <typename T>
- std::string ToStringAny(const T&,
- typename std::enable_if<
- !SupportsInsertionOperator<T>::value>::type* = 0
- ) {
- return std::string("(unknown type [no operator<< implemented] for )");
- }
- } // namespace detail // NOLINT [readability/namespace] [5]
+template <typename T>
+std::string ToStringAny(const T&,
+ typename std::enable_if<
+ !SupportsInsertionOperator<T>::value>::type* = 0
+) {
+ return std::string("(unknown type [no operator<< implemented] for )");
+}
+} // namespace detail // NOLINT [readability/namespace] [5]
} // namespace art
#endif // ART_CMDLINE_DETAIL_CMDLINE_PARSER_DETAIL_H_
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index 0683577..bcda41a 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -28,7 +28,7 @@
namespace art {
namespace mirror {
- class ClassLoader;
+class ClassLoader;
} // namespace mirror
class CompilerDriver;
diff --git a/compiler/compiler.h b/compiler/compiler.h
index 6c542c8..cfed6d5 100644
--- a/compiler/compiler.h
+++ b/compiler/compiler.h
@@ -24,12 +24,12 @@
namespace art {
namespace jit {
- class JitCodeCache;
- class JitLogger;
+class JitCodeCache;
+class JitLogger;
} // namespace jit
namespace mirror {
- class ClassLoader;
- class DexCache;
+class ClassLoader;
+class DexCache;
} // namespace mirror
class ArtMethod;
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index ab2a681..a71f61a 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -30,7 +30,7 @@
namespace art {
namespace verifier {
- class VerifierDepsTest;
+class VerifierDepsTest;
} // namespace verifier
class DexFile;
diff --git a/compiler/jit/jit_logger.h b/compiler/jit/jit_logger.h
index 19be9aa..8b39888 100644
--- a/compiler/jit/jit_logger.h
+++ b/compiler/jit/jit_logger.h
@@ -86,7 +86,7 @@
// so that jitted code can be displayed in assembly view.
//
class JitLogger {
- public:
+ public:
JitLogger() : code_index_(0), marker_address_(nullptr) {}
void OpenLog() {
@@ -105,7 +105,7 @@
CloseJitDumpLog();
}
- private:
+ private:
// For perf-map profiling
void OpenPerfMapLog();
void WritePerfMapLog(const void* ptr, size_t code_size, ArtMethod* method)
diff --git a/compiler/linker/mips64/relative_patcher_mips64.h b/compiler/linker/mips64/relative_patcher_mips64.h
index 6d7c638..183bbed 100644
--- a/compiler/linker/mips64/relative_patcher_mips64.h
+++ b/compiler/linker/mips64/relative_patcher_mips64.h
@@ -24,7 +24,7 @@
class Mips64RelativePatcher FINAL : public RelativePatcher {
public:
- explicit Mips64RelativePatcher() {}
+ Mips64RelativePatcher() {}
uint32_t ReserveSpace(uint32_t offset,
const CompiledMethod* compiled_method,
diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc
index a8f7e86..9e7455d 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -3891,7 +3891,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
case DataType::Type::kFloat64:
@@ -3921,7 +3921,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
default:
@@ -4102,7 +4102,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
case DataType::Type::kFloat64:
@@ -4146,7 +4146,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
default:
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 9b35160..ad0e71a 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -2545,7 +2545,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
case DataType::Type::kFloat64:
@@ -2862,7 +2862,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
case DataType::Type::kFloat64:
@@ -2912,7 +2912,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
default:
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 8f7961e..d64a497 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -970,7 +970,7 @@
case kCondGT: return kAbove;
case kCondGE: return kAboveEqual;
default: break; // should not happen
- };
+ }
LOG(FATAL) << "Unreachable";
UNREACHABLE();
}
@@ -2635,7 +2635,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
case DataType::Type::kFloat64:
@@ -2948,7 +2948,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
case DataType::Type::kFloat64:
@@ -3000,7 +3000,7 @@
default:
LOG(FATAL) << "Unexpected type conversion from " << input_type
<< " to " << result_type;
- };
+ }
break;
default:
diff --git a/compiler/optimizing/induction_var_analysis.cc b/compiler/optimizing/induction_var_analysis.cc
index 0987293..e2747af 100644
--- a/compiler/optimizing/induction_var_analysis.cc
+++ b/compiler/optimizing/induction_var_analysis.cc
@@ -683,7 +683,7 @@
CreateConstant(0, type_),
c->fetch,
type_);
- };
+ }
break;
case kRem:
// Idiomatic MOD wrap-around induction.
diff --git a/compiler/optimizing/induction_var_analysis_test.cc b/compiler/optimizing/induction_var_analysis_test.cc
index 4c11ad4..f87b46d 100644
--- a/compiler/optimizing/induction_var_analysis_test.cc
+++ b/compiler/optimizing/induction_var_analysis_test.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <regex>
+#include <regex> // NOLINT [build/c++11] [5]
#include "base/arena_allocator.h"
#include "builder.h"
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc
index c672dae..69c5827 100644
--- a/compiler/optimizing/loop_optimization.cc
+++ b/compiler/optimizing/loop_optimization.cc
@@ -765,7 +765,7 @@
vector_static_peeling_factor_ = 0;
vector_dynamic_peeling_candidate_ = nullptr;
vector_runtime_test_a_ =
- vector_runtime_test_b_= nullptr;
+ vector_runtime_test_b_ = nullptr;
// Phis in the loop-body prevent vectorization.
if (!block->GetPhis().IsEmpty()) {
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h
index 9aba912..e90c30d 100644
--- a/compiler/optimizing/optimizing_unit_test.h
+++ b/compiler/optimizing/optimizing_unit_test.h
@@ -161,7 +161,7 @@
// An alias for the empty string used to make it clear that a line is
// removed in a diff.
-static const std::string removed = "";
+static const std::string removed = ""; // NOLINT [runtime/string] [4]
// Naive patch command: apply a diff to a string.
inline std::string Patch(const std::string& original, const diff_t& diff) {
diff --git a/compiler/optimizing/scheduler.h b/compiler/optimizing/scheduler.h
index afdf6f1..a6e1603 100644
--- a/compiler/optimizing/scheduler.h
+++ b/compiler/optimizing/scheduler.h
@@ -392,7 +392,7 @@
*/
class RandomSchedulingNodeSelector : public SchedulingNodeSelector {
public:
- explicit RandomSchedulingNodeSelector() : seed_(0) {
+ RandomSchedulingNodeSelector() : seed_(0) {
seed_ = static_cast<uint32_t>(NanoTime());
srand(seed_);
}
diff --git a/compiler/optimizing/side_effects_analysis.h b/compiler/optimizing/side_effects_analysis.h
index cf00e48..c0f81a9 100644
--- a/compiler/optimizing/side_effects_analysis.h
+++ b/compiler/optimizing/side_effects_analysis.h
@@ -25,7 +25,7 @@
class SideEffectsAnalysis : public HOptimization {
public:
- SideEffectsAnalysis(HGraph* graph, const char* pass_name = kSideEffectsAnalysisPassName)
+ explicit SideEffectsAnalysis(HGraph* graph, const char* pass_name = kSideEffectsAnalysisPassName)
: HOptimization(graph, pass_name),
graph_(graph),
block_effects_(graph->GetBlocks().size(),
diff --git a/compiler/utils/arm/assembler_arm_test.h b/compiler/utils/arm/assembler_arm_test.h
index a85a05e..8c3a11f2 100644
--- a/compiler/utils/arm/assembler_arm_test.h
+++ b/compiler/utils/arm/assembler_arm_test.h
@@ -512,7 +512,7 @@
}
protected:
- explicit AssemblerArmTest() {}
+ AssemblerArmTest() {}
virtual std::vector<Cond>& GetConditions() = 0;
virtual std::string GetConditionString(Cond c) = 0;
diff --git a/compiler/utils/assembler_test.h b/compiler/utils/assembler_test.h
index ad84412..0cb8bbb 100644
--- a/compiler/utils/assembler_test.h
+++ b/compiler/utils/assembler_test.h
@@ -734,7 +734,7 @@
}
protected:
- explicit AssemblerTest() {}
+ AssemblerTest() {}
void SetUp() OVERRIDE {
allocator_.reset(new ArenaAllocator(&pool_));
diff --git a/compiler/utils/assembler_test_base.h b/compiler/utils/assembler_test_base.h
index 2ef43bd..1482210 100644
--- a/compiler/utils/assembler_test_base.h
+++ b/compiler/utils/assembler_test_base.h
@@ -37,7 +37,7 @@
// Use a glocal static variable to keep the same name for all test data. Else we'll just spam the
// temp directory.
-static std::string tmpnam_;
+static std::string tmpnam_; // NOLINT [runtime/string] [4]
// We put this into a class as gtests are self-contained, so this helper needs to be in an h-file.
class AssemblerTestInfrastructure {
diff --git a/compiler/utils/atomic_dex_ref_map.h b/compiler/utils/atomic_dex_ref_map.h
index fad056c..205543f 100644
--- a/compiler/utils/atomic_dex_ref_map.h
+++ b/compiler/utils/atomic_dex_ref_map.h
@@ -29,7 +29,7 @@
template <typename DexFileReferenceType, typename Value>
class AtomicDexRefMap {
public:
- explicit AtomicDexRefMap() {}
+ AtomicDexRefMap() {}
~AtomicDexRefMap() {}
// Atomically swap the element in if the existing value matches expected.
diff --git a/compiler/utils/jni_macro_assembler_test.h b/compiler/utils/jni_macro_assembler_test.h
index 34ab4c3..1aefc84 100644
--- a/compiler/utils/jni_macro_assembler_test.h
+++ b/compiler/utils/jni_macro_assembler_test.h
@@ -55,7 +55,7 @@
}
protected:
- explicit JNIMacroAssemblerTest() {}
+ JNIMacroAssemblerTest() {}
void SetUp() OVERRIDE {
allocator_.reset(new ArenaAllocator(&pool_));
diff --git a/compiler/utils/label.h b/compiler/utils/label.h
index d835c63..b9d4e9c 100644
--- a/compiler/utils/label.h
+++ b/compiler/utils/label.h
@@ -27,23 +27,23 @@
class AssemblerFixup;
namespace arm64 {
- class Arm64Assembler;
+class Arm64Assembler;
} // namespace arm64
namespace mips {
- class MipsAssembler;
- class MipsLabel;
+class MipsAssembler;
+class MipsLabel;
} // namespace mips
namespace mips64 {
- class Mips64Assembler;
- class Mips64Label;
+class Mips64Assembler;
+class Mips64Label;
} // namespace mips64
namespace x86 {
- class X86Assembler;
- class NearLabel;
+class X86Assembler;
+class NearLabel;
} // namespace x86
namespace x86_64 {
- class X86_64Assembler;
- class NearLabel;
+class X86_64Assembler;
+class NearLabel;
} // namespace x86_64
class ExternalLabel {
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index f243e33..4709fd0 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -41,7 +41,7 @@
class VerifierDepsCompilerCallbacks : public CompilerCallbacks {
public:
- explicit VerifierDepsCompilerCallbacks()
+ VerifierDepsCompilerCallbacks()
: CompilerCallbacks(CompilerCallbacks::CallbackMode::kCompileApp),
deps_(nullptr) {}
diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc
index a02fbf8..7086655 100644
--- a/dex2oat/dex2oat_image_test.cc
+++ b/dex2oat/dex2oat_image_test.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <regex>
+#include <regex> // NOLINT [build/c++11] [5]
#include <sstream>
#include <string>
#include <vector>
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index 99be111..a1f825b 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <regex>
+#include <regex> // NOLINT [build/c++11] [5]
#include <sstream>
#include <string>
#include <vector>
diff --git a/dex2oat/linker/image_writer.h b/dex2oat/linker/image_writer.h
index bdea000..68c7b59 100644
--- a/dex2oat/linker/image_writer.h
+++ b/dex2oat/linker/image_writer.h
@@ -249,7 +249,7 @@
// Comparison operator for map support
bool operator<(const BinSlot& other) const { return lockword_ < other.lockword_; }
- private:
+ private:
// Must be the same size as LockWord, any larger and we would truncate the data.
const uint32_t lockword_;
};
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 4ab7dcf..b20fa90 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -965,7 +965,7 @@
os << "Total number of dex code bytes: " << dex_code_bytes_ << "\n";
}
- private:
+ private:
// All of the elements from one container to another.
template <typename Dest, typename Src>
static void AddAll(Dest& dest, const Src& src) {
diff --git a/openjdkjvmti/art_jvmti.h b/openjdkjvmti/art_jvmti.h
index 1263460..97801e0 100644
--- a/openjdkjvmti/art_jvmti.h
+++ b/openjdkjvmti/art_jvmti.h
@@ -135,7 +135,7 @@
template <typename T>
class JvmtiDeleter<T[]> {
- public:
+ public:
JvmtiDeleter() : env_(nullptr) {}
explicit JvmtiDeleter(jvmtiEnv* env) : env_(env) {}
diff --git a/openjdkjvmti/jvmti_allocator.h b/openjdkjvmti/jvmti_allocator.h
index e29e034..e6cbc85 100644
--- a/openjdkjvmti/jvmti_allocator.h
+++ b/openjdkjvmti/jvmti_allocator.h
@@ -55,7 +55,7 @@
};
explicit JvmtiAllocator(jvmtiEnv* env) : env_(env) {}
- explicit JvmtiAllocator() : env_(nullptr) {}
+ JvmtiAllocator() : env_(nullptr) {}
template <typename U>
JvmtiAllocator(const JvmtiAllocator<U>& other) // NOLINT, implicit
@@ -92,7 +92,7 @@
};
explicit JvmtiAllocator(jvmtiEnv* env) : env_(env) {}
- explicit JvmtiAllocator() : env_(nullptr) {}
+ JvmtiAllocator() : env_(nullptr) {}
template <typename U>
JvmtiAllocator(const JvmtiAllocator<U>& other) // NOLINT, implicit
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index e69c78b..2c5e5f9 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -33,7 +33,7 @@
#include "android-base/stringprintf.h"
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <unordered_set>
#include "art_jvmti.h"
diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index 7db0566..b31e9f2 100644
--- a/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
@@ -32,9 +32,9 @@
#include "ti_monitor.h"
#include <atomic>
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
+#include <chrono> // NOLINT [build/c++11] [5]
+#include <condition_variable> // NOLINT [build/c++11] [5]
+#include <mutex> // NOLINT [build/c++11] [5]
#include "art_jvmti.h"
#include "monitor.h"
diff --git a/patchoat/patchoat.h b/patchoat/patchoat.h
index d4c5a10..8351684 100644
--- a/patchoat/patchoat.h
+++ b/patchoat/patchoat.h
@@ -150,7 +150,7 @@
// Walks through the old image and patches the mmap'd copy of it to the new offset. It does not
// change the heap.
class PatchVisitor {
- public:
+ public:
PatchVisitor(PatchOat* patcher, mirror::Object* copy) : patcher_(patcher), copy_(copy) {}
~PatchVisitor() {}
void operator() (ObjPtr<mirror::Object> obj, MemberOffset off, bool b) const
@@ -163,7 +163,7 @@
const {}
void VisitRoot(mirror::CompressedReference<mirror::Object>* root ATTRIBUTE_UNUSED) const {}
- private:
+ private:
PatchOat* const patcher_;
mirror::Object* const copy_;
};
diff --git a/profman/profman.cc b/profman/profman.cc
index 4c4bb87..ae07784 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -157,11 +157,11 @@
static constexpr uint16_t kDefaultTestProfileClassPercentage = 5;
// Separators used when parsing human friendly representation of profiles.
-static const std::string kMethodSep = "->";
-static const std::string kMissingTypesMarker = "missing_types";
-static const std::string kInvalidClassDescriptor = "invalid_class";
-static const std::string kInvalidMethod = "invalid_method";
-static const std::string kClassAllMethods = "*";
+static const std::string kMethodSep = "->"; // NOLINT [runtime/string] [4]
+static const std::string kMissingTypesMarker = "missing_types"; // NOLINT [runtime/string] [4]
+static const std::string kInvalidClassDescriptor = "invalid_class"; // NOLINT [runtime/string] [4]
+static const std::string kInvalidMethod = "invalid_method"; // NOLINT [runtime/string] [4]
+static const std::string kClassAllMethods = "*"; // NOLINT [runtime/string] [4]
static constexpr char kProfileParsingInlineChacheSep = '+';
static constexpr char kProfileParsingTypeSep = ',';
static constexpr char kProfileParsingFirstCharInSignature = '(';
diff --git a/runtime/arch/arm64/entrypoints_init_arm64.cc b/runtime/arch/arm64/entrypoints_init_arm64.cc
index d270bdb..80bf3ab 100644
--- a/runtime/arch/arm64/entrypoints_init_arm64.cc
+++ b/runtime/arch/arm64/entrypoints_init_arm64.cc
@@ -192,6 +192,6 @@
UpdateReadBarrierEntrypoints(qpoints, /*is_active*/ false);
qpoints->pReadBarrierSlow = artReadBarrierSlow;
qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
-};
+}
} // namespace art
diff --git a/runtime/arch/mips/entrypoints_init_mips.cc b/runtime/arch/mips/entrypoints_init_mips.cc
index 75cfc41..dca3382 100644
--- a/runtime/arch/mips/entrypoints_init_mips.cc
+++ b/runtime/arch/mips/entrypoints_init_mips.cc
@@ -467,6 +467,6 @@
qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
static_assert(IsDirectEntrypoint(kQuickReadBarrierForRootSlow),
"Direct C stub not marked direct.");
-};
+}
} // namespace art
diff --git a/runtime/arch/mips64/entrypoints_init_mips64.cc b/runtime/arch/mips64/entrypoints_init_mips64.cc
index 15b3e38..35cbd1d 100644
--- a/runtime/arch/mips64/entrypoints_init_mips64.cc
+++ b/runtime/arch/mips64/entrypoints_init_mips64.cc
@@ -204,6 +204,6 @@
qpoints->pReadBarrierMarkReg28 = nullptr;
qpoints->pReadBarrierSlow = artReadBarrierSlow;
qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
-};
+}
} // namespace art
diff --git a/runtime/arch/x86/entrypoints_init_x86.cc b/runtime/arch/x86/entrypoints_init_x86.cc
index 102faf1..24bf9cc 100644
--- a/runtime/arch/x86/entrypoints_init_x86.cc
+++ b/runtime/arch/x86/entrypoints_init_x86.cc
@@ -124,6 +124,6 @@
qpoints->pReadBarrierMarkReg29 = nullptr;
qpoints->pReadBarrierSlow = art_quick_read_barrier_slow;
qpoints->pReadBarrierForRootSlow = art_quick_read_barrier_for_root_slow;
-};
+}
} // namespace art
diff --git a/runtime/arch/x86_64/entrypoints_init_x86_64.cc b/runtime/arch/x86_64/entrypoints_init_x86_64.cc
index 5f7380f..3656f83 100644
--- a/runtime/arch/x86_64/entrypoints_init_x86_64.cc
+++ b/runtime/arch/x86_64/entrypoints_init_x86_64.cc
@@ -139,6 +139,6 @@
qpoints->pReadBarrierSlow = art_quick_read_barrier_slow;
qpoints->pReadBarrierForRootSlow = art_quick_read_barrier_for_root_slow;
#endif // __APPLE__
-};
+}
} // namespace art
diff --git a/runtime/base/allocator.cc b/runtime/base/allocator.cc
index 2a2790c..bb00638 100644
--- a/runtime/base/allocator.cc
+++ b/runtime/base/allocator.cc
@@ -26,7 +26,7 @@
class MallocAllocator FINAL : public Allocator {
public:
- explicit MallocAllocator() {}
+ MallocAllocator() {}
~MallocAllocator() {}
void* Alloc(size_t size) {
@@ -45,7 +45,7 @@
class NoopAllocator FINAL : public Allocator {
public:
- explicit NoopAllocator() {}
+ NoopAllocator() {}
~NoopAllocator() {}
void* Alloc(size_t size ATTRIBUTE_UNUSED) {
diff --git a/runtime/base/bit_struct_detail.h b/runtime/base/bit_struct_detail.h
index 824d7df..49d432e 100644
--- a/runtime/base/bit_struct_detail.h
+++ b/runtime/base/bit_struct_detail.h
@@ -31,88 +31,88 @@
static constexpr size_t BitStructSizeOf();
namespace detail {
- // Select the smallest uintX_t that will fit kBitSize bits.
- template <size_t kBitSize>
- struct MinimumTypeUnsignedHelper {
- using type =
- typename std::conditional<kBitSize == 0, void,
- typename std::conditional<kBitSize <= 8, uint8_t,
- typename std::conditional<kBitSize <= 16, uint16_t,
- typename std::conditional<kBitSize <= 32, uint32_t,
- typename std::conditional<kBitSize <= 64, uint64_t,
- typename std::conditional<kBitSize <= BitSizeOf<uintmax_t>(), uintmax_t,
- void>::type>::type>::type>::type>::type>::type;
- };
+// Select the smallest uintX_t that will fit kBitSize bits.
+template <size_t kBitSize>
+struct MinimumTypeUnsignedHelper {
+ using type =
+ typename std::conditional<kBitSize == 0, void, // NOLINT [whitespace/operators] [3]
+ typename std::conditional<kBitSize <= 8, uint8_t, // NOLINT [whitespace/operators] [3]
+ typename std::conditional<kBitSize <= 16, uint16_t, // NOLINT [whitespace/operators] [3]
+ typename std::conditional<kBitSize <= 32, uint32_t,
+ typename std::conditional<kBitSize <= 64, uint64_t,
+ typename std::conditional<kBitSize <= BitSizeOf<uintmax_t>(), uintmax_t,
+ void>::type>::type>::type>::type>::type>::type;
+};
- // Select the smallest [u]intX_t that will fit kBitSize bits.
- // Automatically picks intX_t or uintX_t based on the sign-ness of T.
- template <typename T, size_t kBitSize>
- struct MinimumTypeHelper {
- using type_unsigned = typename MinimumTypeUnsignedHelper<kBitSize>::type;
+// Select the smallest [u]intX_t that will fit kBitSize bits.
+// Automatically picks intX_t or uintX_t based on the sign-ness of T.
+template <typename T, size_t kBitSize>
+struct MinimumTypeHelper {
+ using type_unsigned = typename MinimumTypeUnsignedHelper<kBitSize>::type;
- using type =
- typename std::conditional</* if */ std::is_signed<T>::value,
- /* then */ typename std::make_signed<type_unsigned>::type,
- /* else */ type_unsigned>::type;
- };
+ using type =
+ typename std::conditional</* if */ std::is_signed<T>::value,
+ /* then */ typename std::make_signed<type_unsigned>::type,
+ /* else */ type_unsigned>::type;
+};
- // Denotes the beginning of a bit struct.
- //
- // This marker is required by the C++ standard in order to
- // have a "common initial sequence".
- //
- // See C++ 9.5.1 [class.union]:
- // If a standard-layout union contains several standard-layout structs that share a common
- // initial sequence ... it is permitted to inspect the common initial sequence of any of
- // standard-layout struct members.
- template <size_t kSize>
- struct DefineBitStructSize {
- private:
- typename MinimumTypeUnsignedHelper<kSize>::type _;
- };
+// Denotes the beginning of a bit struct.
+//
+// This marker is required by the C++ standard in order to
+// have a "common initial sequence".
+//
+// See C++ 9.5.1 [class.union]:
+// If a standard-layout union contains several standard-layout structs that share a common
+// initial sequence ... it is permitted to inspect the common initial sequence of any of
+// standard-layout struct members.
+template <size_t kSize>
+struct DefineBitStructSize {
+ private:
+ typename MinimumTypeUnsignedHelper<kSize>::type _;
+};
- // Check if type "T" has a member called _ in it.
- template <typename T>
- struct HasUnderscoreField {
- private:
- using TrueT = std::integral_constant<bool, true>::type;
- using FalseT = std::integral_constant<bool, false>::type;
+// Check if type "T" has a member called _ in it.
+template <typename T>
+struct HasUnderscoreField {
+ private:
+ using TrueT = std::integral_constant<bool, true>::type;
+ using FalseT = std::integral_constant<bool, false>::type;
- template <typename C>
- static constexpr auto Test(void*) -> decltype(std::declval<C>()._, TrueT{}); // NOLINT
+ template <typename C>
+ static constexpr auto Test(void*) -> decltype(std::declval<C>()._, TrueT{}); // NOLINT
- template <typename>
- static constexpr FalseT Test(...);
+ template <typename>
+ static constexpr FalseT Test(...);
- public:
- static constexpr bool value = decltype(Test<T>(0))::value;
- };
+ public:
+ static constexpr bool value = decltype(Test<T>(0))::value;
+};
- // Infer the type of the member of &T::M.
- template <typename T, typename M>
- M GetMemberType(M T:: *);
+// Infer the type of the member of &T::M.
+template <typename T, typename M>
+M GetMemberType(M T:: *);
- // Ensure the minimal type storage for 'T' matches its declared BitStructSizeOf.
- // Nominally used by the BITSTRUCT_DEFINE_END macro.
- template <typename T>
- static constexpr bool ValidateBitStructSize() {
- static_assert(std::is_union<T>::value, "T must be union");
- static_assert(std::is_standard_layout<T>::value, "T must be standard-layout");
- static_assert(HasUnderscoreField<T>::value, "T must have the _ DefineBitStructSize");
+// Ensure the minimal type storage for 'T' matches its declared BitStructSizeOf.
+// Nominally used by the BITSTRUCT_DEFINE_END macro.
+template <typename T>
+static constexpr bool ValidateBitStructSize() {
+ static_assert(std::is_union<T>::value, "T must be union");
+ static_assert(std::is_standard_layout<T>::value, "T must be standard-layout");
+ static_assert(HasUnderscoreField<T>::value, "T must have the _ DefineBitStructSize");
- const size_t kBitStructSizeOf = BitStructSizeOf<T>();
- static_assert(std::is_same<decltype(GetMemberType(&T::_)),
- DefineBitStructSize<kBitStructSizeOf>>::value,
- "T::_ must be a DefineBitStructSize of the same size");
+ const size_t kBitStructSizeOf = BitStructSizeOf<T>();
+ static_assert(std::is_same<decltype(GetMemberType(&T::_)),
+ DefineBitStructSize<kBitStructSizeOf>>::value,
+ "T::_ must be a DefineBitStructSize of the same size");
- const size_t kExpectedSize = (BitStructSizeOf<T>() < kBitsPerByte)
- ? kBitsPerByte
- : RoundUpToPowerOfTwo(kBitStructSizeOf);
+ const size_t kExpectedSize = (BitStructSizeOf<T>() < kBitsPerByte)
+ ? kBitsPerByte
+ : RoundUpToPowerOfTwo(kBitStructSizeOf);
- // Ensure no extra fields were added in between START/END.
- const size_t kActualSize = sizeof(T) * kBitsPerByte;
- return kExpectedSize == kActualSize;
- }
+ // Ensure no extra fields were added in between START/END.
+ const size_t kActualSize = sizeof(T) * kBitsPerByte;
+ return kExpectedSize == kActualSize;
+}
} // namespace detail
} // namespace art
diff --git a/runtime/base/hash_set.h b/runtime/base/hash_set.h
index bc25b36..c743342 100644
--- a/runtime/base/hash_set.h
+++ b/runtime/base/hash_set.h
@@ -261,7 +261,7 @@
}
HashSet& operator=(HashSet&& other) noexcept {
- HashSet(std::move(other)).swap(*this);
+ HashSet(std::move(other)).swap(*this); // NOLINT [runtime/explicit] [5]
return *this;
}
diff --git a/runtime/base/hash_set_test.cc b/runtime/base/hash_set_test.cc
index 31b28eb..ff745b4 100644
--- a/runtime/base/hash_set_test.cc
+++ b/runtime/base/hash_set_test.cc
@@ -294,7 +294,7 @@
hash = hash * 2 + *iter;
}
return hash;
-};
+}
struct VectorIntHashEquals {
std::size_t operator()(const std::vector<int>& item) const {
diff --git a/runtime/base/mutex_test.cc b/runtime/base/mutex_test.cc
index 752e77a..7eba50b 100644
--- a/runtime/base/mutex_test.cc
+++ b/runtime/base/mutex_test.cc
@@ -97,7 +97,7 @@
struct RecursiveLockWait {
- explicit RecursiveLockWait()
+ RecursiveLockWait()
: mu("test mutex", kDefaultMutexLevel, true), cv("test condition variable", mu) {
}
diff --git a/runtime/base/variant_map.h b/runtime/base/variant_map.h
index 71a1018..fe332d1 100644
--- a/runtime/base/variant_map.h
+++ b/runtime/base/variant_map.h
@@ -74,62 +74,62 @@
// Implementation details for VariantMap.
namespace detail {
- // Allocate a unique counter value each time it's called.
- struct VariantMapKeyCounterAllocator {
- static size_t AllocateCounter() {
- static size_t counter = 0;
- counter++;
+// Allocate a unique counter value each time it's called.
+struct VariantMapKeyCounterAllocator {
+ static size_t AllocateCounter() {
+ static size_t counter = 0;
+ counter++;
- return counter;
+ return counter;
+ }
+};
+
+// Type-erased version of VariantMapKey<T>
+struct VariantMapKeyRaw {
+ // TODO: this may need to call a virtual function to support string comparisons
+ bool operator<(const VariantMapKeyRaw& other) const {
+ return key_counter_ < other.key_counter_;
+ }
+
+ // The following functions need to be virtual since we don't know the compile-time type anymore:
+
+ // Clone the key, creating a copy of the contents.
+ virtual VariantMapKeyRaw* Clone() const = 0;
+
+ // Delete a value whose runtime type is that of the non-erased key's TValue.
+ virtual void ValueDelete(void* value) const = 0;
+
+ // Clone a value whose runtime type is that of the non-erased key's TValue.
+ virtual void* ValueClone(void* value) const = 0;
+
+ // Compare one key to another (same as operator<).
+ virtual bool Compare(const VariantMapKeyRaw* other) const {
+ if (other == nullptr) {
+ return false;
}
- };
+ return key_counter_ < other->key_counter_;
+ }
- // Type-erased version of VariantMapKey<T>
- struct VariantMapKeyRaw {
- // TODO: this may need to call a virtual function to support string comparisons
- bool operator<(const VariantMapKeyRaw& other) const {
- return key_counter_ < other.key_counter_;
- }
+ virtual ~VariantMapKeyRaw() {}
- // The following functions need to be virtual since we don't know the compile-time type anymore:
+ protected:
+ VariantMapKeyRaw()
+ : key_counter_(VariantMapKeyCounterAllocator::AllocateCounter()) {}
+ // explicit VariantMapKeyRaw(size_t counter)
+ // : key_counter_(counter) {}
- // Clone the key, creating a copy of the contents.
- virtual VariantMapKeyRaw* Clone() const = 0;
+ size_t GetCounter() const {
+ return key_counter_;
+ }
- // Delete a value whose runtime type is that of the non-erased key's TValue.
- virtual void ValueDelete(void* value) const = 0;
+ protected:
+ // Avoid the object slicing problem; use Clone() instead.
+ VariantMapKeyRaw(const VariantMapKeyRaw&) = default;
+ VariantMapKeyRaw(VariantMapKeyRaw&&) = default;
- // Clone a value whose runtime type is that of the non-erased key's TValue.
- virtual void* ValueClone(void* value) const = 0;
-
- // Compare one key to another (same as operator<).
- virtual bool Compare(const VariantMapKeyRaw* other) const {
- if (other == nullptr) {
- return false;
- }
- return key_counter_ < other->key_counter_;
- }
-
- virtual ~VariantMapKeyRaw() {}
-
- protected:
- VariantMapKeyRaw()
- : key_counter_(VariantMapKeyCounterAllocator::AllocateCounter()) {}
- // explicit VariantMapKeyRaw(size_t counter)
- // : key_counter_(counter) {}
-
- size_t GetCounter() const {
- return key_counter_;
- }
-
- protected:
- // Avoid the object slicing problem; use Clone() instead.
- VariantMapKeyRaw(const VariantMapKeyRaw&) = default;
- VariantMapKeyRaw(VariantMapKeyRaw&&) = default;
-
- private:
- size_t key_counter_; // Runtime type ID. Unique each time a new type is reified.
- };
+ private:
+ size_t key_counter_; // Runtime type ID. Unique each time a new type is reified.
+};
} // namespace detail
// The base type for keys used by the VariantMap. Users must subclass this type.
@@ -189,9 +189,9 @@
// Implementation details for a stringified VariantMapStringKey.
namespace detail {
- struct VariantMapStringKeyRegistry {
- // TODO
- };
+struct VariantMapStringKeyRegistry {
+ // TODO
+};
} // namespace detail
// Alternative base type for all keys used by VariantMap, supports runtime strings as the name.
@@ -329,7 +329,7 @@
}
// Construct an empty map.
- explicit VariantMap() {}
+ VariantMap() {}
template <typename ... TKeyValue>
explicit VariantMap(const TKeyValue& ... key_value_list) {
diff --git a/runtime/base/variant_map_test.cc b/runtime/base/variant_map_test.cc
index 93336e0..9dd29ba 100644
--- a/runtime/base/variant_map_test.cc
+++ b/runtime/base/variant_map_test.cc
@@ -23,27 +23,27 @@
namespace art {
namespace {
+template <typename TValue>
+struct FruitMapKey : VariantMapKey<TValue> {
+ FruitMapKey() {}
+};
+
+struct FruitMap : VariantMap<FruitMap, FruitMapKey> {
+ // This 'using' line is necessary to inherit the variadic constructor.
+ using VariantMap<FruitMap, FruitMapKey>::VariantMap;
+
+ // Make the next '4' usages of Key slightly shorter to type.
template <typename TValue>
- struct FruitMapKey : VariantMapKey<TValue> {
- FruitMapKey() {}
- };
+ using Key = FruitMapKey<TValue>;
- struct FruitMap : VariantMap<FruitMap, FruitMapKey> {
- // This 'using' line is necessary to inherit the variadic constructor.
- using VariantMap<FruitMap, FruitMapKey>::VariantMap;
+ static const Key<int> Apple;
+ static const Key<double> Orange;
+ static const Key<std::string> Label;
+};
- // Make the next '4' usages of Key slightly shorter to type.
- template <typename TValue>
- using Key = FruitMapKey<TValue>;
-
- static const Key<int> Apple;
- static const Key<double> Orange;
- static const Key<std::string> Label;
- };
-
- const FruitMap::Key<int> FruitMap::Apple;
- const FruitMap::Key<double> FruitMap::Orange;
- const FruitMap::Key<std::string> FruitMap::Label;
+const FruitMap::Key<int> FruitMap::Apple;
+const FruitMap::Key<double> FruitMap::Orange;
+const FruitMap::Key<std::string> FruitMap::Label;
} // namespace
TEST(VariantMaps, BasicReadWrite) {
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index bd5e184..28caf81 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -284,7 +284,7 @@
uint32_t size; // The gap size of 1, 2, or 4 bytes.
};
struct FieldGapsComparator {
- explicit FieldGapsComparator() {
+ FieldGapsComparator() {
}
bool operator() (const FieldGap& lhs, const FieldGap& rhs)
NO_THREAD_SAFETY_ANALYSIS {
@@ -3898,7 +3898,7 @@
class MoveClassTableToPreZygoteVisitor : public ClassLoaderVisitor {
public:
- explicit MoveClassTableToPreZygoteVisitor() {}
+ MoveClassTableToPreZygoteVisitor() {}
void Visit(ObjPtr<mirror::ClassLoader> class_loader)
REQUIRES(Locks::classlinker_classes_lock_)
@@ -7468,7 +7468,7 @@
}
struct LinkFieldsComparator {
- explicit LinkFieldsComparator() REQUIRES_SHARED(Locks::mutator_lock_) {
+ LinkFieldsComparator() REQUIRES_SHARED(Locks::mutator_lock_) {
}
// No thread safety analysis as will be called from STL. Checked lock held in constructor.
bool operator()(ArtField* field1, ArtField* field2)
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 2d9ec5a..a4c4f3d 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -40,31 +40,31 @@
namespace gc {
namespace space {
- class ImageSpace;
+class ImageSpace;
} // namespace space
} // namespace gc
namespace linker {
- struct CompilationHelper;
- class ImageWriter;
- class OatWriter;
+struct CompilationHelper;
+class ImageWriter;
+class OatWriter;
} // namespace linker
namespace mirror {
- class ClassLoader;
- class DexCache;
- class DexCachePointerArray;
- class DexCacheMethodHandlesTest_Open_Test;
- class DexCacheTest_Open_Test;
- class IfTable;
- class MethodHandle;
- class MethodHandlesLookup;
- class MethodType;
- template<class T> class ObjectArray;
- class StackTraceElement;
- template <typename T> struct NativeDexCachePair;
- using MethodDexCachePair = NativeDexCachePair<ArtMethod>;
- using MethodDexCacheType = std::atomic<MethodDexCachePair>;
+class ClassLoader;
+class DexCache;
+class DexCachePointerArray;
+class DexCacheMethodHandlesTest_Open_Test;
+class DexCacheTest_Open_Test;
+class IfTable;
+class MethodHandle;
+class MethodHandlesLookup;
+class MethodType;
+template<class T> class ObjectArray;
+class StackTraceElement;
+template <typename T> struct NativeDexCachePair;
+using MethodDexCachePair = NativeDexCachePair<ArtMethod>;
+using MethodDexCacheType = std::atomic<MethodDexCachePair>;
} // namespace mirror
class ClassHierarchyAnalysis;
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 1b867c0..892a850 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -564,7 +564,7 @@
addOffset(OFFSETOF_MEMBER(mirror::Object, x_rb_ptr_), "shadow$_x_rb_ptr_");
addOffset(OFFSETOF_MEMBER(mirror::Object, x_xpadding_), "shadow$_x_xpadding_");
#endif
- };
+ }
};
struct ClassOffsets : public CheckOffsets<mirror::Class> {
@@ -599,7 +599,7 @@
addOffset(OFFSETOF_MEMBER(mirror::Class, super_class_), "superClass");
addOffset(OFFSETOF_MEMBER(mirror::Class, virtual_methods_offset_), "virtualMethodsOffset");
addOffset(OFFSETOF_MEMBER(mirror::Class, vtable_), "vtable");
- };
+ }
};
struct ClassExtOffsets : public CheckOffsets<mirror::ClassExt> {
@@ -615,7 +615,7 @@
StringOffsets() : CheckOffsets<mirror::String>(false, "Ljava/lang/String;") {
addOffset(OFFSETOF_MEMBER(mirror::String, count_), "count");
addOffset(OFFSETOF_MEMBER(mirror::String, hash_code_), "hash");
- };
+ }
};
struct ThrowableOffsets : public CheckOffsets<mirror::Throwable> {
@@ -625,7 +625,7 @@
addOffset(OFFSETOF_MEMBER(mirror::Throwable, detail_message_), "detailMessage");
addOffset(OFFSETOF_MEMBER(mirror::Throwable, stack_trace_), "stackTrace");
addOffset(OFFSETOF_MEMBER(mirror::Throwable, suppressed_exceptions_), "suppressedExceptions");
- };
+ }
};
struct StackTraceElementOffsets : public CheckOffsets<mirror::StackTraceElement> {
@@ -635,7 +635,7 @@
addOffset(OFFSETOF_MEMBER(mirror::StackTraceElement, file_name_), "fileName");
addOffset(OFFSETOF_MEMBER(mirror::StackTraceElement, line_number_), "lineNumber");
addOffset(OFFSETOF_MEMBER(mirror::StackTraceElement, method_name_), "methodName");
- };
+ }
};
struct ClassLoaderOffsets : public CheckOffsets<mirror::ClassLoader> {
@@ -645,13 +645,13 @@
addOffset(OFFSETOF_MEMBER(mirror::ClassLoader, packages_), "packages");
addOffset(OFFSETOF_MEMBER(mirror::ClassLoader, parent_), "parent");
addOffset(OFFSETOF_MEMBER(mirror::ClassLoader, proxyCache_), "proxyCache");
- };
+ }
};
struct ProxyOffsets : public CheckOffsets<mirror::Proxy> {
ProxyOffsets() : CheckOffsets<mirror::Proxy>(false, "Ljava/lang/reflect/Proxy;") {
addOffset(OFFSETOF_MEMBER(mirror::Proxy, h_), "h");
- };
+ }
};
struct DexCacheOffsets : public CheckOffsets<mirror::DexCache> {
@@ -670,7 +670,7 @@
addOffset(OFFSETOF_MEMBER(mirror::DexCache, resolved_methods_), "resolvedMethods");
addOffset(OFFSETOF_MEMBER(mirror::DexCache, resolved_types_), "resolvedTypes");
addOffset(OFFSETOF_MEMBER(mirror::DexCache, strings_), "strings");
- };
+ }
};
struct ReferenceOffsets : public CheckOffsets<mirror::Reference> {
@@ -679,7 +679,7 @@
addOffset(OFFSETOF_MEMBER(mirror::Reference, queue_), "queue");
addOffset(OFFSETOF_MEMBER(mirror::Reference, queue_next_), "queueNext");
addOffset(OFFSETOF_MEMBER(mirror::Reference, referent_), "referent");
- };
+ }
};
struct FinalizerReferenceOffsets : public CheckOffsets<mirror::FinalizerReference> {
@@ -688,14 +688,14 @@
addOffset(OFFSETOF_MEMBER(mirror::FinalizerReference, next_), "next");
addOffset(OFFSETOF_MEMBER(mirror::FinalizerReference, prev_), "prev");
addOffset(OFFSETOF_MEMBER(mirror::FinalizerReference, zombie_), "zombie");
- };
+ }
};
struct AccessibleObjectOffsets : public CheckOffsets<mirror::AccessibleObject> {
AccessibleObjectOffsets() : CheckOffsets<mirror::AccessibleObject>(
false, "Ljava/lang/reflect/AccessibleObject;") {
addOffset(mirror::AccessibleObject::FlagOffset().Uint32Value(), "override");
- };
+ }
};
struct FieldOffsets : public CheckOffsets<mirror::Field> {
@@ -705,7 +705,7 @@
addOffset(OFFSETOF_MEMBER(mirror::Field, dex_field_index_), "dexFieldIndex");
addOffset(OFFSETOF_MEMBER(mirror::Field, offset_), "offset");
addOffset(OFFSETOF_MEMBER(mirror::Field, type_), "type");
- };
+ }
};
struct ExecutableOffsets : public CheckOffsets<mirror::Executable> {
@@ -720,7 +720,7 @@
addOffset(OFFSETOF_MEMBER(mirror::Executable, has_real_parameter_data_),
"hasRealParameterData");
addOffset(OFFSETOF_MEMBER(mirror::Executable, parameters_), "parameters");
- };
+ }
};
struct MethodTypeOffsets : public CheckOffsets<mirror::MethodType> {
diff --git a/runtime/class_table.h b/runtime/class_table.h
index 744c010..48129b1 100644
--- a/runtime/class_table.h
+++ b/runtime/class_table.h
@@ -41,9 +41,9 @@
} // namespace linker
namespace mirror {
- class Class;
- class ClassLoader;
- class Object;
+class Class;
+class ClassLoader;
+class Object;
} // namespace mirror
// Each loader has a ClassTable
diff --git a/runtime/common_throws.h b/runtime/common_throws.h
index 2fc2016..3512b2b 100644
--- a/runtime/common_throws.h
+++ b/runtime/common_throws.h
@@ -22,9 +22,9 @@
namespace art {
namespace mirror {
- class Class;
- class Object;
- class MethodType;
+class Class;
+class Object;
+class MethodType;
} // namespace mirror
class ArtField;
class ArtMethod;
diff --git a/runtime/dex_file_annotations.h b/runtime/dex_file_annotations.h
index e108882..9dc400d 100644
--- a/runtime/dex_file_annotations.h
+++ b/runtime/dex_file_annotations.h
@@ -24,8 +24,8 @@
namespace art {
namespace mirror {
- class ClassLoader;
- class DexCache;
+class ClassLoader;
+class DexCache;
} // namespace mirror
class ArtField;
class ArtMethod;
diff --git a/runtime/entrypoints/entrypoint_utils.h b/runtime/entrypoints/entrypoint_utils.h
index d2c98e1..cda70ea 100644
--- a/runtime/entrypoints/entrypoint_utils.h
+++ b/runtime/entrypoints/entrypoint_utils.h
@@ -32,10 +32,10 @@
namespace art {
namespace mirror {
- class Array;
- class Class;
- class Object;
- class String;
+class Array;
+class Class;
+class Object;
+class String;
} // namespace mirror
class ArtField;
diff --git a/runtime/entrypoints/quick/quick_default_init_entrypoints.h b/runtime/entrypoints/quick/quick_default_init_entrypoints.h
index 267f384..8acaa90 100644
--- a/runtime/entrypoints/quick/quick_default_init_entrypoints.h
+++ b/runtime/entrypoints/quick/quick_default_init_entrypoints.h
@@ -118,7 +118,7 @@
// Deoptimize
qpoints->pDeoptimize = art_quick_deoptimize_from_compiled_code;
-};
+}
} // namespace art
diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h
index 17acc76..766c976 100644
--- a/runtime/gc/accounting/card_table.h
+++ b/runtime/gc/accounting/card_table.h
@@ -27,13 +27,13 @@
class MemMap;
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
namespace gc {
namespace space {
- class ContinuousSpace;
+class ContinuousSpace;
} // namespace space
class Heap;
diff --git a/runtime/gc/accounting/card_table_test.cc b/runtime/gc/accounting/card_table_test.cc
index 67ab14c..cb2479f 100644
--- a/runtime/gc/accounting/card_table_test.cc
+++ b/runtime/gc/accounting/card_table_test.cc
@@ -30,7 +30,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
namespace gc {
diff --git a/runtime/gc/accounting/heap_bitmap.h b/runtime/gc/accounting/heap_bitmap.h
index 36426e9..4237e7e 100644
--- a/runtime/gc/accounting/heap_bitmap.h
+++ b/runtime/gc/accounting/heap_bitmap.h
@@ -27,7 +27,7 @@
class Heap;
namespace collector {
- class ConcurrentCopying;
+class ConcurrentCopying;
} // namespace collector
namespace accounting {
diff --git a/runtime/gc/accounting/mod_union_table.h b/runtime/gc/accounting/mod_union_table.h
index ee25eae..4b5d5f3 100644
--- a/runtime/gc/accounting/mod_union_table.h
+++ b/runtime/gc/accounting/mod_union_table.h
@@ -37,7 +37,7 @@
namespace gc {
namespace space {
- class ContinuousSpace;
+class ContinuousSpace;
} // namespace space
class Heap;
diff --git a/runtime/gc/accounting/remembered_set.h b/runtime/gc/accounting/remembered_set.h
index c332f96..90d4ffb 100644
--- a/runtime/gc/accounting/remembered_set.h
+++ b/runtime/gc/accounting/remembered_set.h
@@ -28,11 +28,11 @@
namespace gc {
namespace collector {
- class GarbageCollector;
- class MarkSweep;
+class GarbageCollector;
+class MarkSweep;
} // namespace collector
namespace space {
- class ContinuousSpace;
+class ContinuousSpace;
} // namespace space
class Heap;
diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h
index b49e0b7..2f33bac 100644
--- a/runtime/gc/accounting/space_bitmap.h
+++ b/runtime/gc/accounting/space_bitmap.h
@@ -29,8 +29,8 @@
namespace art {
namespace mirror {
- class Class;
- class Object;
+class Class;
+class Object;
} // namespace mirror
class MemMap;
diff --git a/runtime/gc/allocation_listener.h b/runtime/gc/allocation_listener.h
index 0be9aec..7675a22 100644
--- a/runtime/gc/allocation_listener.h
+++ b/runtime/gc/allocation_listener.h
@@ -28,7 +28,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
class Thread;
diff --git a/runtime/gc/allocation_record.h b/runtime/gc/allocation_record.h
index fcd08c1..d1311df 100644
--- a/runtime/gc/allocation_record.h
+++ b/runtime/gc/allocation_record.h
@@ -31,8 +31,8 @@
class Thread;
namespace mirror {
- class Class;
- class Object;
+class Class;
+class Object;
} // namespace mirror
namespace gc {
diff --git a/runtime/gc/collector/concurrent_copying.h b/runtime/gc/collector/concurrent_copying.h
index cc7072d..8b4b58e 100644
--- a/runtime/gc/collector/concurrent_copying.h
+++ b/runtime/gc/collector/concurrent_copying.h
@@ -39,16 +39,16 @@
namespace gc {
namespace accounting {
- template<typename T> class AtomicStack;
- typedef AtomicStack<mirror::Object> ObjectStack;
- template <size_t kAlignment> class SpaceBitmap;
- typedef SpaceBitmap<kObjectAlignment> ContinuousSpaceBitmap;
- class HeapBitmap;
- class ReadBarrierTable;
+template<typename T> class AtomicStack;
+typedef AtomicStack<mirror::Object> ObjectStack;
+template <size_t kAlignment> class SpaceBitmap;
+typedef SpaceBitmap<kObjectAlignment> ContinuousSpaceBitmap;
+class HeapBitmap;
+class ReadBarrierTable;
} // namespace accounting
namespace space {
- class RegionSpace;
+class RegionSpace;
} // namespace space
namespace collector {
diff --git a/runtime/gc/collector/immune_spaces_test.cc b/runtime/gc/collector/immune_spaces_test.cc
index 9823708..9767807 100644
--- a/runtime/gc/collector/immune_spaces_test.cc
+++ b/runtime/gc/collector/immune_spaces_test.cc
@@ -209,7 +209,7 @@
ImmuneSpaces spaces;
constexpr size_t kImageSize = 123 * kPageSize;
constexpr size_t kImageOatSize = 321 * kPageSize;
- constexpr size_t kOtherSpaceSize= 100 * kPageSize;
+ constexpr size_t kOtherSpaceSize = 100 * kPageSize;
uint8_t* memory = GetContinuousMemoryRegion(kImageSize + kImageOatSize + kOtherSpaceSize);
diff --git a/runtime/gc/collector/mark_compact.h b/runtime/gc/collector/mark_compact.h
index 7d64a0c..4122809 100644
--- a/runtime/gc/collector/mark_compact.h
+++ b/runtime/gc/collector/mark_compact.h
@@ -35,8 +35,8 @@
class Thread;
namespace mirror {
- class Class;
- class Object;
+class Class;
+class Object;
} // namespace mirror
namespace gc {
@@ -44,14 +44,14 @@
class Heap;
namespace accounting {
- template <typename T> class AtomicStack;
- typedef AtomicStack<mirror::Object> ObjectStack;
+template <typename T> class AtomicStack;
+typedef AtomicStack<mirror::Object> ObjectStack;
} // namespace accounting
namespace space {
- class BumpPointerSpace;
- class ContinuousMemMapAllocSpace;
- class ContinuousSpace;
+class BumpPointerSpace;
+class ContinuousMemMapAllocSpace;
+class ContinuousSpace;
} // namespace space
namespace collector {
diff --git a/runtime/gc/collector/semi_space.h b/runtime/gc/collector/semi_space.h
index 6d4d789..fc77c17 100644
--- a/runtime/gc/collector/semi_space.h
+++ b/runtime/gc/collector/semi_space.h
@@ -34,8 +34,8 @@
class Thread;
namespace mirror {
- class Class;
- class Object;
+class Class;
+class Object;
} // namespace mirror
namespace gc {
@@ -43,13 +43,13 @@
class Heap;
namespace accounting {
- template <typename T> class AtomicStack;
- typedef AtomicStack<mirror::Object> ObjectStack;
+template <typename T> class AtomicStack;
+typedef AtomicStack<mirror::Object> ObjectStack;
} // namespace accounting
namespace space {
- class ContinuousMemMapAllocSpace;
- class ContinuousSpace;
+class ContinuousMemMapAllocSpace;
+class ContinuousSpace;
} // namespace space
namespace collector {
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 7b4fab6..4d7424c 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -55,8 +55,8 @@
class VariableSizedHandleScope;
namespace mirror {
- class Class;
- class Object;
+class Class;
+class Object;
} // namespace mirror
namespace gc {
@@ -69,40 +69,40 @@
class Verification;
namespace accounting {
- template <typename T> class AtomicStack;
- typedef AtomicStack<mirror::Object> ObjectStack;
- class CardTable;
- class HeapBitmap;
- class ModUnionTable;
- class ReadBarrierTable;
- class RememberedSet;
+template <typename T> class AtomicStack;
+typedef AtomicStack<mirror::Object> ObjectStack;
+class CardTable;
+class HeapBitmap;
+class ModUnionTable;
+class ReadBarrierTable;
+class RememberedSet;
} // namespace accounting
namespace collector {
- class ConcurrentCopying;
- class GarbageCollector;
- class MarkCompact;
- class MarkSweep;
- class SemiSpace;
+class ConcurrentCopying;
+class GarbageCollector;
+class MarkCompact;
+class MarkSweep;
+class SemiSpace;
} // namespace collector
namespace allocator {
- class RosAlloc;
+class RosAlloc;
} // namespace allocator
namespace space {
- class AllocSpace;
- class BumpPointerSpace;
- class ContinuousMemMapAllocSpace;
- class DiscontinuousSpace;
- class DlMallocSpace;
- class ImageSpace;
- class LargeObjectSpace;
- class MallocSpace;
- class RegionSpace;
- class RosAllocSpace;
- class Space;
- class ZygoteSpace;
+class AllocSpace;
+class BumpPointerSpace;
+class ContinuousMemMapAllocSpace;
+class DiscontinuousSpace;
+class DlMallocSpace;
+class ImageSpace;
+class LargeObjectSpace;
+class MallocSpace;
+class RegionSpace;
+class RosAllocSpace;
+class Space;
+class ZygoteSpace;
} // namespace space
enum HomogeneousSpaceCompactResult {
diff --git a/runtime/gc/reference_processor.h b/runtime/gc/reference_processor.h
index a8135d9..1d984eb 100644
--- a/runtime/gc/reference_processor.h
+++ b/runtime/gc/reference_processor.h
@@ -45,7 +45,7 @@
// Used to process java.lang.ref.Reference instances concurrently or paused.
class ReferenceProcessor {
public:
- explicit ReferenceProcessor();
+ ReferenceProcessor();
void ProcessReferences(bool concurrent,
TimingLogger* timings,
bool clear_soft_references,
diff --git a/runtime/gc/space/bump_pointer_space.h b/runtime/gc/space/bump_pointer_space.h
index 4197d0c..7b43362 100644
--- a/runtime/gc/space/bump_pointer_space.h
+++ b/runtime/gc/space/bump_pointer_space.h
@@ -28,7 +28,7 @@
namespace gc {
namespace collector {
- class MarkSweep;
+class MarkSweep;
} // namespace collector
namespace space {
diff --git a/runtime/gc/space/dlmalloc_space.h b/runtime/gc/space/dlmalloc_space.h
index 8fb2d76..4c7fcfd 100644
--- a/runtime/gc/space/dlmalloc_space.h
+++ b/runtime/gc/space/dlmalloc_space.h
@@ -24,7 +24,7 @@
namespace gc {
namespace collector {
- class MarkSweep;
+class MarkSweep;
} // namespace collector
namespace space {
diff --git a/runtime/gc/space/malloc_space.h b/runtime/gc/space/malloc_space.h
index a41ef43..c1f4841 100644
--- a/runtime/gc/space/malloc_space.h
+++ b/runtime/gc/space/malloc_space.h
@@ -26,7 +26,7 @@
namespace gc {
namespace collector {
- class MarkSweep;
+class MarkSweep;
} // namespace collector
namespace space {
diff --git a/runtime/gc/space/rosalloc_space.h b/runtime/gc/space/rosalloc_space.h
index f9c7dbc..9d16b87 100644
--- a/runtime/gc/space/rosalloc_space.h
+++ b/runtime/gc/space/rosalloc_space.h
@@ -25,7 +25,7 @@
namespace gc {
namespace collector {
- class MarkSweep;
+class MarkSweep;
} // namespace collector
namespace space {
diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h
index 2a4f830..6b76048 100644
--- a/runtime/gc/space/space.h
+++ b/runtime/gc/space/space.h
@@ -30,7 +30,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
namespace gc {
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index 7976a1a..6a1a8c7 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -1088,7 +1088,7 @@
class RootCollector {
public:
- explicit RootCollector() {}
+ RootCollector() {}
void operator()(mirror::Object*, MemberOffset, bool) const {}
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index 5bac931..da63152 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -30,9 +30,9 @@
namespace art {
namespace mirror {
- class Class;
- class Object;
- class Throwable;
+class Class;
+class Object;
+class Throwable;
} // namespace mirror
class ArtField;
class ArtMethod;
diff --git a/runtime/interpreter/lock_count_data.h b/runtime/interpreter/lock_count_data.h
index 64874a5..3098d4f 100644
--- a/runtime/interpreter/lock_count_data.h
+++ b/runtime/interpreter/lock_count_data.h
@@ -25,7 +25,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
class Thread;
diff --git a/runtime/interpreter/shadow_frame.h b/runtime/interpreter/shadow_frame.h
index 88275cc..be2c943 100644
--- a/runtime/interpreter/shadow_frame.h
+++ b/runtime/interpreter/shadow_frame.h
@@ -32,7 +32,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
class ArtMethod;
diff --git a/runtime/java_vm_ext.h b/runtime/java_vm_ext.h
index 0510d6a..7c2755f 100644
--- a/runtime/java_vm_ext.h
+++ b/runtime/java_vm_ext.h
@@ -28,7 +28,7 @@
namespace art {
namespace mirror {
- class Array;
+class Array;
} // namespace mirror
class ArtMethod;
diff --git a/runtime/jdwp/jdwp.h b/runtime/jdwp/jdwp.h
index 86af6d4..aeeda1e 100644
--- a/runtime/jdwp/jdwp.h
+++ b/runtime/jdwp/jdwp.h
@@ -40,9 +40,9 @@
class Thread;
namespace mirror {
- class Class;
- class Object;
- class Throwable;
+class Class;
+class Object;
+class Throwable;
} // namespace mirror
class Thread;
diff --git a/runtime/jdwp/object_registry.h b/runtime/jdwp/object_registry.h
index 8754631..26869b6 100644
--- a/runtime/jdwp/object_registry.h
+++ b/runtime/jdwp/object_registry.h
@@ -31,8 +31,8 @@
namespace art {
namespace mirror {
- class Object;
- class Class;
+class Object;
+class Class;
} // namespace mirror
struct ObjectRegistryEntry {
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 72b5a94..953e195 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -52,7 +52,7 @@
static constexpr size_t kJitSlowStressDefaultCompileThreshold = 2; // Slow-debug build.
// JIT compiler
-void* Jit::jit_library_handle_= nullptr;
+void* Jit::jit_library_handle_ = nullptr;
void* Jit::jit_compiler_handle_ = nullptr;
void* (*Jit::jit_load_)(bool*) = nullptr;
void (*Jit::jit_unload_)(void*) = nullptr;
diff --git a/runtime/lock_word.h b/runtime/lock_word.h
index 14f638e..b9aa0b7 100644
--- a/runtime/lock_word.h
+++ b/runtime/lock_word.h
@@ -26,7 +26,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
class Monitor;
diff --git a/runtime/mem_map.h b/runtime/mem_map.h
index 5603963..36a2416 100644
--- a/runtime/mem_map.h
+++ b/runtime/mem_map.h
@@ -21,7 +21,7 @@
#include <sys/types.h>
#include <map>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <string>
#include "android-base/thread_annotations.h"
diff --git a/runtime/method_handles.h b/runtime/method_handles.h
index 8641918..930b8db 100644
--- a/runtime/method_handles.h
+++ b/runtime/method_handles.h
@@ -28,8 +28,8 @@
namespace art {
namespace mirror {
- class MethodHandle;
- class MethodType;
+class MethodHandle;
+class MethodType;
} // namespace mirror
// Returns true if there is a possible conversion from |from| to |to|
diff --git a/runtime/monitor.h b/runtime/monitor.h
index d7aef34..b4c0e6f 100644
--- a/runtime/monitor.h
+++ b/runtime/monitor.h
@@ -45,7 +45,7 @@
typedef uint32_t MonitorId;
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
enum class LockReason {
diff --git a/runtime/monitor_pool.cc b/runtime/monitor_pool.cc
index 9d221cc..d00f979 100644
--- a/runtime/monitor_pool.cc
+++ b/runtime/monitor_pool.cc
@@ -24,7 +24,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
MonitorPool::MonitorPool()
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index d64986e..4429ade 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -1771,7 +1771,7 @@
std::string OatFile::GetClassLoaderContext() const {
return GetOatHeader().GetStoreValueByKey(OatHeader::kClassPathKey);
-};
+}
OatFile::OatClass OatFile::FindOatClass(const DexFile& dex_file,
uint16_t class_def_idx,
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 97b2aec..378ce2c 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -696,7 +696,7 @@
void DisableUnlinkAtDestruction() {
unlink_file_at_destruction_ = false;
- };
+ }
private:
std::unique_ptr<File> file_;
diff --git a/runtime/oat_file_assistant_test.cc b/runtime/oat_file_assistant_test.cc
index bd500eb..65d01a4 100644
--- a/runtime/oat_file_assistant_test.cc
+++ b/runtime/oat_file_assistant_test.cc
@@ -40,7 +40,7 @@
namespace art {
-static const std::string kSpecialSharedLibrary = "&";
+static const std::string kSpecialSharedLibrary = "&"; // NOLINT [runtime/string] [4]
static ClassLoaderContext* kSpecialSharedLibraryContext = nullptr;
class OatFileAssistantTest : public DexoptTest {};
diff --git a/runtime/object_callbacks.h b/runtime/object_callbacks.h
index 9eccb5a..d36913b 100644
--- a/runtime/object_callbacks.h
+++ b/runtime/object_callbacks.h
@@ -21,8 +21,8 @@
namespace art {
namespace mirror {
- class Object;
- template<class MirrorType> class HeapReference;
+class Object;
+template<class MirrorType> class HeapReference;
} // namespace mirror
class IsMarkedVisitor {
diff --git a/runtime/read_barrier.h b/runtime/read_barrier.h
index 00674b2..d4b9f43 100644
--- a/runtime/read_barrier.h
+++ b/runtime/read_barrier.h
@@ -28,8 +28,8 @@
namespace art {
namespace mirror {
- class Object;
- template<typename MirrorType> class HeapReference;
+class Object;
+template<typename MirrorType> class HeapReference;
} // namespace mirror
class ArtMethod;
diff --git a/runtime/reference_table_test.cc b/runtime/reference_table_test.cc
index 1e7fc3e..720a9d6 100644
--- a/runtime/reference_table_test.cc
+++ b/runtime/reference_table_test.cc
@@ -16,7 +16,7 @@
#include "reference_table.h"
-#include <regex>
+#include <regex> // NOLINT [build/c++11] [5]
#include "android-base/stringprintf.h"
diff --git a/runtime/reflection.h b/runtime/reflection.h
index f2652fd..2da2917 100644
--- a/runtime/reflection.h
+++ b/runtime/reflection.h
@@ -24,8 +24,8 @@
namespace art {
namespace mirror {
- class Class;
- class Object;
+class Class;
+class Object;
} // namespace mirror
class ArtField;
class ArtMethod;
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 9f79a01..6b01cc2 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -44,31 +44,31 @@
namespace art {
namespace gc {
- class AbstractSystemWeakHolder;
- class Heap;
+class AbstractSystemWeakHolder;
+class Heap;
} // namespace gc
namespace jit {
- class Jit;
- class JitOptions;
+class Jit;
+class JitOptions;
} // namespace jit
namespace mirror {
- class Array;
- class ClassLoader;
- class DexCache;
- template<class T> class ObjectArray;
- template<class T> class PrimitiveArray;
- typedef PrimitiveArray<int8_t> ByteArray;
- class String;
- class Throwable;
+class Array;
+class ClassLoader;
+class DexCache;
+template<class T> class ObjectArray;
+template<class T> class PrimitiveArray;
+typedef PrimitiveArray<int8_t> ByteArray;
+class String;
+class Throwable;
} // namespace mirror
namespace ti {
- class Agent;
+class Agent;
} // namespace ti
namespace verifier {
- class MethodVerifier;
- enum class VerifyMode : int8_t;
+class MethodVerifier;
+enum class VerifyMode : int8_t;
} // namespace verifier
class ArenaPool;
class ArtMethod;
diff --git a/runtime/runtime_callbacks_test.cc b/runtime/runtime_callbacks_test.cc
index 0b69851..d283c79 100644
--- a/runtime/runtime_callbacks_test.cc
+++ b/runtime/runtime_callbacks_test.cc
@@ -22,7 +22,7 @@
#include <initializer_list>
#include <memory>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <string>
#include "jni.h"
diff --git a/runtime/runtime_options.h b/runtime/runtime_options.h
index 89a1dcb..3f5e776 100644
--- a/runtime/runtime_options.h
+++ b/runtime/runtime_options.h
@@ -43,37 +43,37 @@
#define DECLARE_KEY(Type, Name) static const Key<Type> Name
- // Define a key that is usable with a RuntimeArgumentMap.
- // This key will *not* work with other subtypes of VariantMap.
+// Define a key that is usable with a RuntimeArgumentMap.
+// This key will *not* work with other subtypes of VariantMap.
+template <typename TValue>
+struct RuntimeArgumentMapKey : VariantMapKey<TValue> {
+ RuntimeArgumentMapKey() {}
+ explicit RuntimeArgumentMapKey(TValue default_value)
+ : VariantMapKey<TValue>(std::move(default_value)) {}
+ // Don't ODR-use constexpr default values, which means that Struct::Fields
+ // that are declared 'static constexpr T Name = Value' don't need to have a matching definition.
+};
+
+// Defines a type-safe heterogeneous key->value map.
+// Use the VariantMap interface to look up or to store a RuntimeArgumentMapKey,Value pair.
+//
+// Example:
+// auto map = RuntimeArgumentMap();
+// map.Set(RuntimeArgumentMap::HeapTargetUtilization, 5.0);
+// double *target_utilization = map.Get(RuntimeArgumentMap);
+//
+struct RuntimeArgumentMap : VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey> {
+ // This 'using' line is necessary to inherit the variadic constructor.
+ using VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey>::VariantMap;
+
+ // Make the next many usages of Key slightly shorter to type.
template <typename TValue>
- struct RuntimeArgumentMapKey : VariantMapKey<TValue> {
- RuntimeArgumentMapKey() {}
- explicit RuntimeArgumentMapKey(TValue default_value)
- : VariantMapKey<TValue>(std::move(default_value)) {}
- // Don't ODR-use constexpr default values, which means that Struct::Fields
- // that are declared 'static constexpr T Name = Value' don't need to have a matching definition.
- };
+ using Key = RuntimeArgumentMapKey<TValue>;
- // Defines a type-safe heterogeneous key->value map.
- // Use the VariantMap interface to look up or to store a RuntimeArgumentMapKey,Value pair.
- //
- // Example:
- // auto map = RuntimeArgumentMap();
- // map.Set(RuntimeArgumentMap::HeapTargetUtilization, 5.0);
- // double *target_utilization = map.Get(RuntimeArgumentMap);
- //
- struct RuntimeArgumentMap : VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey> {
- // This 'using' line is necessary to inherit the variadic constructor.
- using VariantMap<RuntimeArgumentMap, RuntimeArgumentMapKey>::VariantMap;
-
- // Make the next many usages of Key slightly shorter to type.
- template <typename TValue>
- using Key = RuntimeArgumentMapKey<TValue>;
-
- // List of key declarations, shorthand for 'static const Key<T> Name'
+ // List of key declarations, shorthand for 'static const Key<T> Name'
#define RUNTIME_OPTIONS_KEY(Type, Name, ...) static const Key<Type> (Name);
#include "runtime_options.def"
- };
+};
#undef DECLARE_KEY
diff --git a/runtime/stack.h b/runtime/stack.h
index 4ef9487..bd6204f 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -27,7 +27,7 @@
namespace art {
namespace mirror {
- class Object;
+class Object;
} // namespace mirror
class ArtMethod;
diff --git a/runtime/subtype_check_test.cc b/runtime/subtype_check_test.cc
index 4673274..dd51c18 100644
--- a/runtime/subtype_check_test.cc
+++ b/runtime/subtype_check_test.cc
@@ -29,7 +29,7 @@
using namespace art; // NOLINT
struct MockClass {
- MockClass(MockClass* parent, size_t x = 0, size_t y = 0) {
+ explicit MockClass(MockClass* parent, size_t x = 0, size_t y = 0) {
parent_ = parent;
memset(&subtype_check_info_and_status_, 0u, sizeof(subtype_check_info_and_status_));
@@ -274,7 +274,7 @@
SC::Dump(tree.klass_, os);
os << ", class: " << tree.klass_->PrettyClass() << ")";
return os;
- };
+ }
// Additional convenience functions.
SubtypeCheckInfo::State GetState() const
@@ -826,7 +826,7 @@
}
}
return IsTooWide(kls->GetParent());
-};
+}
// Either itself is too deep, or any of the parents were too deep.
bool IsTooDeep(MockClass* kls) {
@@ -839,7 +839,7 @@
}
}
return false;
-};
+}
TEST_F(SubtypeCheckTest, EnsureInitialized_TooWide) {
auto transitions = [](MockClass* kls) {
diff --git a/runtime/thread.h b/runtime/thread.h
index 3b917ba..39be66d 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -51,29 +51,29 @@
namespace gc {
namespace accounting {
- template<class T> class AtomicStack;
+template<class T> class AtomicStack;
} // namespace accounting
namespace collector {
- class SemiSpace;
+class SemiSpace;
} // namespace collector
} // namespace gc
namespace mirror {
- class Array;
- class Class;
- class ClassLoader;
- class Object;
- template<class T> class ObjectArray;
- template<class T> class PrimitiveArray;
- typedef PrimitiveArray<int32_t> IntArray;
- class StackTraceElement;
- class String;
- class Throwable;
+class Array;
+class Class;
+class ClassLoader;
+class Object;
+template<class T> class ObjectArray;
+template<class T> class PrimitiveArray;
+typedef PrimitiveArray<int32_t> IntArray;
+class StackTraceElement;
+class String;
+class Throwable;
} // namespace mirror
namespace verifier {
- class MethodVerifier;
- class VerifierDeps;
+class MethodVerifier;
+class VerifierDeps;
} // namespace verifier
class ArtMethod;
diff --git a/runtime/thread_list.h b/runtime/thread_list.h
index 11f272c..7657fa8 100644
--- a/runtime/thread_list.h
+++ b/runtime/thread_list.h
@@ -31,10 +31,10 @@
namespace art {
namespace gc {
- namespace collector {
- class GarbageCollector;
- } // namespace collector
- class GcPauseListener;
+namespace collector {
+class GarbageCollector;
+} // namespace collector
+class GcPauseListener;
} // namespace gc
class Closure;
class RootVisitor;
diff --git a/runtime/ti/agent.cc b/runtime/ti/agent.cc
index 20e297c..3bf169a 100644
--- a/runtime/ti/agent.cc
+++ b/runtime/ti/agent.cc
@@ -100,7 +100,7 @@
if (onattach_ == nullptr) {
VLOG(agents) << "Unable to find 'Agent_OnAttach' symbol in " << this;
}
- onunload_= reinterpret_cast<AgentOnUnloadFunction>(FindSymbol(AGENT_ON_UNLOAD_FUNCTION_NAME));
+ onunload_ = reinterpret_cast<AgentOnUnloadFunction>(FindSymbol(AGENT_ON_UNLOAD_FUNCTION_NAME));
if (onunload_ == nullptr) {
VLOG(agents) << "Unable to find 'Agent_OnUnload' symbol in " << this;
}
diff --git a/runtime/type_reference.h b/runtime/type_reference.h
index 5ddc9d0..70bdc32 100644
--- a/runtime/type_reference.h
+++ b/runtime/type_reference.h
@@ -30,7 +30,7 @@
// A type is located by its DexFile and the string_ids_ table index into that DexFile.
class TypeReference : public DexFileReference {
public:
- TypeReference(const DexFile* file = nullptr, dex::TypeIndex index = dex::TypeIndex())
+ explicit TypeReference(const DexFile* file = nullptr, dex::TypeIndex index = dex::TypeIndex())
: DexFileReference(file, index.index_) {}
dex::TypeIndex TypeIndex() const {
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 0f6244e..121f3cf 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -1071,7 +1071,7 @@
for (uint32_t idx = 0; idx < handlers_size; idx++) {
CatchHandlerIterator iterator(handlers_ptr);
for (; iterator.HasNext(); iterator.Next()) {
- uint32_t dex_pc= iterator.GetHandlerAddress();
+ uint32_t dex_pc = iterator.GetHandlerAddress();
if (!GetInstructionFlags(dex_pc).IsOpcode()) {
Fail(VERIFY_ERROR_BAD_CLASS_HARD)
<< "exception handler starts at bad address (" << dex_pc << ")";
diff --git a/runtime/verifier/reg_type_cache.h b/runtime/verifier/reg_type_cache.h
index cb16b15..d090756 100644
--- a/runtime/verifier/reg_type_cache.h
+++ b/runtime/verifier/reg_type_cache.h
@@ -28,8 +28,8 @@
namespace art {
namespace mirror {
- class Class;
- class ClassLoader;
+class Class;
+class ClassLoader;
} // namespace mirror
class ScopedArenaAllocator;
class StringPiece;
diff --git a/runtime/verify_object.h b/runtime/verify_object.h
index e4c01d0..5c665b3 100644
--- a/runtime/verify_object.h
+++ b/runtime/verify_object.h
@@ -25,8 +25,8 @@
namespace art {
namespace mirror {
- class Class;
- class Object;
+class Class;
+class Object;
} // namespace mirror
// How we want to sanity check the heap's correctness.
diff --git a/sigchainlib/sigchain.cc b/sigchainlib/sigchain.cc
index b8ab51b..6800d02 100644
--- a/sigchainlib/sigchain.cc
+++ b/sigchainlib/sigchain.cc
@@ -30,7 +30,7 @@
#include <string.h>
#include <initializer_list>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <utility>
#include "sigchain.h"
diff --git a/test/1919-vminit-thread-start-timing/vminit.cc b/test/1919-vminit-thread-start-timing/vminit.cc
index 109c61f..c492e8b 100644
--- a/test/1919-vminit-thread-start-timing/vminit.cc
+++ b/test/1919-vminit-thread-start-timing/vminit.cc
@@ -16,8 +16,8 @@
#include "1919-vminit-thread-start-timing/vminit.h"
-#include <mutex>
-#include <thread>
+#include <mutex> // NOLINT [build/c++11] [5]
+#include <thread> // NOLINT [build/c++11] [5]
#include <vector>
#include <jni.h>
diff --git a/test/901-hello-ti-agent/basics.cc b/test/901-hello-ti-agent/basics.cc
index 472f2b7..11b32e4 100644
--- a/test/901-hello-ti-agent/basics.cc
+++ b/test/901-hello-ti-agent/basics.cc
@@ -16,7 +16,7 @@
#include "901-hello-ti-agent/basics.h"
-#include <thread>
+#include <thread> // NOLINT [build/c++11] [5]
#include <jni.h>
#include <stdio.h>
diff --git a/test/904-object-allocation/tracking.cc b/test/904-object-allocation/tracking.cc
index 9d2592a..81d1b2c 100644
--- a/test/904-object-allocation/tracking.cc
+++ b/test/904-object-allocation/tracking.cc
@@ -18,7 +18,7 @@
#include <cstdio>
#include <iostream>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <vector>
#include "android-base/logging.h"
diff --git a/test/912-classes/classes.cc b/test/912-classes/classes.cc
index 9727057..a847472 100644
--- a/test/912-classes/classes.cc
+++ b/test/912-classes/classes.cc
@@ -16,8 +16,8 @@
#include <stdio.h>
-#include <condition_variable>
-#include <mutex>
+#include <condition_variable> // NOLINT [build/c++11] [5]
+#include <mutex> // NOLINT [build/c++11] [5]
#include <vector>
#include "android-base/macros.h"
@@ -362,7 +362,7 @@
static std::string thread_name_filter_;
};
-std::string ClassLoadPreparePrinter::thread_name_filter_;
+std::string ClassLoadPreparePrinter::thread_name_filter_; // NOLINT [runtime/string] [4]
extern "C" JNIEXPORT void JNICALL Java_art_Test912_enableClassLoadPreparePrintEvents(
JNIEnv* env, jclass Main_klass ATTRIBUTE_UNUSED, jboolean enable, jthread thread) {
diff --git a/test/912-classes/classes_art.cc b/test/912-classes/classes_art.cc
index de2e456..92a3ba0 100644
--- a/test/912-classes/classes_art.cc
+++ b/test/912-classes/classes_art.cc
@@ -16,7 +16,7 @@
#include <stdio.h>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <vector>
#include "android-base/macros.h"
diff --git a/test/924-threads/threads.cc b/test/924-threads/threads.cc
index 8caff76..8330179 100644
--- a/test/924-threads/threads.cc
+++ b/test/924-threads/threads.cc
@@ -16,7 +16,7 @@
#include <stdio.h>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <string>
#include <vector>
diff --git a/test/986-native-method-bind/native_bind.cc b/test/986-native-method-bind/native_bind.cc
index 1afe4db..34e1f35 100644
--- a/test/986-native-method-bind/native_bind.cc
+++ b/test/986-native-method-bind/native_bind.cc
@@ -115,10 +115,10 @@
extern "C" JNIEXPORT void JNICALL Java_art_Test986_rebindTransformClass(
JNIEnv* env, jclass klass ATTRIBUTE_UNUSED, jclass k) {
JNINativeMethod m[2];
- m[0].name= "sayHi";
+ m[0].name = "sayHi";
m[0].signature = "()V";
m[0].fnPtr = reinterpret_cast<void*>(Java_art_Test986_00024Transform_sayHi__);
- m[1].name= "sayHi2";
+ m[1].name = "sayHi2";
m[1].signature = "()V";
m[1].fnPtr = reinterpret_cast<void*>(Java_art_Test986_00024Transform_sayHi2);
env->RegisterNatives(k, m, 2);
diff --git a/test/ti-agent/scoped_primitive_array.h b/test/ti-agent/scoped_primitive_array.h
index 1649ed9..5b6c07a 100644
--- a/test/ti-agent/scoped_primitive_array.h
+++ b/test/ti-agent/scoped_primitive_array.h
@@ -43,7 +43,7 @@
// access and should be used by default.
#define INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(PRIMITIVE_TYPE, NAME) \
class Scoped ## NAME ## ArrayRO { \
- public: \
+ public: \
explicit Scoped ## NAME ## ArrayRO(JNIEnv* env) \
: mEnv(env), mJavaArray(nullptr), mRawArray(nullptr), mSize(0) {} \
Scoped ## NAME ## ArrayRO(JNIEnv* env, PRIMITIVE_TYPE ## Array javaArray) \
@@ -76,7 +76,7 @@
PRIMITIVE_TYPE ## Array getJavaArray() const { return mJavaArray; } \
const PRIMITIVE_TYPE& operator[](size_t n) const { return mRawArray[n]; } \
size_t size() const { return mSize; } \
- private: \
+ private: \
static constexpr jsize kBufferSize = 1024; \
JNIEnv* const mEnv; \
PRIMITIVE_TYPE ## Array mJavaArray; \
@@ -103,7 +103,7 @@
// since they entail a copy back onto the Java heap, and should only be used when necessary.
#define INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(PRIMITIVE_TYPE, NAME) \
class Scoped ## NAME ## ArrayRW { \
- public: \
+ public: \
explicit Scoped ## NAME ## ArrayRW(JNIEnv* env) \
: mEnv(env), mJavaArray(nullptr), mRawArray(nullptr) {} \
Scoped ## NAME ## ArrayRW(JNIEnv* env, PRIMITIVE_TYPE ## Array javaArray) \
@@ -129,7 +129,7 @@
POINTER_TYPE(PRIMITIVE_TYPE) get() { return mRawArray; } \
REFERENCE_TYPE(PRIMITIVE_TYPE) operator[](size_t n) { return mRawArray[n]; } \
size_t size() const { return mEnv->GetArrayLength(mJavaArray); } \
- private: \
+ private: \
JNIEnv* const mEnv; \
PRIMITIVE_TYPE ## Array mJavaArray; \
POINTER_TYPE(PRIMITIVE_TYPE) mRawArray; \
diff --git a/tools/titrace/instruction_decoder.cc b/tools/titrace/instruction_decoder.cc
index 5d2f22f..bc4660b 100644
--- a/tools/titrace/instruction_decoder.cc
+++ b/tools/titrace/instruction_decoder.cc
@@ -23,11 +23,11 @@
class ClassInstructionDecoder : public InstructionDecoder {
public:
- virtual size_t GetMaximumOpcode() override {
+ size_t GetMaximumOpcode() override {
return 0xff;
}
- virtual const char* GetName(size_t opcode) override {
+ const char* GetName(size_t opcode) override {
Bytecode::Opcode op = static_cast<Bytecode::Opcode>(opcode);
return Bytecode::ToString(op);
}
@@ -465,11 +465,11 @@
class DexInstructionDecoder : public InstructionDecoder {
public:
- virtual size_t GetMaximumOpcode() override {
+ size_t GetMaximumOpcode() override {
return 0xff;
}
- virtual const char* GetName(size_t opcode) override {
+ const char* GetName(size_t opcode) override {
Bytecode::Opcode op = static_cast<Bytecode::Opcode>(opcode);
return Bytecode::ToString(op);
}
diff --git a/tools/titrace/titrace.cc b/tools/titrace/titrace.cc
index bf1218b..e812280 100644
--- a/tools/titrace/titrace.cc
+++ b/tools/titrace/titrace.cc
@@ -21,7 +21,7 @@
#include <jvmti.h>
#include <map>
#include <memory>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
// We could probably return a JNI_ERR here but lets crash instead if something fails.
#define CHECK_JVMTI_ERROR(jvmti, errnum) \
diff --git a/tools/wrapagentproperties/wrapagentproperties.cc b/tools/wrapagentproperties/wrapagentproperties.cc
index 67d5279..9eaffbb 100644
--- a/tools/wrapagentproperties/wrapagentproperties.cc
+++ b/tools/wrapagentproperties/wrapagentproperties.cc
@@ -24,7 +24,7 @@
#include <unordered_map>
#include <unordered_set>
#include <memory>
-#include <mutex>
+#include <mutex> // NOLINT [build/c++11] [5]
#include <sstream>
#include <string>
#include <vector>
@@ -34,7 +34,7 @@
using PropMap = std::unordered_map<std::string, std::string>;
static constexpr const char* kOnLoad = "Agent_OnLoad";
static constexpr const char* kOnAttach = "Agent_OnAttach";
-static constexpr const char* kOnUnload= "Agent_OnUnload";
+static constexpr const char* kOnUnload = "Agent_OnUnload";
struct ProxyJavaVM;
using AgentLoadFunction = jint (*)(ProxyJavaVM*, const char*, void*);
using AgentUnloadFunction = jint (*)(JavaVM*);