LangOptions.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //===--- LangOptions.cpp - C Language Family Language Options ---*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines the LangOptions class.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "clang/Basic/LangOptions.h"
  14. // //
  15. ///////////////////////////////////////////////////////////////////////////////
  16. using namespace clang;
  17. #ifdef LLVM_ON_UNIX
  18. #ifndef MS_SUPPORT_VARIABLE_LANGOPTS
  19. #define LANGOPT(Name, Bits, Default, Description) const unsigned LangOptionsBase::Name;
  20. #define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
  21. #include "clang/Basic/LangOptions.fixed.def"
  22. #endif // MS_SUPPORT_VARIABLE_LANGOPTS
  23. #endif // LLVM_ON_UNIX
  24. LangOptions::LangOptions()
  25. : HLSLVersion(2018) {
  26. #ifdef MS_SUPPORT_VARIABLE_LANGOPTS
  27. #define LANGOPT(Name, Bits, Default, Description) Name = Default;
  28. #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
  29. #include "clang/Basic/LangOptions.def"
  30. #endif
  31. }
  32. void LangOptions::resetNonModularOptions() {
  33. #ifdef MS_SUPPORT_VARIABLE_LANGOPTS
  34. #define LANGOPT(Name, Bits, Default, Description)
  35. #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
  36. #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
  37. Name = Default;
  38. #include "clang/Basic/LangOptions.def"
  39. #endif
  40. // FIXME: This should not be reset; modules can be different with different
  41. // sanitizer options (this affects __has_feature(address_sanitizer) etc).
  42. Sanitize.clear();
  43. SanitizerBlacklistFiles.clear();
  44. CurrentModule.clear();
  45. ImplementationOfModule.clear();
  46. }