LangOptions.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #ifdef MS_SUPPORT_VARIABLE_LANGOPTS
  26. #define LANGOPT(Name, Bits, Default, Description) Name = Default;
  27. #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
  28. #include "clang/Basic/LangOptions.def"
  29. #endif
  30. }
  31. void LangOptions::resetNonModularOptions() {
  32. #ifdef MS_SUPPORT_VARIABLE_LANGOPTS
  33. #define LANGOPT(Name, Bits, Default, Description)
  34. #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
  35. #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
  36. Name = Default;
  37. #include "clang/Basic/LangOptions.def"
  38. #endif
  39. // FIXME: This should not be reset; modules can be different with different
  40. // sanitizer options (this affects __has_feature(address_sanitizer) etc).
  41. Sanitize.clear();
  42. SanitizerBlacklistFiles.clear();
  43. CurrentModule.clear();
  44. ImplementationOfModule.clear();
  45. }