macros.h 896 B

12345678910111213141516171819202122
  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_TOOLCHAIN_CHECK_CPP_MACROS_H_
  5. #define CARBON_TOOLCHAIN_CHECK_CPP_MACROS_H_
  6. #include "toolchain/check/context.h"
  7. namespace Carbon::Check {
  8. // Tries to evaluate the given macro to a constant expression. Returns the
  9. // evaluated expression on success or nullptr otherwise. Currently supports only
  10. // object-like macros that evaluate to an integer constant.
  11. // TODO: Add support for other literal types.
  12. auto TryEvaluateMacroToConstant(Context& context, SemIR::LocId loc_id,
  13. SemIR::NameId name_id,
  14. clang::MacroInfo* macro_info) -> clang::Expr*;
  15. } // namespace Carbon::Check
  16. #endif // CARBON_TOOLCHAIN_CHECK_CPP_MACROS_H_