PageRenderTime 27ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

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