LLDB mainline
ObjCPlusPlusLanguage.cpp
Go to the documentation of this file.
1//===-- ObjCPlusPlusLanguage.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
10
13
14using namespace lldb;
15using namespace lldb_private;
16
18
19bool ObjCPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const {
20 const auto suffixes = {".h", ".mm"};
21 for (auto suffix : suffixes) {
22 if (file_path.ends_with_insensitive(suffix))
23 return true;
24 }
25 return false;
26}
27
29 lldb::LanguageType category_language,
30 lldb::LanguageType valobj_language) const {
31 if (category_language != lldb::eLanguageTypeObjC_plus_plus)
32 return Language::IsCategoryApplicable(category_language, valobj_language);
33 return Language::LanguageIsC(valobj_language) ||
34 valobj_language == lldb::eLanguageTypeC_plus_plus ||
35 valobj_language == lldb::eLanguageTypeObjC ||
36 valobj_language == lldb::eLanguageTypeObjC_plus_plus;
37}
38
43
47
48// Static Functions
50 switch (language) {
52 return new ObjCPlusPlusLanguage();
53 default:
54 return nullptr;
55 }
56}
57
58std::optional<bool>
60 return llvm::StringSwitch<std::optional<bool>>(str)
61 .Cases({"true", "YES"}, {true})
62 .Cases({"false", "NO"}, {false})
63 .Default({});
64}
#define LLDB_PLUGIN_DEFINE(PluginName)
static bool LanguageIsC(lldb::LanguageType language)
Definition Language.cpp:354
virtual bool IsCategoryApplicable(lldb::LanguageType category_language, lldb::LanguageType valobj_language) const
Returns whether the formatters in a category for category_language, one of the languages of this plug...
Definition Language.h:219
bool IsSourceFile(llvm::StringRef file_path) const override
static llvm::StringRef GetPluginNameStatic()
bool IsCategoryApplicable(lldb::LanguageType category_language, lldb::LanguageType valobj_language) const override
Returns whether the formatters in a category for category_language, one of the languages of this plug...
virtual std::optional< bool > GetBooleanFromString(llvm::StringRef str) const override
static lldb_private::Language * CreateInstance(lldb::LanguageType language)
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A class that represents a running process on the host machine.
LanguageType
Programming language type.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.