[llvm] r187790 - Add LLVM-style RTTI to DIContext/DWARFContext classes
Alexey Samsonov
samsonov at google.com
Tue Aug 6 03:32:39 PDT 2013
Author: samsonov
Date: Tue Aug 6 05:32:39 2013
New Revision: 187790
URL: http://llvm.org/viewvc/llvm-project?rev=187790&view=rev
Log:
Add LLVM-style RTTI to DIContext/DWARFContext classes
Modified:
llvm/trunk/include/llvm/DebugInfo/DIContext.h
llvm/trunk/lib/DebugInfo/DWARFContext.h
Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=187790&r1=187789&r2=187790&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Tue Aug 6 05:32:39 2013
@@ -21,6 +21,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/RelocVisitor.h"
+#include "llvm/Support/Casting.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
@@ -122,6 +123,12 @@ typedef DenseMap<uint64_t, std::pair<uin
class DIContext {
public:
+ enum DIContextKind {
+ CK_DWARF
+ };
+ DIContextKind getKind() const { return Kind; }
+
+ DIContext(DIContextKind K) : Kind(K) {}
virtual ~DIContext();
/// getDWARFContext - get a context for binary DWARF data.
@@ -135,6 +142,8 @@ public:
uint64_t Size, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
virtual DIInliningInfo getInliningInfoForAddress(uint64_t Address,
DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
+private:
+ const DIContextKind Kind;
};
}
Modified: llvm/trunk/lib/DebugInfo/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.h?rev=187790&r1=187789&r2=187790&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFContext.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARFContext.h Tue Aug 6 05:32:39 2013
@@ -48,7 +48,12 @@ class DWARFContext : public DIContext {
void parseDWOCompileUnits();
public:
- DWARFContext() {}
+ DWARFContext() : DIContext(CK_DWARF) {}
+
+ static bool classof(const DIContext *DICtx) {
+ return DICtx->getKind() == CK_DWARF;
+ }
+
virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All);
/// Get the number of compile units in this context.
More information about the llvm-commits
mailing list