Skip to content

Commit

Permalink
Fix cel::common_internal::IsStringLiteral
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 610840806
  • Loading branch information
jcking authored and copybara-github committed Feb 27, 2024
1 parent 00e2607 commit 6654e73
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions common/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ cc_library(
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/functional:overload",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/meta:type_traits",
"@com_google_absl//absl/strings:cord",
"@com_google_absl//absl/strings:string_view",
],
Expand Down
15 changes: 14 additions & 1 deletion common/internal/shared_byte_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,27 @@
#include "absl/base/optimization.h"
#include "absl/functional/overload.h"
#include "absl/log/absl_check.h"
#include "absl/meta/type_traits.h"
#include "absl/strings/cord.h"
#include "absl/strings/string_view.h"
#include "common/internal/arena_string.h"
#include "common/internal/reference_count.h"

namespace cel::common_internal {

constexpr bool IsStringLiteral(absl::string_view string);
inline constexpr bool IsStringLiteral(absl::string_view string) {
#ifdef ABSL_HAVE_CONSTANT_EVALUATED
if (!absl::is_constant_evaluated()) {
return false;
}
#endif
for (const auto& c : string) {
if (c == '\0') {
return false;
}
}
return true;
}

inline constexpr uintptr_t kByteStringReferenceCountPooledBit = uintptr_t{1}
<< 0;
Expand Down

0 comments on commit 6654e73

Please sign in to comment.