1 //===-- SBLanguageRuntime.cpp ---------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "lldb/API/SBLanguageRuntime.h" 10 #include "lldb/Target/Language.h" 11 #include "lldb/Utility/Instrumentation.h" 12 13 using namespace lldb; 14 using namespace lldb_private; 15 16 lldb::LanguageType GetLanguageTypeFromString(const char * string)17SBLanguageRuntime::GetLanguageTypeFromString(const char *string) { 18 LLDB_INSTRUMENT_VA(string); 19 20 return Language::GetLanguageTypeFromString(llvm::StringRef(string)); 21 } 22 23 const char * GetNameForLanguageType(lldb::LanguageType language)24SBLanguageRuntime::GetNameForLanguageType(lldb::LanguageType language) { 25 LLDB_INSTRUMENT_VA(language); 26 27 return Language::GetNameForLanguageType(language); 28 } 29 LanguageIsCPlusPlus(lldb::LanguageType language)30bool SBLanguageRuntime::LanguageIsCPlusPlus(lldb::LanguageType language) { 31 return Language::LanguageIsCPlusPlus(language); 32 } 33 LanguageIsObjC(lldb::LanguageType language)34bool SBLanguageRuntime::LanguageIsObjC(lldb::LanguageType language) { 35 return Language::LanguageIsObjC(language); 36 } 37 LanguageIsCFamily(lldb::LanguageType language)38bool SBLanguageRuntime::LanguageIsCFamily(lldb::LanguageType language) { 39 return Language::LanguageIsCFamily(language); 40 } 41 SupportsExceptionBreakpointsOnThrow(lldb::LanguageType language)42bool SBLanguageRuntime::SupportsExceptionBreakpointsOnThrow( 43 lldb::LanguageType language) { 44 if (Language *lang_plugin = Language::FindPlugin(language)) 45 return lang_plugin->SupportsExceptionBreakpointsOnThrow(); 46 return false; 47 } 48 SupportsExceptionBreakpointsOnCatch(lldb::LanguageType language)49bool SBLanguageRuntime::SupportsExceptionBreakpointsOnCatch( 50 lldb::LanguageType language) { 51 if (Language *lang_plugin = Language::FindPlugin(language)) 52 return lang_plugin->SupportsExceptionBreakpointsOnCatch(); 53 return false; 54 } 55 56 const char * GetThrowKeywordForLanguage(lldb::LanguageType language)57SBLanguageRuntime::GetThrowKeywordForLanguage(lldb::LanguageType language) { 58 if (Language *lang_plugin = Language::FindPlugin(language)) 59 return ConstString(lang_plugin->GetThrowKeyword()).AsCString(); 60 return nullptr; 61 } 62 63 const char * GetCatchKeywordForLanguage(lldb::LanguageType language)64SBLanguageRuntime::GetCatchKeywordForLanguage(lldb::LanguageType language) { 65 if (Language *lang_plugin = Language::FindPlugin(language)) 66 return ConstString(lang_plugin->GetCatchKeyword()).AsCString(); 67 return nullptr; 68 } 69