Skip to content

Commit

Permalink
Remove ABSL_ATTRIBUTE_PURE_FUNCTION from cache getters
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 648353259
  • Loading branch information
jcking authored and copybara-github committed Jul 1, 2024
1 parent 47b3440 commit aea088a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ cc_library(
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/base:no_destructor",
"@com_google_absl//absl/base:nullability",
"@com_google_absl//absl/container:fixed_array",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:inlined_vector",
Expand Down
3 changes: 2 additions & 1 deletion common/types/type_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <utility>

#include "absl/base/no_destructor.h"
#include "absl/base/nullability.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/absl_check.h"
#include "absl/strings/string_view.h"
Expand All @@ -27,7 +28,7 @@

namespace cel::common_internal {

const ProcessLocalTypeCache* ProcessLocalTypeCache::Get() {
absl::Nonnull<const ProcessLocalTypeCache*> ProcessLocalTypeCache::Get() {
static const absl::NoDestructor<ProcessLocalTypeCache> type_cache;
return &*type_cache;
}
Expand Down
3 changes: 2 additions & 1 deletion common/types/type_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "absl/base/attributes.h"
#include "absl/base/no_destructor.h"
#include "absl/base/nullability.h"
#include "absl/container/flat_hash_map.h"
#include "absl/hash/hash.h"
#include "absl/strings/string_view.h"
Expand Down Expand Up @@ -120,7 +121,7 @@ using StructTypeCacheMap = absl::flat_hash_map<absl::string_view, StructType>;

class ProcessLocalTypeCache final {
public:
ABSL_ATTRIBUTE_PURE_FUNCTION static const ProcessLocalTypeCache* Get();
static absl::Nonnull<const ProcessLocalTypeCache*> Get();

absl::optional<ListTypeView> FindListType(TypeView element) const;

Expand Down
3 changes: 2 additions & 1 deletion common/values/value_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <utility>

#include "absl/base/no_destructor.h"
#include "absl/base/nullability.h"
#include "absl/log/absl_check.h"
#include "absl/status/status.h"
#include "absl/types/optional.h"
Expand All @@ -43,7 +44,7 @@ OptionalValueView GetEmptyDynOptionalValue() {
return ProcessLocalValueCache::Get()->GetEmptyDynOptionalValue();
}

const ProcessLocalValueCache* ProcessLocalValueCache::Get() {
absl::Nonnull<const ProcessLocalValueCache*> ProcessLocalValueCache::Get() {
static const absl::NoDestructor<ProcessLocalValueCache> instance;
return &*instance;
}
Expand Down
2 changes: 1 addition & 1 deletion common/values/value_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ using OptionalValueCacheMap =

class ProcessLocalValueCache final {
public:
ABSL_ATTRIBUTE_PURE_FUNCTION static const ProcessLocalValueCache* Get();
static absl::Nonnull<const ProcessLocalValueCache*> Get();

ErrorValueView GetDefaultErrorValue() const;

Expand Down

0 comments on commit aea088a

Please # to comment.