raw_ptr_exclusion.h 748 B

123456789101112131415161718192021
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_MEMORY_RAW_PTR_EXCLUSION_H_
  5. #define BASE_MEMORY_RAW_PTR_EXCLUSION_H_
  6. #include "build/build_config.h"
  7. #if defined(OFFICIAL_BUILD)
  8. // The annotation changed compiler output and increased binary size so disable
  9. // for official builds.
  10. // TODO(crbug.com/1320670): Remove when issue is resolved.
  11. #define RAW_PTR_EXCLUSION
  12. #else
  13. // Marks a field as excluded from the raw_ptr usage enforcement clang plugin.
  14. // Example: RAW_PTR_EXCLUSION Foo* foo_;
  15. #define RAW_PTR_EXCLUSION __attribute__((annotate("raw_ptr_exclusion")))
  16. #endif
  17. #endif // BASE_MEMORY_RAW_PTR_EXCLUSION_H_