AnalyzerOptions.cpp revision de5277fc555551857602bd7a7e5e616274e2d4a6
1//===-- AnalyzerOptions.cpp - Analysis Engine 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 contains special accessors for analyzer configuration options 11// with string representations. 12// 13//===----------------------------------------------------------------------===// 14 15#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h" 16#include "llvm/ADT/StringSwitch.h" 17 18using namespace clang; 19 20bool 21AnalyzerOptions::mayInlineCXXMemberFunction(CXXInlineableMemberKind K) const { 22 if (IPAMode < Inlining) 23 return false; 24 25 if (!CXXMemberInliningMode) { 26 static const char *ModeKey = "c++-inlining"; 27 std::string ModeStr = Config.lookup(ModeKey); 28 29 CXXInlineableMemberKind &MutableMode = 30 const_cast<CXXInlineableMemberKind &>(CXXMemberInliningMode); 31 32 MutableMode = llvm::StringSwitch<CXXInlineableMemberKind>(ModeStr) 33 .Case("", CIMK_MemberFunctions) 34 .Case("constructors", CIMK_Constructors) 35 .Case("destructors", CIMK_Destructors) 36 .Case("none", CIMK_None) 37 .Case("methods", CIMK_MemberFunctions) 38 .Default(CXXInlineableMemberKind()); 39 40 if (!MutableMode) { 41 // FIXME: We should emit a warning here about an unknown inlining kind, 42 // but the AnalyzerOptions doesn't have access to a diagnostic engine. 43 MutableMode = CIMK_None; 44 } 45 } 46 47 return CXXMemberInliningMode >= K; 48} 49