mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 08:31:04 +01:00
clang-tidy pass on executable_semantics (#963)
This commit is contained in:
@@ -81,7 +81,7 @@ namespace llvm {
|
||||
template <typename To>
|
||||
struct cast_convert_val<To, const Carbon::AstNode*, const Carbon::AstNode*> {
|
||||
using ResultType = typename cast_retty<To, const Carbon::AstNode*>::ret_type;
|
||||
static ResultType doit(const Carbon::AstNode* node) {
|
||||
static auto doit(const Carbon::AstNode* node) -> ResultType {
|
||||
return dynamic_cast<ResultType>(node);
|
||||
}
|
||||
};
|
||||
@@ -89,7 +89,7 @@ struct cast_convert_val<To, const Carbon::AstNode*, const Carbon::AstNode*> {
|
||||
template <typename To>
|
||||
struct cast_convert_val<To, Carbon::AstNode*, Carbon::AstNode*> {
|
||||
using ResultType = typename cast_retty<To, Carbon::AstNode*>::ret_type;
|
||||
static ResultType doit(Carbon::AstNode* node) {
|
||||
static auto doit(Carbon::AstNode* node) -> ResultType {
|
||||
return dynamic_cast<ResultType>(node);
|
||||
}
|
||||
};
|
||||
@@ -97,7 +97,7 @@ struct cast_convert_val<To, Carbon::AstNode*, Carbon::AstNode*> {
|
||||
template <typename To>
|
||||
struct cast_convert_val<To, const Carbon::AstNode, const Carbon::AstNode> {
|
||||
using ResultType = typename cast_retty<To, const Carbon::AstNode>::ret_type;
|
||||
static ResultType doit(const Carbon::AstNode& node) {
|
||||
static auto doit(const Carbon::AstNode& node) -> ResultType {
|
||||
return dynamic_cast<ResultType>(node);
|
||||
}
|
||||
};
|
||||
@@ -105,7 +105,7 @@ struct cast_convert_val<To, const Carbon::AstNode, const Carbon::AstNode> {
|
||||
template <typename To>
|
||||
struct cast_convert_val<To, Carbon::AstNode, Carbon::AstNode> {
|
||||
using ResultType = typename cast_retty<To, Carbon::AstNode>::ret_type;
|
||||
static ResultType doit(Carbon::AstNode& node) {
|
||||
static auto doit(Carbon::AstNode& node) -> ResultType {
|
||||
return dynamic_cast<ResultType>(node);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
namespace Carbon {
|
||||
namespace TestingInternal {
|
||||
namespace Carbon::TestingInternal {
|
||||
|
||||
AstNodeMatcherBase::~AstNodeMatcherBase() = default;
|
||||
|
||||
@@ -210,5 +209,4 @@ void MatchesUnimplementedExpressionMatcher::DescribeToImpl(std::ostream* out,
|
||||
children_matcher_.DescribeTo(out);
|
||||
}
|
||||
|
||||
} // namespace TestingInternal
|
||||
} // namespace Carbon
|
||||
} // namespace Carbon::TestingInternal
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
#include "executable_semantics/ast/statement.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
|
||||
namespace Carbon {
|
||||
namespace TestingInternal {
|
||||
namespace Carbon::TestingInternal {
|
||||
|
||||
// Abstract GoogleMock matcher which matches AstNodes, and is agnostic to
|
||||
// whether they are passed by pointer or reference. Derived classes specify what
|
||||
@@ -28,6 +27,7 @@ namespace TestingInternal {
|
||||
// MatchAndExplainImpl.
|
||||
class AstNodeMatcherBase {
|
||||
public:
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
using is_gtest_matcher = void;
|
||||
|
||||
virtual ~AstNodeMatcherBase();
|
||||
@@ -202,6 +202,7 @@ class MatchesUnimplementedExpressionMatcher : public AstNodeMatcherBase {
|
||||
// Matches an `AST`.
|
||||
class ASTDeclarationsMatcher {
|
||||
public:
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
using is_gtest_matcher = void;
|
||||
|
||||
// Constructs a matcher which matches an `AST` whose `declarations` member
|
||||
@@ -231,7 +232,6 @@ class ASTDeclarationsMatcher {
|
||||
::testing::Matcher<std::vector<Nonnull<Declaration*>>> declarations_matcher_;
|
||||
};
|
||||
|
||||
} // namespace TestingInternal
|
||||
} // namespace Carbon
|
||||
} // namespace Carbon::TestingInternal
|
||||
|
||||
#endif // EXECUTABLE_SEMANTICS_AST_AST_TEST_MATCHERS_INTERNAL_H_
|
||||
|
||||
@@ -107,7 +107,7 @@ struct GenericBinding : public virtual AstNode, public NamedEntity {
|
||||
class ReturnTerm {
|
||||
public:
|
||||
ReturnTerm(const ReturnTerm&) = default;
|
||||
ReturnTerm& operator=(const ReturnTerm&) = default;
|
||||
auto operator=(const ReturnTerm&) -> ReturnTerm& = default;
|
||||
|
||||
// Represents an omitted return term at `source_loc`.
|
||||
static auto Omitted(SourceLocation source_loc) -> ReturnTerm {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#ifndef EXECUTABLE_SEMANTICS_AST_STATEMENT_H_
|
||||
#define EXECUTABLE_SEMANTICS_AST_STATEMENT_H_
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "common/ostream.h"
|
||||
@@ -45,7 +46,8 @@ class Statement : public virtual AstNode {
|
||||
class Block : public Statement {
|
||||
public:
|
||||
Block(SourceLocation source_loc, std::vector<Nonnull<Statement*>> statements)
|
||||
: AstNode(AstNodeKind::Block, source_loc), statements_(statements) {}
|
||||
: AstNode(AstNodeKind::Block, source_loc),
|
||||
statements_(std::move(statements)) {}
|
||||
|
||||
static auto classof(const AstNode* node) -> bool {
|
||||
return InheritsFromBlock(node->kind());
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Carbon {
|
||||
|
||||
class NamedEntity : public virtual AstNode {
|
||||
public:
|
||||
virtual ~NamedEntity() = 0;
|
||||
~NamedEntity() override = 0;
|
||||
|
||||
NamedEntity() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user