build_data_linkstamp.h 1.3 KB

123456789101112131415161718192021222324252627282930
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_COMMON_BUILD_DATA_LINKSTAMP_H_
  5. #define CARBON_COMMON_BUILD_DATA_LINKSTAMP_H_
  6. namespace Carbon::BuildData::Internal {
  7. // See build_data.h; the list of names here should match.
  8. //
  9. // Bazel will build dependencies on the `:build_data` library (which exposes
  10. // `build_data_linkstamp.h`) throughout the build process, but
  11. // `build_data_linkstamp.cpp` is compiled and linked per-binary -- essentially a
  12. // separate library. In essence, `build_data_linkstamp.h` is exposing values
  13. // that are assigned later (this has consequences like preventing `constexpr`
  14. // use).
  15. //
  16. // Also, when build_data_linkstamp.cpp is compiled, this doesn't receive deps,
  17. // so we can't use things like `llvm::StringRef` here. It should ideally be
  18. // purely hermetic -- not even using STL for `string_view`. As a result, we use
  19. // `build_data.h` as an intermediary to do a `StringRef` wrap.
  20. extern const char platform[];
  21. extern const bool build_coverage_enabled;
  22. extern const char target_name[];
  23. extern const char build_target[];
  24. } // namespace Carbon::BuildData::Internal
  25. #endif // CARBON_COMMON_BUILD_DATA_LINKSTAMP_H_