15ffd83dbSDimitry Andric //===-- ObjCPlusPlusLanguage.cpp ------------------------------------------===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #include "ObjCPlusPlusLanguage.h" 100b57cec5SDimitry Andric 110b57cec5SDimitry Andric #include "lldb/Core/PluginManager.h" 120b57cec5SDimitry Andric #include "lldb/Utility/ConstString.h" 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric using namespace lldb; 150b57cec5SDimitry Andric using namespace lldb_private; 160b57cec5SDimitry Andric LLDB_PLUGIN_DEFINE(ObjCPlusPlusLanguage)175ffd83dbSDimitry AndricLLDB_PLUGIN_DEFINE(ObjCPlusPlusLanguage) 185ffd83dbSDimitry Andric 190b57cec5SDimitry Andric bool ObjCPlusPlusLanguage::IsSourceFile(llvm::StringRef file_path) const { 200b57cec5SDimitry Andric const auto suffixes = {".h", ".mm"}; 210b57cec5SDimitry Andric for (auto suffix : suffixes) { 22*06c3fb27SDimitry Andric if (file_path.ends_with_insensitive(suffix)) 230b57cec5SDimitry Andric return true; 240b57cec5SDimitry Andric } 250b57cec5SDimitry Andric return false; 260b57cec5SDimitry Andric } 270b57cec5SDimitry Andric Initialize()280b57cec5SDimitry Andricvoid ObjCPlusPlusLanguage::Initialize() { 290b57cec5SDimitry Andric PluginManager::RegisterPlugin(GetPluginNameStatic(), "Objective-C++ Language", 300b57cec5SDimitry Andric CreateInstance); 310b57cec5SDimitry Andric } 320b57cec5SDimitry Andric Terminate()330b57cec5SDimitry Andricvoid ObjCPlusPlusLanguage::Terminate() { 340b57cec5SDimitry Andric PluginManager::UnregisterPlugin(CreateInstance); 350b57cec5SDimitry Andric } 360b57cec5SDimitry Andric 370b57cec5SDimitry Andric // Static Functions CreateInstance(lldb::LanguageType language)380b57cec5SDimitry AndricLanguage *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) { 390b57cec5SDimitry Andric switch (language) { 400b57cec5SDimitry Andric case lldb::eLanguageTypeObjC_plus_plus: 410b57cec5SDimitry Andric return new ObjCPlusPlusLanguage(); 420b57cec5SDimitry Andric default: 430b57cec5SDimitry Andric return nullptr; 440b57cec5SDimitry Andric } 450b57cec5SDimitry Andric } 46