LangOptions.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //===- LangOptions.cpp - C Language Family Language Options ---------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines the LangOptions class.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "clang/Basic/LangOptions.h"
  13. using namespace clang;
  14. LangOptions::LangOptions() {
  15. #define LANGOPT(Name, Bits, Default, Description) Name = Default;
  16. #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
  17. #include "clang/Basic/LangOptions.def"
  18. }
  19. void LangOptions::resetNonModularOptions() {
  20. #define LANGOPT(Name, Bits, Default, Description)
  21. #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
  22. #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
  23. Name = Default;
  24. #include "clang/Basic/LangOptions.def"
  25. // These options do not affect AST generation.
  26. SanitizerBlacklistFiles.clear();
  27. XRayAlwaysInstrumentFiles.clear();
  28. XRayNeverInstrumentFiles.clear();
  29. CurrentModule.clear();
  30. IsHeaderFile = false;
  31. }
  32. bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
  33. for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
  34. if (FuncName.equals(NoBuiltinFuncs[i]))
  35. return true;
  36. return false;
  37. }
  38. VersionTuple LangOptions::getOpenCLVersionTuple() const {
  39. const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
  40. return VersionTuple(Ver / 100, (Ver % 100) / 10);
  41. }