mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Move all new's to global_arena, and remove ASAN disabling (#690)
Note this changes identifiers from char* to string to avoid malloc. Fixes #580
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "executable_semantics/ast/pattern.h"
|
||||
|
||||
#include "executable_semantics/ast/expression.h"
|
||||
#include "executable_semantics/common/arena.h"
|
||||
#include "executable_semantics/syntax/paren_contents.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
@@ -51,7 +52,7 @@ TEST(PatternTest, UnaryNoCommaAsPattern) {
|
||||
// ```
|
||||
ParenContents<Pattern> contents = {
|
||||
.elements = {{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/2)}},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/2)}},
|
||||
.has_trailing_comma = false};
|
||||
|
||||
const Pattern* pattern = PatternFromParenContents(/*line_num=*/1, contents);
|
||||
@@ -62,7 +63,7 @@ TEST(PatternTest, UnaryNoCommaAsPattern) {
|
||||
TEST(PatternTest, UnaryNoCommaAsTuplePattern) {
|
||||
ParenContents<Pattern> contents = {
|
||||
.elements = {{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/2)}},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/2)}},
|
||||
.has_trailing_comma = false};
|
||||
|
||||
const TuplePattern* tuple =
|
||||
@@ -74,7 +75,7 @@ TEST(PatternTest, UnaryNoCommaAsTuplePattern) {
|
||||
TEST(PatternTest, UnaryWithCommaAsPattern) {
|
||||
ParenContents<Pattern> contents = {
|
||||
.elements = {{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/2)}},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/2)}},
|
||||
.has_trailing_comma = true};
|
||||
|
||||
const Pattern* pattern = PatternFromParenContents(/*line_num=*/1, contents);
|
||||
@@ -87,7 +88,7 @@ TEST(PatternTest, UnaryWithCommaAsPattern) {
|
||||
TEST(PatternTest, UnaryWithCommaAsTuplePattern) {
|
||||
ParenContents<Pattern> contents = {
|
||||
.elements = {{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/2)}},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/2)}},
|
||||
.has_trailing_comma = true};
|
||||
|
||||
const TuplePattern* tuple =
|
||||
@@ -99,9 +100,9 @@ TEST(PatternTest, UnaryWithCommaAsTuplePattern) {
|
||||
TEST(PatternTest, BinaryAsPattern) {
|
||||
ParenContents<Pattern> contents = {
|
||||
.elements = {{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/2)},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/2)},
|
||||
{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/3)}},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/3)}},
|
||||
.has_trailing_comma = true};
|
||||
|
||||
const Pattern* pattern = PatternFromParenContents(/*line_num=*/1, contents);
|
||||
@@ -114,9 +115,9 @@ TEST(PatternTest, BinaryAsPattern) {
|
||||
TEST(PatternTest, BinaryAsTuplePattern) {
|
||||
ParenContents<Pattern> contents = {
|
||||
.elements = {{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/2)},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/2)},
|
||||
{.name = std::nullopt,
|
||||
.term = new AutoPattern(/*line_num=*/3)}},
|
||||
.term = global_arena->New<AutoPattern>(/*line_num=*/3)}},
|
||||
.has_trailing_comma = true};
|
||||
|
||||
const TuplePattern* tuple =
|
||||
|
||||
Reference in New Issue
Block a user