Author: enrico Date: Thu Aug 27 13:18:49 2015 New Revision: 246177 URL: http://llvm.org/viewvc/llvm-project?rev=246177&view=rev Log: Remove class Language - the only thing it was actually being used for is provided by LanguageRuntime already
Removed: lldb/trunk/include/lldb/Core/Language.h lldb/trunk/source/Core/Language.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Commands/CommandObjectArgs.h lldb/trunk/source/Core/CMakeLists.txt lldb/trunk/source/Core/FormatEntity.cpp lldb/trunk/source/Symbol/CompileUnit.cpp Removed: lldb/trunk/include/lldb/Core/Language.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Language.h?rev=246176&view=auto ============================================================================== --- lldb/trunk/include/lldb/Core/Language.h (original) +++ lldb/trunk/include/lldb/Core/Language.h (removed) @@ -1,117 +0,0 @@ -//===-- Language.h ----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_Language_h_ -#define liblldb_Language_h_ - -#include "lldb/lldb-private.h" - -namespace lldb_private { - -//---------------------------------------------------------------------- -/// @class Language Language.h "lldb/Core/Language.h" -/// @brief Encapsulates the programming language for an lldb object. -/// -/// Languages are represented by an enumeration value. -/// -/// The enumeration values used when describing the programming language -/// are the same values as the latest DWARF specification. -//---------------------------------------------------------------------- -class Language -{ -public: - //------------------------------------------------------------------ - /// Construct with optional language enumeration. - //------------------------------------------------------------------ - Language(lldb::LanguageType language = lldb::eLanguageTypeUnknown); - - //------------------------------------------------------------------ - /// Destructor. - /// - /// The destructor is virtual in case this class is subclassed. - //------------------------------------------------------------------ - virtual - ~Language(); - - //------------------------------------------------------------------ - /// Get the language value as a NULL termianted C string. - /// - /// @return - /// The C string representation of the language. The returned - /// string does not need to be freed as it comes from constant - /// strings. NULL can be returned when the language is set to - /// a value that doesn't match of of the lldb::LanguageType - /// enumerations. - //------------------------------------------------------------------ - const char * - AsCString (lldb::DescriptionLevel level = lldb::eDescriptionLevelBrief) const; - - void - Clear(); - - void - GetDescription (Stream *s, lldb::DescriptionLevel level) const; - - //------------------------------------------------------------------ - /// Dump the language value to the stream \a s. - /// - /// @param[in] s - /// The stream to which to dump the language description. - //------------------------------------------------------------------ - void - Dump(Stream *s) const; - - //------------------------------------------------------------------ - /// Get accessor for the language. - /// - /// @return - /// The enumeration value that describes the programming - /// language that an object is associated with. - //------------------------------------------------------------------ - virtual lldb::LanguageType - GetLanguage() const; - - //------------------------------------------------------------------ - /// Set accessor for the language. - /// - /// @param[in] language - /// The new enumeration value that describes the programming - /// language that an object is associated with. - //------------------------------------------------------------------ - void - SetLanguage(lldb::LanguageType language); - - //------------------------------------------------------------------ - /// Set accessor for the language. - /// - /// @param[in] language_cstr - /// The language name as a C string. - //------------------------------------------------------------------ - bool - SetLanguageFromCString(const char *language_cstr); - - -protected: - //------------------------------------------------------------------ - // Member variables - //------------------------------------------------------------------ - lldb::LanguageType m_language; ///< The programming language enumeration value. - ///< The enumeration values are the same as the - ///< latest DWARF specification. -}; - -//-------------------------------------------------------------- -/// Stream the language enumeration as a string object to a -/// Stream. -//-------------------------------------------------------------- -Stream& operator << (Stream& s, const Language& language); - -} // namespace lldb_private - -#endif // liblldb_Language_h_ Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=246177&r1=246176&r2=246177&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Aug 27 13:18:49 2015 @@ -360,7 +360,6 @@ 2689003C13353E0400698AC0 /* Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7810F1B85900F91463 /* Error.cpp */; }; 2689003D13353E0400698AC0 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7910F1B85900F91463 /* Event.cpp */; }; 2689003E13353E0400698AC0 /* FileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */; }; - 2689004013353E0400698AC0 /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7D10F1B85900F91463 /* Language.cpp */; }; 2689004113353E0400698AC0 /* Listener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7E10F1B85900F91463 /* Listener.cpp */; }; 2689004213353E0400698AC0 /* Log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7F10F1B85900F91463 /* Log.cpp */; }; 2689004313353E0400698AC0 /* Mangled.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E8010F1B85900F91463 /* Mangled.cpp */; }; @@ -1840,7 +1839,6 @@ 26BC7D6310F1B77400F91463 /* FileSpecList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileSpecList.h; path = include/lldb/Core/FileSpecList.h; sourceTree = "<group>"; }; 26BC7D6410F1B77400F91463 /* Flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Flags.h; path = include/lldb/Core/Flags.h; sourceTree = "<group>"; }; 26BC7D6510F1B77400F91463 /* IOStreamMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOStreamMacros.h; path = include/lldb/Core/IOStreamMacros.h; sourceTree = "<group>"; }; - 26BC7D6610F1B77400F91463 /* Language.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Language.h; path = include/lldb/Core/Language.h; sourceTree = "<group>"; }; 26BC7D6710F1B77400F91463 /* Listener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Listener.h; path = include/lldb/Core/Listener.h; sourceTree = "<group>"; }; 26BC7D6810F1B77400F91463 /* Log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Log.h; path = include/lldb/Core/Log.h; sourceTree = "<group>"; }; 26BC7D6910F1B77400F91463 /* Mangled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mangled.h; path = include/lldb/Core/Mangled.h; sourceTree = "<group>"; }; @@ -1937,7 +1935,6 @@ 26BC7E7810F1B85900F91463 /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Error.cpp; path = source/Core/Error.cpp; sourceTree = "<group>"; }; 26BC7E7910F1B85900F91463 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Event.cpp; path = source/Core/Event.cpp; sourceTree = "<group>"; }; 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileSpecList.cpp; path = source/Core/FileSpecList.cpp; sourceTree = "<group>"; }; - 26BC7E7D10F1B85900F91463 /* Language.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Language.cpp; path = source/Core/Language.cpp; sourceTree = "<group>"; }; 26BC7E7E10F1B85900F91463 /* Listener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Listener.cpp; path = source/Core/Listener.cpp; sourceTree = "<group>"; }; 26BC7E7F10F1B85900F91463 /* Log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Log.cpp; path = source/Core/Log.cpp; sourceTree = "<group>"; }; 26BC7E8010F1B85900F91463 /* Mangled.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Mangled.cpp; path = source/Core/Mangled.cpp; sourceTree = "<group>"; }; @@ -4039,8 +4036,6 @@ 260A63161861008E00FECF8E /* IOHandler.h */, 260A63181861009E00FECF8E /* IOHandler.cpp */, 26BC7D6510F1B77400F91463 /* IOStreamMacros.h */, - 26BC7D6610F1B77400F91463 /* Language.h */, - 26BC7E7D10F1B85900F91463 /* Language.cpp */, 26BC7D6710F1B77400F91463 /* Listener.h */, 26BC7E7E10F1B85900F91463 /* Listener.cpp */, 26BC7D6810F1B77400F91463 /* Log.h */, @@ -6097,7 +6092,6 @@ 2689003D13353E0400698AC0 /* Event.cpp in Sources */, 26B75B441AD6E29A001F7A57 /* MipsLinuxSignals.cpp in Sources */, 2689003E13353E0400698AC0 /* FileSpecList.cpp in Sources */, - 2689004013353E0400698AC0 /* Language.cpp in Sources */, 2689004113353E0400698AC0 /* Listener.cpp in Sources */, 2689004213353E0400698AC0 /* Log.cpp in Sources */, 2689004313353E0400698AC0 /* Mangled.cpp in Sources */, Modified: lldb/trunk/source/Commands/CommandObjectArgs.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=246177&r1=246176&r2=246177&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectArgs.h (original) +++ lldb/trunk/source/Commands/CommandObjectArgs.h Thu Aug 27 13:18:49 2015 @@ -16,7 +16,6 @@ // Project includes #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/Options.h" -#include "lldb/Core/Language.h" namespace lldb_private { Modified: lldb/trunk/source/Core/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=246177&r1=246176&r2=246177&view=diff ============================================================================== --- lldb/trunk/source/Core/CMakeLists.txt (original) +++ lldb/trunk/source/Core/CMakeLists.txt Thu Aug 27 13:18:49 2015 @@ -31,7 +31,6 @@ add_lldb_library(lldbCore FormatEntity.cpp History.cpp IOHandler.cpp - Language.cpp Listener.cpp Log.cpp Logging.cpp Modified: lldb/trunk/source/Core/FormatEntity.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=246177&r1=246176&r2=246177&view=diff ============================================================================== --- lldb/trunk/source/Core/FormatEntity.cpp (original) +++ lldb/trunk/source/Core/FormatEntity.cpp Thu Aug 27 13:18:49 2015 @@ -13,7 +13,6 @@ #include "lldb/Core/Address.h" #include "lldb/Core/Debugger.h" -#include "lldb/Core/Language.h" #include "lldb/Core/Module.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamString.h" @@ -31,6 +30,7 @@ #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/SectionLoadList.h" @@ -1528,8 +1528,7 @@ FormatEntity::Format (const Entry &entry CompileUnit *cu = sc->comp_unit; if (cu) { - Language lang(cu->GetLanguage()); - const char *lang_name = lang.AsCString(); + const char *lang_name = LanguageRuntime::GetNameForLanguageType(cu->GetLanguage()); if (lang_name) { s.PutCString(lang_name); Removed: lldb/trunk/source/Core/Language.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Language.cpp?rev=246176&view=auto ============================================================================== --- lldb/trunk/source/Core/Language.cpp (original) +++ lldb/trunk/source/Core/Language.cpp (removed) @@ -1,169 +0,0 @@ -//===-- Language.cpp --------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/lldb-private.h" -#include "lldb/Core/Language.h" -#include "lldb/Core/Stream.h" -#include "llvm/ADT/STLExtras.h" -#include <string.h> - -using namespace lldb; -using namespace lldb_private; - -#define ENUM_TO_DCSTREAM(x) case x: s->PutCString(#x); return - -struct LanguageStrings -{ - const char * names[3]; -}; - -static LanguageStrings -g_languages[] = -{ - { { "unknown" , NULL , NULL } }, - { { "c89" , NULL , "ISO C:1989" } }, - { { NULL , NULL , "K&R C" } }, - { { "ada83" , "Ada83" , "ISO Ada:1983" } }, - { { "c++" , "cxx" , "ISO C++:1998" } }, - { { "cobol74" , "Cobol74" , "ISO Cobol:1974" } }, - { { "cobol" , "Cobol85" , "ISO Cobol:1985." } }, - { { "f77" , "Fortran77" , "ISO Fortran 77." } }, - { { "f90" , "Fortran90" , "ISO Fortran 90" } }, - { { "pascal" , "Pascal83" , "ISO Pascal:1983" } }, - { { "modula2" , "Modula2" , "ISO Modula-2:1996" } }, - { { "java" , NULL , "Java" } }, - { { "c" , "C99" , "ISO C:1999" } }, - { { "ada" , "Ada95" , "ISO Ada:1995" } }, - { { "f95" , "Fortran95" , "ISO Fortran 95" } }, - { { "PLI" , NULL , "ANSI PL/I:1976" } }, - { { "objc" , NULL , "Objective-C" } }, - { { "objc++" , NULL , "Objective-C++" } }, - { { "upc" , NULL , "Unified Parallel C" } }, - { { "d" , NULL , "D" } }, - { { "python" , NULL , "Python" } }, - { { "opencl" , "OpenCL" , "OpenCL" } }, - { { "go" , "Go" , "Go" } }, - { { "modula3" , "Modula3" , "Modula 3" } }, - { { "haskell" , "Haskell" , "Haskell" } }, - { { "c++03" , "C_plus_plus_03" , "ISO C++:2003" } }, - { { "c++11" , "C_plus_plus_11" , "ISO C++:2011" } }, - { { "ocaml" , "OCaml" , "OCaml" } }, - { { "rust" , "Rust" , "Rust" } }, - { { "c11" , "C11" , "ISO C:2011" } }, - { { "swift" , "Swift" , "Swift" } }, - { { "julia" , "Julia" , "Julia" } }, - { { "dylan" , "Dylan" , "Dylan" } }, - { { "c++14" , "C_plus_plus_14" , "ISO C++:2014" } }, - { { "f03" , "Fortran03" , "ISO Fortran 2003" } }, - { { "f08" , "Fortran08" , "ISO Fortran 2008" } }, - // Vendor Extensions - { { "mipsassem" , "Mips_Assembler" , "Mips Assembler" } }, - { { "renderscript" , "RenderScript" , "RenderScript" } } -}; - -static const size_t g_num_languages = llvm::array_lengthof(g_languages); - -Language::Language(LanguageType language) : - m_language (language) -{ -} - -Language::~Language() -{ -} - -LanguageType -Language::GetLanguage() const -{ - return m_language; -} - -void -Language::Clear () -{ - m_language = eLanguageTypeUnknown; -} - -void -Language::SetLanguage(LanguageType language) -{ - m_language = language; -} - -bool -Language::SetLanguageFromCString(const char *language_cstr) -{ - size_t i, desc_idx; - const char *name; - - // First check the most common name for the languages - for (desc_idx=lldb::eDescriptionLevelBrief; desc_idx<kNumDescriptionLevels; ++desc_idx) - { - for (i=0; i<g_num_languages; ++i) - { - name = g_languages[i].names[desc_idx]; - if (name == NULL) - continue; - - if (::strcasecmp (language_cstr, name) == 0) - { - m_language = (LanguageType)i; - return true; - } - } - } - - m_language = eLanguageTypeUnknown; - return false; -} - - -const char * -Language::AsCString (lldb::DescriptionLevel level) const -{ - if (m_language < g_num_languages && level < kNumDescriptionLevels) - { - const char *name = g_languages[m_language].names[level]; - if (name) - return name; - else if (level + 1 < kNumDescriptionLevels) - return AsCString ((lldb::DescriptionLevel)(level + 1)); - else - return NULL; - } - return NULL; -} - -void -Language::Dump(Stream *s) const -{ - GetDescription(s, lldb::eDescriptionLevelVerbose); -} - -void -Language::GetDescription (Stream *s, lldb::DescriptionLevel level) const -{ - const char *lang_cstr = AsCString(level); - - if (lang_cstr) - s->PutCString(lang_cstr); - else - s->Printf("Language(language = 0x%4.4x)", m_language); -} - - - - -Stream& -lldb_private::operator << (Stream& s, const Language& language) -{ - language.Dump(&s); - return s; -} - Modified: lldb/trunk/source/Symbol/CompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompileUnit.cpp?rev=246177&r1=246176&r2=246177&view=diff ============================================================================== --- lldb/trunk/source/Symbol/CompileUnit.cpp (original) +++ lldb/trunk/source/Symbol/CompileUnit.cpp Thu Aug 27 13:18:49 2015 @@ -9,10 +9,10 @@ #include "lldb/Symbol/CompileUnit.h" #include "lldb/Core/Module.h" -#include "lldb/Core/Language.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/VariableList.h" +#include "lldb/Target/LanguageRuntime.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 { - Language language(m_language); + const char* language = LanguageRuntime::GetNameForLanguageType(m_language); *s << "id = " << (const UserID&)*this << ", file = \"" << (const FileSpec&)*this << "\", language = \"" << language << '"'; } @@ -101,10 +101,12 @@ CompileUnit::GetDescription(Stream *s, l void CompileUnit::Dump(Stream *s, bool show_context) const { + const char* language = LanguageRuntime::GetNameForLanguageType(m_language); + s->Printf("%p: ", static_cast<const void*>(this)); s->Indent(); *s << "CompileUnit" << static_cast<const UserID&>(*this) - << ", language = \"" << reinterpret_cast<const Language&>(*this) + << ", language = \"" << language << "\", file = '" << static_cast<const FileSpec&>(*this) << "'\n"; // m_types.Dump(s); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits