Home | History | Annotate | Download | only in Basic
      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 #define LANGOPT(Name, Bits, Default, Description) Name = Default;
     20 #define ENUM_LANGOPT(Name, Type, Bits, Default, Description) set##Name(Default);
     21 #include "clang/Basic/LangOptions.def"
     22 }
     23 
     24 void LangOptions::resetNonModularOptions() {
     25 #define LANGOPT(Name, Bits, Default, Description)
     26 #define BENIGN_LANGOPT(Name, Bits, Default, Description) Name = Default;
     27 #define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
     28   Name = Default;
     29 #include "clang/Basic/LangOptions.def"
     30 
     31   // FIXME: This should not be reset; modules can be different with different
     32   // sanitizer options (this affects __has_feature(address_sanitizer) etc).
     33   Sanitize.clear();
     34   SanitizerBlacklistFiles.clear();
     35 
     36   CurrentModule.clear();
     37 }
     38 
     39 bool LangOptions::isNoBuiltinFunc(const char *Name) const {
     40   StringRef FuncName(Name);
     41   for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i)
     42     if (FuncName.equals(NoBuiltinFuncs[i]))
     43       return true;
     44   return false;
     45 }
     46