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 
9 #include "ObjCPlusPlusLanguage.h"
10 
13 
14 using namespace lldb;
15 using namespace lldb_private;
16 
18 
19 bool ObjCPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const {
20  const auto suffixes = {".h", ".mm"};
21  for (auto suffix : suffixes) {
22  if (file_path.endswith_insensitive(suffix))
23  return true;
24  }
25  return false;
26 }
27 
28 void ObjCPlusPlusLanguage::Initialize() {
29  PluginManager::RegisterPlugin(GetPluginNameStatic(), "Objective-C++ Language",
30  CreateInstance);
31 }
32 
33 void ObjCPlusPlusLanguage::Terminate() {
34  PluginManager::UnregisterPlugin(CreateInstance);
35 }
36 
37 // Static Functions
38 Language *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) {
39  switch (language) {
41  return new ObjCPlusPlusLanguage();
42  default:
43  return nullptr;
44  }
45 }
llvm
Definition: Debugger.h:49
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb::eLanguageTypeObjC_plus_plus
@ eLanguageTypeObjC_plus_plus
Objective-C++.
Definition: lldb-enumerations.h:454
lldb_private::Language
Definition: Language.h:29
PluginManager.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
ConstString.h
lldb_private::ObjCPlusPlusLanguage
Definition: ObjCPlusPlusLanguage.h:18
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb
Definition: SBAddress.h:15
ObjCPlusPlusLanguage.h