[Lldb-commits] [lldb] r246611 - Move things from the LanguageRuntime that obviously belong in the new Language plugin instead.
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 1 18:06:47 PDT 2015
Author: jingham
Date: Tue Sep 1 20:06:46 2015
New Revision: 246611
URL: http://llvm.org/viewvc/llvm-project?rev=246611&view=rev
Log:
Move things from the LanguageRuntime that obviously belong in the new Language plugin instead.
Modified:
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/API/SBLanguageRuntime.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectLanguage.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
lldb/trunk/source/Interpreter/Property.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/CompileUnit.cpp
lldb/trunk/source/Target/Language.cpp
lldb/trunk/source/Target/LanguageRuntime.cpp
Modified: lldb/trunk/include/lldb/Target/Language.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Tue Sep 1 20:06:46 2015
@@ -42,6 +42,30 @@ namespace lldb_private {
virtual lldb::TypeCategoryImplSP
GetFormatters ();
+ // These are accessors for general information about the Languages lldb knows about:
+
+ static lldb::LanguageType
+ GetLanguageTypeFromString (const char *string);
+
+ static const char *
+ GetNameForLanguageType (lldb::LanguageType language);
+
+ static void
+ PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
+
+ static bool
+ LanguageIsCPlusPlus (lldb::LanguageType language);
+
+ static bool
+ LanguageIsObjC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsC (lldb::LanguageType language);
+
+ static bool
+ LanguageIsPascal (lldb::LanguageType language);
+
+
protected:
//------------------------------------------------------------------
// Classes that inherit from Language can see and modify these
Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Tue Sep 1 20:06:46 2015
@@ -92,28 +92,6 @@ public:
CreateExceptionPrecondition (lldb::LanguageType language,
bool catch_bp,
bool throw_bp);
-
- static lldb::LanguageType
- GetLanguageTypeFromString (const char *string);
-
- static const char *
- GetNameForLanguageType (lldb::LanguageType language);
-
- static void
- PrintAllLanguages (Stream &s, const char *prefix, const char *suffix);
-
- static bool
- LanguageIsCPlusPlus (lldb::LanguageType language);
-
- static bool
- LanguageIsObjC (lldb::LanguageType language);
-
- static bool
- LanguageIsC (lldb::LanguageType language);
-
- static bool
- LanguageIsPascal (lldb::LanguageType language);
-
Process *
GetProcess()
{
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue Sep 1 20:06:46 2015
@@ -421,7 +421,7 @@ namespace lldb {
eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003.
eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008.
// Vendor Extensions
- // Note: LanguageRuntime::GetNameForLanguageType
+ // Note: Language::GetNameForLanguageType
// assumes these can be used as indexes into array language_names, and
// Language::SetLanguageFromCString and Language::AsCString
// assume these can be used as indexes into array g_languages.
Modified: lldb/trunk/source/API/SBLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLanguageRuntime.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLanguageRuntime.cpp (original)
+++ lldb/trunk/source/API/SBLanguageRuntime.cpp Tue Sep 1 20:06:46 2015
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBLanguageRuntime.h"
-#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/Language.h"
using namespace lldb;
using namespace lldb_private;
@@ -16,11 +16,11 @@ using namespace lldb_private;
lldb::LanguageType
SBLanguageRuntime::GetLanguageTypeFromString (const char *string)
{
- return LanguageRuntime::GetLanguageTypeFromString(string);
+ return Language::GetLanguageTypeFromString(string);
}
const char *
SBLanguageRuntime::GetNameForLanguageType (lldb::LanguageType language)
{
- return LanguageRuntime::GetNameForLanguageType(language);
+ return Language::GetNameForLanguageType(language);
}
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Tue Sep 1 20:06:46 2015
@@ -52,6 +52,7 @@
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ABI.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
@@ -1133,7 +1134,7 @@ SBTarget::BreakpointCreateForException
if (log)
log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)",
static_cast<void*>(target_sp.get()),
- LanguageRuntime::GetNameForLanguageType(language),
+ Language::GetNameForLanguageType(language),
catch_bp ? "on" : "off", throw_bp ? "on" : "off",
static_cast<void*>(sb_bp.get()));
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Tue Sep 1 20:06:46 2015
@@ -26,7 +26,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/Target.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Target/StackFrame.h"
@@ -165,7 +165,7 @@ public:
case 'E':
{
- LanguageType language = LanguageRuntime::GetLanguageTypeFromString (option_arg);
+ LanguageType language = Language::GetLanguageTypeFromString (option_arg);
switch (language)
{
@@ -251,7 +251,7 @@ public:
}
case 'L':
- m_language = LanguageRuntime::GetLanguageTypeFromString (option_arg);
+ m_language = Language::GetLanguageTypeFromString (option_arg);
if (m_language == eLanguageTypeUnknown)
error.SetErrorStringWithFormat ("Unknown language type: '%s' for breakpoint", option_arg);
break;
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Sep 1 20:06:46 2015
@@ -25,6 +25,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Variable.h"
@@ -86,7 +87,7 @@ CommandObjectExpression::CommandOptions:
switch (short_option)
{
case 'l':
- language = LanguageRuntime::GetLanguageTypeFromString (option_arg);
+ language = Language::GetLanguageTypeFromString (option_arg);
if (language == eLanguageTypeUnknown)
error.SetErrorStringWithFormat ("unknown language type: '%s' for expression", option_arg);
break;
Modified: lldb/trunk/source/Commands/CommandObjectLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLanguage.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLanguage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLanguage.cpp Tue Sep 1 20:06:46 2015
@@ -14,6 +14,7 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
using namespace lldb;
@@ -36,7 +37,7 @@ CommandObjectLanguage::GenerateHelpText
output_stream << "\nlanguage name can be one of the following:\n";
- LanguageRuntime::PrintAllLanguages(output_stream, " ", "\n");
+ Language::PrintAllLanguages(output_stream, " ", "\n");
}
CommandObjectLanguage::~CommandObjectLanguage ()
Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Tue Sep 1 20:06:46 2015
@@ -31,7 +31,7 @@
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ExecutionContext.h"
-#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/SectionLoadList.h"
@@ -1529,7 +1529,7 @@ FormatEntity::Format (const Entry &entry
CompileUnit *cu = sc->comp_unit;
if (cu)
{
- const char *lang_name = LanguageRuntime::GetNameForLanguageType(cu->GetLanguage());
+ const char *lang_name = Language::GetNameForLanguageType(cu->GetLanguage());
if (lang_name)
{
s.PutCString(lang_name);
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue Sep 1 20:06:46 2015
@@ -29,6 +29,7 @@
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Target/CPPLanguageRuntime.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
@@ -1783,17 +1784,17 @@ Module::PrepareForFunctionNameLookup (co
if (CPPLanguageRuntime::IsCPPMangledName (name_cstr))
lookup_name_type_mask = eFunctionNameTypeFull;
else if ((language == eLanguageTypeUnknown ||
- LanguageRuntime::LanguageIsObjC(language)) &&
+ Language::LanguageIsObjC(language)) &&
ObjCLanguageRuntime::IsPossibleObjCMethodName (name_cstr))
lookup_name_type_mask = eFunctionNameTypeFull;
- else if (LanguageRuntime::LanguageIsC(language))
+ else if (Language::LanguageIsC(language))
{
lookup_name_type_mask = eFunctionNameTypeFull;
}
else
{
if ((language == eLanguageTypeUnknown ||
- LanguageRuntime::LanguageIsObjC(language)) &&
+ Language::LanguageIsObjC(language)) &&
ObjCLanguageRuntime::IsPossibleObjCSelector(name_cstr))
lookup_name_type_mask |= eFunctionNameTypeSelector;
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue Sep 1 20:06:46 2015
@@ -28,6 +28,8 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Target/Language.h"
+
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -848,7 +850,7 @@ LanguageTypeHelpTextCallback ()
StreamString sstr;
sstr << "One of the following languages:\n";
- LanguageRuntime::PrintAllLanguages(sstr, " ", "\n");
+ Language::PrintAllLanguages(sstr, " ", "\n");
sstr.Flush();
Modified: lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueLanguage.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueLanguage.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueLanguage.cpp Tue Sep 1 20:06:46 2015
@@ -16,7 +16,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
-#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/Language.h"
using namespace lldb;
using namespace lldb_private;
@@ -30,7 +30,7 @@ OptionValueLanguage::DumpValue (const Ex
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
- strm.PutCString (LanguageRuntime::GetNameForLanguageType(m_current_value));
+ strm.PutCString (Language::GetNameForLanguageType(m_current_value));
}
}
@@ -48,7 +48,7 @@ OptionValueLanguage::SetValueFromString
case eVarSetOperationAssign:
{
ConstString lang_name(value.trim());
- LanguageType new_type = LanguageRuntime::GetLanguageTypeFromString(lang_name.GetCString());
+ LanguageType new_type = Language::GetLanguageTypeFromString(lang_name.GetCString());
if (new_type)
{
m_value_was_set = true;
@@ -59,7 +59,7 @@ OptionValueLanguage::SetValueFromString
StreamString error_strm;
error_strm.Printf("invalid language type '%s', ", value.str().c_str());
error_strm.Printf("valid values are:\n");
- LanguageRuntime::PrintAllLanguages(error_strm, " ", "\n");
+ Language::PrintAllLanguages(error_strm, " ", "\n");
error.SetErrorString(error_strm.GetData());
}
}
Modified: lldb/trunk/source/Interpreter/Property.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Property.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Property.cpp (original)
+++ lldb/trunk/source/Interpreter/Property.cpp Tue Sep 1 20:06:46 2015
@@ -17,7 +17,7 @@
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionValues.h"
-#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/Language.h"
using namespace lldb;
using namespace lldb_private;
@@ -129,7 +129,7 @@ Property::Property (const PropertyDefini
{
LanguageType new_lang = eLanguageTypeUnknown;
if (definition.default_cstr_value)
- LanguageRuntime::GetLanguageTypeFromString(definition.default_cstr_value);
+ Language::GetLanguageTypeFromString(definition.default_cstr_value);
else
new_lang = (LanguageType)definition.default_uint_value;
m_value_sp.reset (new OptionValueLanguage(new_lang));
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Tue Sep 1 20:06:46 2015
@@ -25,6 +25,7 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/TypeList.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "clang/AST/DeclCXX.h"
@@ -2252,7 +2253,7 @@ DWARFASTParserClang::ParseFunctionFromDW
if (mangled)
func_name.SetValue(ConstString(mangled), true);
else if (die.GetParent().Tag() == DW_TAG_compile_unit &&
- LanguageRuntime::LanguageIsCPlusPlus(die.GetLanguage()) &&
+ Language::LanguageIsCPlusPlus(die.GetLanguage()) &&
name && strcmp(name, "main") != 0)
{
// If the mangled name is not present in the DWARF, generate the demangled name
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Sep 1 20:06:46 2015
@@ -57,6 +57,8 @@
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/CPPLanguageRuntime.h"
+#include "lldb/Target/Language.h"
+
#include "DWARFASTParser.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugAbbrev.h"
@@ -3914,7 +3916,7 @@ SymbolFileDWARF::ParseVariableDIE
// "(int) A::B::j = 4". If the compiler does not emit a linkage name, we should be able
// to generate a fully qualified name from the declaration context.
if (parent_tag == DW_TAG_compile_unit &&
- LanguageRuntime::LanguageIsCPlusPlus(die.GetLanguage()))
+ Language::LanguageIsCPlusPlus(die.GetLanguage()))
{
DWARFDeclContext decl_ctx;
Modified: lldb/trunk/source/Symbol/CompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompileUnit.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompileUnit.cpp (original)
+++ lldb/trunk/source/Symbol/CompileUnit.cpp Tue Sep 1 20:06:46 2015
@@ -12,7 +12,7 @@
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/VariableList.h"
-#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/Language.h"
using namespace lldb;
using namespace lldb_private;
@@ -87,7 +87,7 @@ CompileUnit::DumpSymbolContext(Stream *s
void
CompileUnit::GetDescription(Stream *s, lldb::DescriptionLevel level) const
{
- const char* language = LanguageRuntime::GetNameForLanguageType(m_language);
+ const char* language = Language::GetNameForLanguageType(m_language);
*s << "id = " << (const UserID&)*this << ", file = \"" << (const FileSpec&)*this << "\", language = \"" << language << '"';
}
@@ -101,7 +101,7 @@ CompileUnit::GetDescription(Stream *s, l
void
CompileUnit::Dump(Stream *s, bool show_context) const
{
- const char* language = LanguageRuntime::GetNameForLanguageType(m_language);
+ const char* language = Language::GetNameForLanguageType(m_language);
s->Printf("%p: ", static_cast<const void*>(this));
s->Indent();
Modified: lldb/trunk/source/Target/Language.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Language.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Target/Language.cpp (original)
+++ lldb/trunk/source/Target/Language.cpp Tue Sep 1 20:06:46 2015
@@ -15,6 +15,7 @@
#include "lldb/Host/Mutex.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
@@ -93,6 +94,146 @@ Language::GetFormatters ()
return nullptr;
}
+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 }
+};
+
+static uint32_t num_languages = sizeof(language_names) / sizeof (struct language_name_pair);
+
+LanguageType
+Language::GetLanguageTypeFromString (const char *string)
+{
+ for (uint32_t i = 0; i < num_languages; i++)
+ {
+ if (strcasecmp (language_names[i].name, string) == 0)
+ return (LanguageType) language_names[i].type;
+ }
+ return eLanguageTypeUnknown;
+}
+
+const char *
+Language::GetNameForLanguageType (LanguageType language)
+{
+ if (language < num_languages)
+ return language_names[language].name;
+ else
+ return language_names[eLanguageTypeUnknown].name;
+}
+
+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);
+ }
+}
+
+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:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+Language::LanguageIsObjC (LanguageType language)
+{
+ switch (language)
+ {
+ case eLanguageTypeObjC:
+ case eLanguageTypeObjC_plus_plus:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+Language::LanguageIsC (LanguageType language)
+{
+ switch (language)
+ {
+ case eLanguageTypeC:
+ case eLanguageTypeC89:
+ case eLanguageTypeC99:
+ case eLanguageTypeC11:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+Language::LanguageIsPascal (LanguageType language)
+{
+ switch (language)
+ {
+ case eLanguageTypePascal83:
+ return true;
+ default:
+ return false;
+ }
+}
+
//----------------------------------------------------------------------
// Constructor
//----------------------------------------------------------------------
Modified: lldb/trunk/source/Target/LanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=246611&r1=246610&r2=246611&view=diff
==============================================================================
--- lldb/trunk/source/Target/LanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/LanguageRuntime.cpp Tue Sep 1 20:06:46 2015
@@ -321,146 +321,6 @@ LanguageRuntime::CreateExceptionBreakpoi
return exc_breakpt_sp;
}
-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 }
-};
-
-static uint32_t num_languages = sizeof(language_names) / sizeof (struct language_name_pair);
-
-LanguageType
-LanguageRuntime::GetLanguageTypeFromString (const char *string)
-{
- for (uint32_t i = 0; i < num_languages; i++)
- {
- if (strcasecmp (language_names[i].name, string) == 0)
- return (LanguageType) language_names[i].type;
- }
- return eLanguageTypeUnknown;
-}
-
-const char *
-LanguageRuntime::GetNameForLanguageType (LanguageType language)
-{
- if (language < num_languages)
- return language_names[language].name;
- else
- return language_names[eLanguageTypeUnknown].name;
-}
-
-void
-LanguageRuntime::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);
- }
-}
-
-bool
-LanguageRuntime::LanguageIsCPlusPlus (LanguageType language)
-{
- switch (language)
- {
- case eLanguageTypeC_plus_plus:
- case eLanguageTypeC_plus_plus_03:
- case eLanguageTypeC_plus_plus_11:
- case eLanguageTypeC_plus_plus_14:
- return true;
- default:
- return false;
- }
-}
-
-bool
-LanguageRuntime::LanguageIsObjC (LanguageType language)
-{
- switch (language)
- {
- case eLanguageTypeObjC:
- case eLanguageTypeObjC_plus_plus:
- return true;
- default:
- return false;
- }
-}
-
-bool
-LanguageRuntime::LanguageIsC (LanguageType language)
-{
- switch (language)
- {
- case eLanguageTypeC:
- case eLanguageTypeC89:
- case eLanguageTypeC99:
- case eLanguageTypeC11:
- return true;
- default:
- return false;
- }
-}
-
-bool
-LanguageRuntime::LanguageIsPascal (LanguageType language)
-{
- switch (language)
- {
- case eLanguageTypePascal83:
- return true;
- default:
- return false;
- }
-}
-
void
LanguageRuntime::InitializeCommands (CommandObject* parent)
{
More information about the lldb-commits
mailing list