Skip to content

Commit b416ef7

Browse files
Merge pull request #58 from google/cpp-sync
Export of internal changes
2 parents d88a482 + 3506ace commit b416ef7

23 files changed

+262
-123
lines changed

WORKSPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ antlr_dependencies(472)
126126

127127
http_archive(
128128
name = "antlr4_runtimes",
129-
sha256 = "4d0714f441333a63e50031c9e8e4890c78f3d21e053d46416949803e122a6574",
130-
strip_prefix = "antlr4-4.7.1",
131-
urls = ["https://github.com/antlr/antlr4/archive/4.7.1.tar.gz"],
129+
sha256 = "46f5e1af5f4bd28ade55cb632f9a069656b31fc8c2408f9aa045f9b5f5caad64",
130+
strip_prefix = "antlr4-4.7.2",
131+
urls = ["https://github.com/antlr/antlr4/archive/4.7.2.tar.gz"],
132132
build_file_content = """
133133
package(default_visibility = ["//visibility:public"])
134134
cc_library(

bazel/antlr.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ def antlr_cc_library(name, src, listener = False, visitor = True):
4242
toolchains = [":" + generated],
4343
# ANTLR runtime does not build with dynamic linking
4444
linkstatic = True,
45+
alwayslink = 1,
4546
)

eval/compiler/flat_expr_builder_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ TEST(FlatExprBuilderTest, DelayedFunctionResolutionErrors) {
143143

144144
ASSERT_THAT(warnings, testing::SizeIs(1));
145145
EXPECT_EQ(warnings[0].code(), absl::StatusCode::kInvalidArgument);
146-
EXPECT_THAT(warnings[0].message(),
146+
EXPECT_THAT(std::string(warnings[0].message()),
147147
testing::HasSubstr("No overloads provided"));
148148
}
149149

eval/eval/BUILD

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -672,31 +672,3 @@ cc_test(
672672
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
673673
],
674674
)
675-
676-
cc_library(
677-
name = "set_util",
678-
srcs = ["set_util.cc"],
679-
hdrs = ["set_util.h"],
680-
copts = ["-std=c++14"],
681-
deps = ["//eval/public:cel_value"],
682-
)
683-
684-
cc_test(
685-
name = "set_util_test",
686-
size = "small",
687-
srcs = [
688-
"set_util_test.cc",
689-
],
690-
copts = ["-std=c++14"],
691-
deps = [
692-
":container_backed_list_impl",
693-
":container_backed_map_impl",
694-
":set_util",
695-
"//eval/public:cel_value",
696-
"//eval/public:unknown_set",
697-
"@com_github_google_googletest//:gtest_main",
698-
"@com_google_absl//absl/status",
699-
"@com_google_absl//absl/time",
700-
"@com_google_protobuf//:protobuf",
701-
],
702-
)

eval/eval/function_step.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool ShouldAcceptOverload(const CelFunction* function,
4747
if (function == nullptr) {
4848
return false;
4949
}
50-
for (int i = 0; i < arguments.size(); i++) {
50+
for (size_t i = 0; i < arguments.size(); i++) {
5151
if (arguments[i].IsUnknownSet() || arguments[i].IsError()) {
5252
return IsNonStrict(function->descriptor().name());
5353
}
@@ -65,7 +65,7 @@ std::vector<CelValue> CheckForPartialUnknowns(
6565
absl::Span<const AttributeTrail> attrs) {
6666
std::vector<CelValue> result;
6767
result.reserve(args.size());
68-
for (int i = 0; i < args.size(); i++) {
68+
for (size_t i = 0; i < args.size(); i++) {
6969
auto attr_set = frame->unknowns_utility().CheckForUnknowns(
7070
attrs.subspan(i, 1), /*use_partial=*/true);
7171
if (!attr_set.attributes().empty()) {

eval/eval/function_step_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ std::string TestNameFn(testing::TestParamInfo<UnknownProcessingOptions> opt) {
540540
case UnknownProcessingOptions::kAttributeAndFunction:
541541
return "attribute_and_function";
542542
}
543+
return "";
543544
}
544545

545546
INSTANTIATE_TEST_SUITE_P(

eval/public/BUILD

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ cc_library(
573573
":cel_function",
574574
":cel_options",
575575
":cel_value",
576-
"//eval/eval:set_util",
576+
":set_util",
577577
"@com_google_absl//absl/container:btree",
578578
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
579579
],
@@ -623,3 +623,31 @@ cc_test(
623623
"@com_google_protobuf//:protobuf",
624624
],
625625
)
626+
627+
cc_library(
628+
name = "set_util",
629+
srcs = ["set_util.cc"],
630+
hdrs = ["set_util.h"],
631+
copts = ["-std=c++14"],
632+
deps = ["//eval/public:cel_value"],
633+
)
634+
635+
cc_test(
636+
name = "set_util_test",
637+
size = "small",
638+
srcs = [
639+
"set_util_test.cc",
640+
],
641+
copts = ["-std=c++14"],
642+
deps = [
643+
":cel_value",
644+
":set_util",
645+
":unknown_set",
646+
"//eval/eval:container_backed_list_impl",
647+
"//eval/eval:container_backed_map_impl",
648+
"@com_github_google_googletest//:gtest_main",
649+
"@com_google_absl//absl/status",
650+
"@com_google_absl//absl/time",
651+
"@com_google_protobuf//:protobuf",
652+
],
653+
)

eval/public/activation.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,20 @@ class BaseActivation {
3939
google::protobuf::Arena*) const = 0;
4040

4141
// Check whether a select path is unknown.
42-
virtual bool IsPathUnknown(absl::string_view) const = 0;
42+
virtual bool IsPathUnknown(absl::string_view) const { return false; }
4343

4444
// Return FieldMask defining the list of unknown paths.
45-
virtual const google::protobuf::FieldMask unknown_paths() const = 0;
45+
virtual const google::protobuf::FieldMask& unknown_paths() const {
46+
return google::protobuf::FieldMask::default_instance();
47+
}
4648

4749
// Return the collection of attribute patterns that determine "unknown"
4850
// values.
4951
virtual const std::vector<CelAttributePattern>& unknown_attribute_patterns()
50-
const = 0;
52+
const {
53+
static const std::vector<CelAttributePattern> empty;
54+
return empty;
55+
}
5156

5257
virtual ~BaseActivation() {}
5358
};
@@ -108,7 +113,7 @@ class Activation : public BaseActivation {
108113
}
109114

110115
// Return FieldMask defining the list of unknown paths.
111-
const google::protobuf::FieldMask unknown_paths() const override {
116+
const google::protobuf::FieldMask& unknown_paths() const override {
112117
return unknown_paths_;
113118
}
114119

eval/public/activation_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ namespace runtime {
1313
namespace {
1414

1515
using ::google::protobuf::Arena;
16-
using testing::_;
1716
using testing::ElementsAre;
1817
using testing::Eq;
1918
using testing::HasSubstr;

eval/public/ast_traverse.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace {
3636

3737
struct StackRecord {
3838
public:
39-
static const int kNotCallArg = -1;
39+
static constexpr int kNotCallArg = -1;
4040

4141
StackRecord(const Expr *e, const SourceInfo *info)
4242
: expr(e),

0 commit comments

Comments
 (0)