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 #include "llvm/ADT/StringRef.h" 15 16 using namespace clang; 17 18 LangOptions::LangOptions() 19 : IsHeaderFile(false) { 20 #define LANGOPT(Name, Bits, Default, Description) Name = Default; 21 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default); 22 #include "clang/Basic/LangOptions.def" 23 } 24 25 void LangOptions::resetNonModularOptions() { 26 #define LANGOPT(Name, Bits, Default, Description) 27 #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default; 28 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ 29 Name = Default; 30 #include "clang/Basic/LangOptions.def" 31 32 // These options do not affect AST generation. 33 SanitizerBlacklistFiles.clear(); 34 XRayAlwaysInstrumentFiles.clear(); 35 XRayNeverInstrumentFiles.clear(); 36 37 CurrentModule.clear(); 38 IsHeaderFile = false; 39 } 40 41 bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const { 42 for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i) 43 if (FuncName.equals(NoBuiltinFuncs[i])) 44 return true; 45 return false; 46 } 47