[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- Language.cpp ------------------------------------------------------===//
|
2015-08-28 05:33:50 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-08-28 05:33:50 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <map>
|
2015-08-28 06:14:06 +08:00
|
|
|
#include <mutex>
|
2015-08-28 05:33:50 +08:00
|
|
|
|
|
|
|
#include "lldb/Target/Language.h"
|
|
|
|
|
|
|
|
#include "lldb/Core/PluginManager.h"
|
2016-11-02 02:50:49 +08:00
|
|
|
#include "lldb/Symbol/SymbolFile.h"
|
|
|
|
#include "lldb/Symbol/TypeList.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2015-08-28 05:33:50 +08:00
|
|
|
|
2017-02-07 01:55:02 +08:00
|
|
|
#include "llvm/Support/Threading.h"
|
|
|
|
|
2015-08-28 05:33:50 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
2015-09-10 06:30:24 +08:00
|
|
|
using namespace lldb_private::formatters;
|
2015-08-28 05:33:50 +08:00
|
|
|
|
|
|
|
typedef std::unique_ptr<Language> LanguageUP;
|
|
|
|
typedef std::map<lldb::LanguageType, LanguageUP> LanguagesMap;
|
|
|
|
|
|
|
|
static LanguagesMap &GetLanguagesMap() {
|
|
|
|
static LanguagesMap *g_map = nullptr;
|
2017-02-07 01:55:02 +08:00
|
|
|
static llvm::once_flag g_initialize;
|
2016-05-18 09:59:10 +08:00
|
|
|
|
2017-02-07 01:55:02 +08:00
|
|
|
llvm::call_once(g_initialize, [] {
|
2016-05-18 09:59:10 +08:00
|
|
|
g_map = new LanguagesMap(); // NOTE: INTENTIONAL LEAK due to global
|
|
|
|
// destructor chain
|
2015-08-28 05:33:50 +08:00
|
|
|
});
|
2016-05-18 09:59:10 +08:00
|
|
|
|
2015-08-28 05:33:50 +08:00
|
|
|
return *g_map;
|
|
|
|
}
|
2016-05-18 09:59:10 +08:00
|
|
|
static std::mutex &GetLanguagesMutex() {
|
|
|
|
static std::mutex *g_mutex = nullptr;
|
2017-02-07 01:55:02 +08:00
|
|
|
static llvm::once_flag g_initialize;
|
2015-08-28 05:33:50 +08:00
|
|
|
|
2017-02-07 01:55:02 +08:00
|
|
|
llvm::call_once(g_initialize, [] {
|
2016-05-18 09:59:10 +08:00
|
|
|
g_mutex = new std::mutex(); // NOTE: INTENTIONAL LEAK due to global
|
2015-08-28 05:33:50 +08:00
|
|
|
// destructor chain
|
|
|
|
});
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-08-28 05:33:50 +08:00
|
|
|
return *g_mutex;
|
|
|
|
}
|
|
|
|
|
|
|
|
Language *Language::FindPlugin(lldb::LanguageType language) {
|
2016-05-18 09:59:10 +08:00
|
|
|
std::lock_guard<std::mutex> guard(GetLanguagesMutex());
|
2015-08-28 05:33:50 +08:00
|
|
|
LanguagesMap &map(GetLanguagesMap());
|
|
|
|
auto iter = map.find(language), end = map.end();
|
|
|
|
if (iter != end)
|
|
|
|
return iter->second.get();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-08-28 05:33:50 +08:00
|
|
|
Language *language_ptr = nullptr;
|
|
|
|
LanguageCreateInstance create_callback;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-08-28 05:33:50 +08:00
|
|
|
for (uint32_t idx = 0;
|
|
|
|
(create_callback =
|
|
|
|
PluginManager::GetLanguageCreateCallbackAtIndex(idx)) != nullptr;
|
2016-09-07 04:57:50 +08:00
|
|
|
++idx) {
|
2015-08-28 05:33:50 +08:00
|
|
|
language_ptr = create_callback(language);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-08-28 05:33:50 +08:00
|
|
|
if (language_ptr) {
|
|
|
|
map[language] = std::unique_ptr<Language>(language_ptr);
|
2015-09-02 09:06:46 +08:00
|
|
|
return language_ptr;
|
2015-08-28 05:33:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-01 07:12:22 +08:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2018-08-02 08:30:15 +08:00
|
|
|
Language *Language::FindPlugin(llvm::StringRef file_path) {
|
|
|
|
Language *result = nullptr;
|
|
|
|
ForEach([&result, file_path](Language *language) {
|
|
|
|
if (language->IsSourceFile(file_path)) {
|
|
|
|
result = language;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
Language *Language::FindPlugin(LanguageType language,
|
|
|
|
llvm::StringRef file_path) {
|
|
|
|
Language *result = FindPlugin(language);
|
|
|
|
// Finding a language by file path is slower, we so we use this as the
|
|
|
|
// fallback.
|
|
|
|
if (!result)
|
|
|
|
result = FindPlugin(file_path);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-09-02 02:22:39 +08:00
|
|
|
void Language::ForEach(std::function<bool(Language *)> callback) {
|
2018-08-02 08:30:15 +08:00
|
|
|
// If we want to iterate over all languages, we first have to complete the
|
|
|
|
// LanguagesMap.
|
|
|
|
static llvm::once_flag g_initialize;
|
|
|
|
llvm::call_once(g_initialize, [] {
|
|
|
|
for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes;
|
|
|
|
++lang) {
|
|
|
|
FindPlugin(static_cast<lldb::LanguageType>(lang));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-09-02 02:22:39 +08:00
|
|
|
std::lock_guard<std::mutex> guard(GetLanguagesMutex());
|
|
|
|
LanguagesMap &map(GetLanguagesMap());
|
|
|
|
for (const auto &entry : map) {
|
|
|
|
if (!callback(entry.second.get()))
|
|
|
|
break;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-09-02 02:22:39 +08:00
|
|
|
}
|
|
|
|
|
2015-10-01 07:12:22 +08:00
|
|
|
bool Language::IsTopLevelFunction(Function &function) { return false; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-09-10 06:30:24 +08:00
|
|
|
lldb::TypeCategoryImplSP Language::GetFormatters() { return nullptr; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-09-17 02:28:11 +08:00
|
|
|
HardcodedFormatters::HardcodedFormatFinder Language::GetHardcodedFormats() {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
HardcodedFormatters::HardcodedSummaryFinder Language::GetHardcodedSummaries() {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
HardcodedFormatters::HardcodedSyntheticFinder
|
|
|
|
Language::GetHardcodedSynthetics() {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2015-09-09 09:10:46 +08:00
|
|
|
std::vector<ConstString>
|
|
|
|
Language::GetPossibleFormattersMatches(ValueObject &valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2015-09-02 09:06:46 +08:00
|
|
|
struct language_name_pair {
|
|
|
|
const char *name;
|
|
|
|
LanguageType type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct language_name_pair language_names[] = {
|
|
|
|
// To allow GetNameForLanguageType to be a simple array lookup, the first
|
|
|
|
// part of this array must follow enum LanguageType exactly.
|
|
|
|
{"unknown", eLanguageTypeUnknown},
|
|
|
|
{"c89", eLanguageTypeC89},
|
|
|
|
{"c", eLanguageTypeC},
|
|
|
|
{"ada83", eLanguageTypeAda83},
|
|
|
|
{"c++", eLanguageTypeC_plus_plus},
|
|
|
|
{"cobol74", eLanguageTypeCobol74},
|
|
|
|
{"cobol85", eLanguageTypeCobol85},
|
|
|
|
{"fortran77", eLanguageTypeFortran77},
|
|
|
|
{"fortran90", eLanguageTypeFortran90},
|
|
|
|
{"pascal83", eLanguageTypePascal83},
|
|
|
|
{"modula2", eLanguageTypeModula2},
|
|
|
|
{"java", eLanguageTypeJava},
|
|
|
|
{"c99", eLanguageTypeC99},
|
|
|
|
{"ada95", eLanguageTypeAda95},
|
|
|
|
{"fortran95", eLanguageTypeFortran95},
|
|
|
|
{"pli", eLanguageTypePLI},
|
|
|
|
{"objective-c", eLanguageTypeObjC},
|
|
|
|
{"objective-c++", eLanguageTypeObjC_plus_plus},
|
|
|
|
{"upc", eLanguageTypeUPC},
|
|
|
|
{"d", eLanguageTypeD},
|
|
|
|
{"python", eLanguageTypePython},
|
|
|
|
{"opencl", eLanguageTypeOpenCL},
|
|
|
|
{"go", eLanguageTypeGo},
|
|
|
|
{"modula3", eLanguageTypeModula3},
|
|
|
|
{"haskell", eLanguageTypeHaskell},
|
|
|
|
{"c++03", eLanguageTypeC_plus_plus_03},
|
|
|
|
{"c++11", eLanguageTypeC_plus_plus_11},
|
|
|
|
{"ocaml", eLanguageTypeOCaml},
|
|
|
|
{"rust", eLanguageTypeRust},
|
|
|
|
{"c11", eLanguageTypeC11},
|
|
|
|
{"swift", eLanguageTypeSwift},
|
|
|
|
{"julia", eLanguageTypeJulia},
|
|
|
|
{"dylan", eLanguageTypeDylan},
|
|
|
|
{"c++14", eLanguageTypeC_plus_plus_14},
|
|
|
|
{"fortran03", eLanguageTypeFortran03},
|
|
|
|
{"fortran08", eLanguageTypeFortran08},
|
|
|
|
// Vendor Extensions
|
|
|
|
{"mipsassem", eLanguageTypeMipsAssembler},
|
|
|
|
{"renderscript", eLanguageTypeExtRenderScript},
|
|
|
|
// Now synonyms, in arbitrary order
|
|
|
|
{"objc", eLanguageTypeObjC},
|
|
|
|
{"objc++", eLanguageTypeObjC_plus_plus},
|
|
|
|
{"pascal", eLanguageTypePascal83}};
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-09-02 09:06:46 +08:00
|
|
|
static uint32_t num_languages =
|
|
|
|
sizeof(language_names) / sizeof(struct language_name_pair);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-09-17 10:00:02 +08:00
|
|
|
LanguageType Language::GetLanguageTypeFromString(llvm::StringRef string) {
|
|
|
|
for (const auto &L : language_names) {
|
|
|
|
if (string.equals_lower(L.name))
|
|
|
|
return static_cast<LanguageType>(L.type);
|
2015-09-02 09:06:46 +08:00
|
|
|
}
|
2016-09-17 10:00:02 +08:00
|
|
|
|
2015-09-02 09:06:46 +08:00
|
|
|
return eLanguageTypeUnknown;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-09-02 09:06:46 +08:00
|
|
|
const char *Language::GetNameForLanguageType(LanguageType language) {
|
|
|
|
if (language < num_languages)
|
|
|
|
return language_names[language].name;
|
|
|
|
else
|
|
|
|
return language_names[eLanguageTypeUnknown].name;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-09-02 09:31:10 +08:00
|
|
|
void Language::PrintAllLanguages(Stream &s, const char *prefix,
|
|
|
|
const char *suffix) {
|
|
|
|
for (uint32_t i = 1; i < num_languages; i++) {
|
|
|
|
s.Printf("%s%s%s", prefix, language_names[i].name, suffix);
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-09-02 09:06:46 +08:00
|
|
|
void Language::ForAllLanguages(
|
|
|
|
std::function<bool(lldb::LanguageType)> callback) {
|
|
|
|
for (uint32_t i = 1; i < num_languages; i++) {
|
|
|
|
if (!callback(language_names[i].type))
|
|
|
|
break;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-09-02 09:06:46 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-09-02 09:06:46 +08:00
|
|
|
bool Language::LanguageIsCPlusPlus(LanguageType language) {
|
|
|
|
switch (language) {
|
|
|
|
case eLanguageTypeC_plus_plus:
|
|
|
|
case eLanguageTypeC_plus_plus_03:
|
|
|
|
case eLanguageTypeC_plus_plus_11:
|
|
|
|
case eLanguageTypeC_plus_plus_14:
|
2016-02-13 03:47:57 +08:00
|
|
|
case eLanguageTypeObjC_plus_plus:
|
2015-09-02 09:06:46 +08:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Language::LanguageIsObjC(LanguageType language) {
|
|
|
|
switch (language) {
|
|
|
|
case eLanguageTypeObjC:
|
|
|
|
case eLanguageTypeObjC_plus_plus:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-17 03:40:00 +08:00
|
|
|
bool Language::LanguageIsC(LanguageType language) {
|
|
|
|
switch (language) {
|
|
|
|
case eLanguageTypeC:
|
|
|
|
case eLanguageTypeC89:
|
|
|
|
case eLanguageTypeC99:
|
|
|
|
case eLanguageTypeC11:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-17 04:03:05 +08:00
|
|
|
bool Language::LanguageIsCFamily(LanguageType language) {
|
|
|
|
switch (language) {
|
|
|
|
case eLanguageTypeC:
|
|
|
|
case eLanguageTypeC89:
|
|
|
|
case eLanguageTypeC99:
|
|
|
|
case eLanguageTypeC11:
|
|
|
|
case eLanguageTypeC_plus_plus:
|
|
|
|
case eLanguageTypeC_plus_plus_03:
|
|
|
|
case eLanguageTypeC_plus_plus_11:
|
|
|
|
case eLanguageTypeC_plus_plus_14:
|
|
|
|
case eLanguageTypeObjC_plus_plus:
|
|
|
|
case eLanguageTypeObjC:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-09 07:07:53 +08:00
|
|
|
bool Language::LanguageIsPascal(LanguageType language) {
|
|
|
|
switch (language) {
|
|
|
|
case eLanguageTypePascal83:
|
2015-09-02 09:06:46 +08:00
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
default:
|
2015-09-02 09:06:46 +08:00
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-09 07:07:53 +08:00
|
|
|
LanguageType Language::GetPrimaryLanguage(LanguageType language) {
|
2015-09-02 09:06:46 +08:00
|
|
|
switch (language) {
|
|
|
|
case eLanguageTypeC_plus_plus:
|
|
|
|
case eLanguageTypeC_plus_plus_03:
|
|
|
|
case eLanguageTypeC_plus_plus_11:
|
|
|
|
case eLanguageTypeC_plus_plus_14:
|
2015-12-17 03:40:00 +08:00
|
|
|
return eLanguageTypeC_plus_plus;
|
2015-09-02 09:06:46 +08:00
|
|
|
case eLanguageTypeC:
|
|
|
|
case eLanguageTypeC89:
|
|
|
|
case eLanguageTypeC99:
|
2015-12-17 03:40:00 +08:00
|
|
|
case eLanguageTypeC11:
|
|
|
|
return eLanguageTypeC;
|
2015-09-02 09:06:46 +08:00
|
|
|
case eLanguageTypeObjC:
|
|
|
|
case eLanguageTypeObjC_plus_plus:
|
2015-12-17 03:40:00 +08:00
|
|
|
return eLanguageTypeObjC;
|
|
|
|
case eLanguageTypePascal83:
|
|
|
|
case eLanguageTypeCobol74:
|
|
|
|
case eLanguageTypeCobol85:
|
|
|
|
case eLanguageTypeFortran77:
|
|
|
|
case eLanguageTypeFortran90:
|
|
|
|
case eLanguageTypeFortran95:
|
|
|
|
case eLanguageTypeFortran03:
|
|
|
|
case eLanguageTypeFortran08:
|
|
|
|
case eLanguageTypeAda83:
|
|
|
|
case eLanguageTypeAda95:
|
|
|
|
case eLanguageTypeModula2:
|
|
|
|
case eLanguageTypeJava:
|
|
|
|
case eLanguageTypePLI:
|
|
|
|
case eLanguageTypeUPC:
|
2015-10-09 07:07:53 +08:00
|
|
|
case eLanguageTypeD:
|
2015-12-17 03:40:00 +08:00
|
|
|
case eLanguageTypePython:
|
|
|
|
case eLanguageTypeOpenCL:
|
|
|
|
case eLanguageTypeGo:
|
|
|
|
case eLanguageTypeModula3:
|
2015-10-09 07:07:53 +08:00
|
|
|
case eLanguageTypeHaskell:
|
2015-12-17 03:40:00 +08:00
|
|
|
case eLanguageTypeOCaml:
|
2015-10-09 07:07:53 +08:00
|
|
|
case eLanguageTypeRust:
|
|
|
|
case eLanguageTypeSwift:
|
2015-12-17 03:40:00 +08:00
|
|
|
case eLanguageTypeJulia:
|
|
|
|
case eLanguageTypeDylan:
|
|
|
|
case eLanguageTypeMipsAssembler:
|
|
|
|
case eLanguageTypeExtRenderScript:
|
|
|
|
case eLanguageTypeUnknown:
|
2016-09-07 04:57:50 +08:00
|
|
|
default:
|
2015-09-02 09:06:46 +08:00
|
|
|
return language;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-30 02:08:22 +08:00
|
|
|
std::set<lldb::LanguageType> Language::GetSupportedLanguages() {
|
|
|
|
std::set<lldb::LanguageType> supported_languages;
|
|
|
|
ForEach([&](Language *lang) {
|
|
|
|
supported_languages.emplace(lang->GetLanguageType());
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
return supported_languages;
|
|
|
|
}
|
|
|
|
|
2019-08-23 05:45:58 +08:00
|
|
|
LanguageSet Language::GetLanguagesSupportingTypeSystems() {
|
|
|
|
return PluginManager::GetAllTypeSystemSupportedLanguagesForTypes();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2019-08-23 05:45:58 +08:00
|
|
|
LanguageSet Language::GetLanguagesSupportingTypeSystemsForExpressions() {
|
|
|
|
return PluginManager::GetAllTypeSystemSupportedLanguagesForExpressions();
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-08-23 05:45:58 +08:00
|
|
|
LanguageSet Language::GetLanguagesSupportingREPLs() {
|
|
|
|
return PluginManager::GetREPLAllTypeSystemSupportedLanguages();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-10-02 02:16:18 +08:00
|
|
|
std::unique_ptr<Language::TypeScavenger> Language::GetTypeScavenger() {
|
|
|
|
return nullptr;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-10-09 07:07:53 +08:00
|
|
|
const char *Language::GetLanguageSpecificTypeLookupHelp() { return nullptr; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-02 02:16:18 +08:00
|
|
|
size_t Language::TypeScavenger::Find(ExecutionContextScope *exe_scope,
|
2015-09-02 09:06:46 +08:00
|
|
|
const char *key, ResultSet &results,
|
2015-10-02 02:16:18 +08:00
|
|
|
bool append) {
|
|
|
|
if (!exe_scope || !exe_scope->CalculateTarget().get())
|
|
|
|
return false;
|
2015-10-09 07:07:53 +08:00
|
|
|
|
2015-10-22 03:14:33 +08:00
|
|
|
if (!key || !key[0])
|
|
|
|
return false;
|
|
|
|
|
2015-10-02 02:16:18 +08:00
|
|
|
if (!append)
|
|
|
|
results.clear();
|
|
|
|
|
2016-03-25 07:06:42 +08:00
|
|
|
size_t old_size = results.size();
|
|
|
|
|
2015-10-02 02:16:18 +08:00
|
|
|
if (this->Find_Impl(exe_scope, key, results))
|
|
|
|
return results.size() - old_size;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-02 02:50:49 +08:00
|
|
|
bool Language::ImageListTypeScavenger::Find_Impl(
|
|
|
|
ExecutionContextScope *exe_scope, const char *key, ResultSet &results) {
|
|
|
|
bool result = false;
|
|
|
|
|
|
|
|
Target *target = exe_scope->CalculateTarget().get();
|
|
|
|
if (target) {
|
|
|
|
const auto &images(target->GetImages());
|
|
|
|
ConstString cs_key(key);
|
|
|
|
llvm::DenseSet<SymbolFile *> searched_sym_files;
|
|
|
|
TypeList matches;
|
2019-01-15 06:41:21 +08:00
|
|
|
images.FindTypes(nullptr, cs_key, false, UINT32_MAX, searched_sym_files,
|
2016-11-02 02:50:49 +08:00
|
|
|
matches);
|
|
|
|
for (const auto &match : matches.Types()) {
|
2019-02-12 11:47:39 +08:00
|
|
|
if (match) {
|
2016-11-02 02:50:49 +08:00
|
|
|
CompilerType compiler_type(match->GetFullCompilerType());
|
|
|
|
compiler_type = AdjustForInclusion(compiler_type);
|
|
|
|
if (!compiler_type)
|
|
|
|
continue;
|
|
|
|
std::unique_ptr<Language::TypeScavenger::Result> scavengeresult(
|
|
|
|
new Result(compiler_type));
|
|
|
|
results.insert(std::move(scavengeresult));
|
|
|
|
result = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-10-08 02:36:53 +08:00
|
|
|
bool Language::GetFormatterPrefixSuffix(ValueObject &valobj,
|
|
|
|
ConstString type_hint,
|
|
|
|
std::string &prefix,
|
|
|
|
std::string &suffix) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-10-20 06:04:25 +08:00
|
|
|
DumpValueObjectOptions::DeclPrintingHelper Language::GetDeclPrintingHelper() {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
LazyBool Language::IsLogicalTrue(ValueObject &valobj, Status &error) {
|
2015-11-03 05:52:05 +08:00
|
|
|
return eLazyBoolCalculate;
|
|
|
|
}
|
|
|
|
|
2015-11-11 06:39:15 +08:00
|
|
|
bool Language::IsNilReference(ValueObject &valobj) { return false; }
|
|
|
|
|
|
|
|
bool Language::IsUninitializedReference(ValueObject &valobj) { return false; }
|
|
|
|
|
2015-11-19 09:11:53 +08:00
|
|
|
bool Language::GetFunctionDisplayName(const SymbolContext *sc,
|
2015-11-19 10:50:27 +08:00
|
|
|
const ExecutionContext *exe_ctx,
|
2015-11-19 09:11:53 +08:00
|
|
|
FunctionNameRepresentation representation,
|
|
|
|
Stream &s) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-18 10:14:04 +08:00
|
|
|
void Language::GetExceptionResolverDescription(bool catch_on, bool throw_on,
|
|
|
|
Stream &s) {
|
|
|
|
GetDefaultExceptionResolverDescription(catch_on, throw_on, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Language::GetDefaultExceptionResolverDescription(bool catch_on,
|
|
|
|
bool throw_on,
|
|
|
|
Stream &s) {
|
2015-12-18 10:15:25 +08:00
|
|
|
s.Printf("Exception breakpoint (catch: %s throw: %s)",
|
|
|
|
catch_on ? "on" : "off", throw_on ? "on" : "off");
|
2015-12-18 10:14:04 +08:00
|
|
|
}
|
2015-08-28 05:33:50 +08:00
|
|
|
// Constructor
|
|
|
|
Language::Language() {}
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
Language::~Language() {}
|