/thirdparty/breakpad/common/language.h

http://github.com/tomahawk-player/tomahawk · C++ Header · 84 lines · 16 code · 12 blank · 56 comment · 0 complexity · 7f2b8eb9d81710dcf15e89ba3dec1e67 MD5 · raw file

  1. // -*- mode: c++ -*-
  2. // Copyright (c) 2010 Google Inc.
  3. // All rights reserved.
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. // Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
  31. // language.h: Define google_breakpad::Language. Instances of
  32. // subclasses of this class provide language-appropriate operations
  33. // for the Breakpad symbol dumper.
  34. #ifndef COMMON_LINUX_LANGUAGE_H__
  35. #define COMMON_LINUX_LANGUAGE_H__
  36. #include <string>
  37. namespace google_breakpad {
  38. using std::string;
  39. // An abstract base class for language-specific operations. We choose
  40. // an instance of a subclass of this when we find the CU's language.
  41. // This class's definitions are appropriate for CUs with no specified
  42. // language.
  43. class Language {
  44. public:
  45. // Return true if this language has functions to which we can assign
  46. // line numbers. (Debugging info for assembly language, for example,
  47. // can have source location information, but does not have functions
  48. // recorded using DW_TAG_subprogram DIEs.)
  49. virtual bool HasFunctions() const { return true; }
  50. // Construct a fully-qualified, language-appropriate form of NAME,
  51. // given that PARENT_NAME is the name of the construct enclosing
  52. // NAME. If PARENT_NAME is the empty string, then NAME is a
  53. // top-level name.
  54. //
  55. // This API sort of assumes that a fully-qualified name is always
  56. // some simple textual composition of the unqualified name and its
  57. // parent's name, and that we don't need to know anything else about
  58. // the parent or the child (say, their DIEs' tags) to do the job.
  59. // This is true for the languages we support at the moment, and
  60. // keeps things concrete. Perhaps a more refined operation would
  61. // take into account the parent and child DIE types, allow languages
  62. // to use their own data type for complex parent names, etc. But if
  63. // C++ doesn't need all that, who would?
  64. virtual string MakeQualifiedName (const string &parent_name,
  65. const string &name) const = 0;
  66. // Instances for specific languages.
  67. static const Language * const CPlusPlus,
  68. * const Java,
  69. * const Assembler;
  70. };
  71. } // namespace google_breakpad
  72. #endif // COMMON_LINUX_LANGUAGE_H__