LLDB mainline
SBLanguageRuntime.cpp
Go to the documentation of this file.
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
12
13using namespace lldb;
14using namespace lldb_private;
15
18 LLDB_INSTRUMENT_VA(string);
19
20 return Language::GetLanguageTypeFromString(llvm::StringRef(string));
21}
22
23const char *
25 LLDB_INSTRUMENT_VA(language);
26
27 return Language::GetNameForLanguageType(language);
28}
29
31 return Language::LanguageIsCPlusPlus(language);
32}
33
35 return Language::LanguageIsObjC(language);
36}
37
39 return Language::LanguageIsCFamily(language);
40}
41
43 lldb::LanguageType language) {
44 if (Language *lang_plugin = Language::FindPlugin(language))
45 return lang_plugin->SupportsExceptionBreakpointsOnThrow();
46 return false;
47}
48
50 lldb::LanguageType language) {
51 if (Language *lang_plugin = Language::FindPlugin(language))
52 return lang_plugin->SupportsExceptionBreakpointsOnCatch();
53 return false;
54}
55
56const char *
58 if (Language *lang_plugin = Language::FindPlugin(language))
59 return ConstString(lang_plugin->GetThrowKeyword()).AsCString();
60 return nullptr;
61}
62
63const char *
65 if (Language *lang_plugin = Language::FindPlugin(language))
66 return ConstString(lang_plugin->GetCatchKeyword()).AsCString();
67 return nullptr;
68}
#define LLDB_INSTRUMENT_VA(...)
static bool LanguageIsObjC(lldb::LanguageType language)
Returns whether the given language is Obj-C or Obj-C++.
static bool LanguageIsCFamily(lldb::LanguageType language)
Returns whether the given language is any version of C, C++ or Obj-C.
static bool SupportsExceptionBreakpointsOnThrow(lldb::LanguageType language)
Returns whether the given language supports exception breakpoints on throw statements.
static bool SupportsExceptionBreakpointsOnCatch(lldb::LanguageType language)
Returns whether the given language supports exception breakpoints on catch statements.
static const char * GetNameForLanguageType(lldb::LanguageType language)
static const char * GetThrowKeywordForLanguage(lldb::LanguageType language)
Returns the keyword used for throw statements in the given language, e.g.
static bool LanguageIsCPlusPlus(lldb::LanguageType language)
Returns whether the given language is any version of C++.
static const char * GetCatchKeywordForLanguage(lldb::LanguageType language)
Returns the keyword used for catch statements in the given language, e.g.
static lldb::LanguageType GetLanguageTypeFromString(const char *string)
A uniqued constant string class.
Definition: ConstString.h:40
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:188
static Language * FindPlugin(lldb::LanguageType language)
Definition: Language.cpp:84
static const char * GetNameForLanguageType(lldb::LanguageType language)
Definition: Language.cpp:266
static bool LanguageIsCPlusPlus(lldb::LanguageType language)
Definition: Language.cpp:299
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
static bool LanguageIsCFamily(lldb::LanguageType language)
Equivalent to LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
Definition: Language.cpp:336
static bool LanguageIsObjC(lldb::LanguageType language)
Definition: Language.cpp:314
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
LanguageType
Programming language type.