2008-11-10 03:56:27 +01:00
|
|
|
//===--- llvm/Analysis/DebugInfo.h - Debug Information Helpers --*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines a bunch of datatypes that are useful for creating and
|
2009-05-14 20:26:15 +02:00
|
|
|
// walking debug info in LLVM IR form. They essentially provide wrappers around
|
|
|
|
// the information in the global variables that's needed when constructing the
|
|
|
|
// DWARF information.
|
2008-11-10 03:56:27 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-10 01:45:19 +01:00
|
|
|
#ifndef LLVM_DEBUGINFO_H
|
|
|
|
#define LLVM_DEBUGINFO_H
|
2008-11-10 03:56:27 +01:00
|
|
|
|
2009-07-28 21:55:13 +02:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
2012-12-03 18:02:12 +01:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2009-12-31 04:02:08 +01:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2009-12-31 04:02:42 +01:00
|
|
|
#include "llvm/Support/Dwarf.h"
|
2008-11-10 03:56:27 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class BasicBlock;
|
|
|
|
class Constant;
|
|
|
|
class Function;
|
|
|
|
class GlobalVariable;
|
|
|
|
class Module;
|
2008-11-10 05:10:34 +01:00
|
|
|
class Type;
|
2008-11-10 03:56:27 +01:00
|
|
|
class Value;
|
2010-01-06 18:16:00 +01:00
|
|
|
class DbgDeclareInst;
|
2013-07-23 02:22:51 +02:00
|
|
|
class DbgValueInst;
|
2008-12-16 10:07:36 +01:00
|
|
|
class Instruction;
|
2009-12-31 04:02:08 +01:00
|
|
|
class MDNode;
|
2013-08-27 00:39:55 +02:00
|
|
|
class MDString;
|
2010-11-10 23:19:21 +01:00
|
|
|
class NamedMDNode;
|
2009-12-31 04:02:08 +01:00
|
|
|
class LLVMContext;
|
2010-05-07 17:30:29 +02:00
|
|
|
class raw_ostream;
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2010-08-03 00:51:46 +02:00
|
|
|
class DIFile;
|
|
|
|
class DISubprogram;
|
|
|
|
class DILexicalBlock;
|
2011-10-12 00:59:11 +02:00
|
|
|
class DILexicalBlockFile;
|
2010-08-03 00:51:46 +02:00
|
|
|
class DIVariable;
|
|
|
|
class DIType;
|
2012-02-06 18:49:43 +01:00
|
|
|
class DIObjCProperty;
|
2010-08-03 00:51:46 +02:00
|
|
|
|
2009-12-29 10:15:46 +01:00
|
|
|
/// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
|
2012-05-08 20:55:57 +02:00
|
|
|
/// This should not be stored in a container, because the underlying MDNode
|
|
|
|
/// may change in certain situations.
|
2008-11-10 03:56:27 +01:00
|
|
|
class DIDescriptor {
|
2010-09-29 23:04:46 +02:00
|
|
|
public:
|
|
|
|
enum {
|
2011-05-12 21:06:16 +02:00
|
|
|
FlagPrivate = 1 << 0,
|
|
|
|
FlagProtected = 1 << 1,
|
|
|
|
FlagFwdDecl = 1 << 2,
|
|
|
|
FlagAppleBlock = 1 << 3,
|
|
|
|
FlagBlockByrefStruct = 1 << 4,
|
|
|
|
FlagVirtual = 1 << 5,
|
|
|
|
FlagArtificial = 1 << 6,
|
|
|
|
FlagExplicit = 1 << 7,
|
|
|
|
FlagPrototyped = 1 << 8,
|
2012-09-13 01:36:19 +02:00
|
|
|
FlagObjcClassComplete = 1 << 9,
|
2013-01-08 02:53:52 +01:00
|
|
|
FlagObjectPointer = 1 << 10,
|
2013-01-16 02:22:23 +01:00
|
|
|
FlagVector = 1 << 11,
|
2013-06-19 23:52:48 +02:00
|
|
|
FlagStaticMember = 1 << 12,
|
|
|
|
FlagIndirectVariable = 1 << 13
|
2010-09-29 23:04:46 +02:00
|
|
|
};
|
2009-09-19 22:40:05 +02:00
|
|
|
protected:
|
2010-05-07 22:54:48 +02:00
|
|
|
const MDNode *DbgNode;
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2009-11-25 18:36:49 +01:00
|
|
|
StringRef getStringField(unsigned Elt) const;
|
2008-11-10 03:56:27 +01:00
|
|
|
unsigned getUnsignedField(unsigned Elt) const {
|
|
|
|
return (unsigned)getUInt64Field(Elt);
|
|
|
|
}
|
|
|
|
uint64_t getUInt64Field(unsigned Elt) const;
|
2012-12-03 20:44:25 +01:00
|
|
|
int64_t getInt64Field(unsigned Elt) const;
|
2008-11-10 03:56:27 +01:00
|
|
|
DIDescriptor getDescriptorField(unsigned Elt) const;
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
template <typename DescTy>
|
|
|
|
DescTy getFieldAs(unsigned Elt) const {
|
2010-05-07 20:36:34 +02:00
|
|
|
return DescTy(getDescriptorField(Elt));
|
2008-11-10 03:56:27 +01:00
|
|
|
}
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
GlobalVariable *getGlobalVariableField(unsigned Elt) const;
|
2010-08-09 23:39:24 +02:00
|
|
|
Constant *getConstantField(unsigned Elt) const;
|
2010-06-11 22:08:44 +02:00
|
|
|
Function *getFunctionField(unsigned Elt) const;
|
2012-10-09 10:13:15 +02:00
|
|
|
void replaceFunctionField(unsigned Elt, Function *F);
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
public:
|
2013-07-24 03:21:02 +02:00
|
|
|
explicit DIDescriptor(const MDNode *N = 0) : DbgNode(N) {}
|
2008-11-10 03:56:27 +01:00
|
|
|
|
2013-03-12 00:39:23 +01:00
|
|
|
bool Verify() const;
|
2008-11-10 03:56:27 +01:00
|
|
|
|
2010-05-07 22:54:48 +02:00
|
|
|
operator MDNode *() const { return const_cast<MDNode*>(DbgNode); }
|
|
|
|
MDNode *operator ->() const { return const_cast<MDNode*>(DbgNode); }
|
2009-01-05 19:06:21 +01:00
|
|
|
|
2013-07-18 00:53:05 +02:00
|
|
|
// An explicit operator bool so that we can do testing of DI values
|
|
|
|
// easily.
|
|
|
|
// FIXME: This operator bool isn't actually protecting anything at the
|
|
|
|
// moment due to the conversion operator above making DIDescriptor nodes
|
2013-07-18 02:23:50 +02:00
|
|
|
// implicitly convertable to bool.
|
2013-07-18 00:53:05 +02:00
|
|
|
LLVM_EXPLICIT operator bool() const { return DbgNode != 0; }
|
|
|
|
|
2013-07-18 01:25:22 +02:00
|
|
|
bool operator==(DIDescriptor Other) const {
|
2013-07-18 21:11:41 +02:00
|
|
|
return DbgNode == Other.DbgNode;
|
2013-07-18 01:25:22 +02:00
|
|
|
}
|
|
|
|
bool operator!=(DIDescriptor Other) const {
|
|
|
|
return !operator==(Other);
|
|
|
|
}
|
|
|
|
|
2013-08-08 03:41:00 +02:00
|
|
|
uint16_t getTag() const {
|
2009-01-20 20:22:03 +01:00
|
|
|
return getUnsignedField(0) & ~LLVMDebugVersionMask;
|
2009-01-05 19:06:21 +01:00
|
|
|
}
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2009-08-31 20:49:10 +02:00
|
|
|
bool isDerivedType() const;
|
|
|
|
bool isCompositeType() const;
|
|
|
|
bool isBasicType() const;
|
|
|
|
bool isVariable() const;
|
|
|
|
bool isSubprogram() const;
|
|
|
|
bool isGlobalVariable() const;
|
2009-08-31 22:44:45 +02:00
|
|
|
bool isScope() const;
|
2010-03-08 23:27:22 +01:00
|
|
|
bool isFile() const;
|
2009-08-31 23:34:44 +02:00
|
|
|
bool isCompileUnit() const;
|
2009-12-15 20:16:48 +01:00
|
|
|
bool isNameSpace() const;
|
2011-10-12 00:59:11 +02:00
|
|
|
bool isLexicalBlockFile() const;
|
2009-09-01 00:00:15 +02:00
|
|
|
bool isLexicalBlock() const;
|
2009-10-01 00:34:41 +02:00
|
|
|
bool isSubrange() const;
|
|
|
|
bool isEnumerator() const;
|
|
|
|
bool isType() const;
|
2010-10-06 22:50:40 +02:00
|
|
|
bool isUnspecifiedParameter() const;
|
2011-02-02 22:38:25 +01:00
|
|
|
bool isTemplateTypeParameter() const;
|
2011-02-02 23:35:53 +01:00
|
|
|
bool isTemplateValueParameter() const;
|
2012-02-04 01:59:25 +01:00
|
|
|
bool isObjCProperty() const;
|
2013-05-07 23:35:53 +02:00
|
|
|
bool isImportedEntity() const;
|
2012-06-27 00:57:33 +02:00
|
|
|
|
|
|
|
/// print - print descriptor.
|
|
|
|
void print(raw_ostream &OS) const;
|
|
|
|
|
|
|
|
/// dump - print descriptor to dbgs() with a newline.
|
|
|
|
void dump() const;
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2009-01-05 19:33:01 +01:00
|
|
|
/// DISubrange - This is used to represent ranges, for array bounds.
|
|
|
|
class DISubrange : public DIDescriptor {
|
2012-06-27 00:57:33 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2009-01-05 19:33:01 +01:00
|
|
|
public:
|
2010-05-07 22:54:48 +02:00
|
|
|
explicit DISubrange(const MDNode *N = 0) : DIDescriptor(N) {}
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2012-12-06 08:38:10 +01:00
|
|
|
int64_t getLo() const { return getInt64Field(1); }
|
2012-12-04 22:34:03 +01:00
|
|
|
int64_t getCount() const { return getInt64Field(2); }
|
2013-03-12 00:39:23 +01:00
|
|
|
bool Verify() const;
|
2009-01-05 19:33:01 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
/// DIArray - This descriptor holds an array of descriptors.
|
|
|
|
class DIArray : public DIDescriptor {
|
|
|
|
public:
|
2013-07-24 03:21:02 +02:00
|
|
|
explicit DIArray(const MDNode *N = 0) : DIDescriptor(N) {}
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
unsigned getNumElements() const;
|
2009-01-05 20:55:07 +01:00
|
|
|
DIDescriptor getElement(unsigned Idx) const {
|
|
|
|
return getDescriptorField(Idx);
|
2009-01-05 19:33:01 +01:00
|
|
|
}
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2013-07-24 00:29:19 +02:00
|
|
|
/// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
|
|
|
|
/// FIXME: it seems strange that this doesn't have either a reference to the
|
|
|
|
/// type/precision or a file/line pair for location info.
|
|
|
|
class DIEnumerator : public DIDescriptor {
|
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
|
|
|
public:
|
|
|
|
explicit DIEnumerator(const MDNode *N = 0) : DIDescriptor(N) {}
|
|
|
|
|
|
|
|
StringRef getName() const { return getStringField(1); }
|
|
|
|
int64_t getEnumValue() const { return getInt64Field(2); }
|
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
2009-08-31 22:44:45 +02:00
|
|
|
/// DIScope - A base class for various scopes.
|
|
|
|
class DIScope : public DIDescriptor {
|
2012-06-27 00:57:33 +02:00
|
|
|
protected:
|
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2009-08-31 22:44:45 +02:00
|
|
|
public:
|
2010-05-07 22:54:48 +02:00
|
|
|
explicit DIScope(const MDNode *N = 0) : DIDescriptor (N) {}
|
2009-09-01 02:53:21 +02:00
|
|
|
|
2013-07-26 19:02:36 +02:00
|
|
|
/// Gets the parent scope for this scope node or returns a
|
|
|
|
/// default constructed scope.
|
|
|
|
DIScope getContext() const;
|
2009-11-25 18:36:49 +01:00
|
|
|
StringRef getFilename() const;
|
|
|
|
StringRef getDirectory() const;
|
2009-08-31 22:44:45 +02:00
|
|
|
};
|
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
/// DIType - This is a wrapper for a type.
|
|
|
|
/// FIXME: Types should be factored much better so that CV qualifiers and
|
|
|
|
/// others do not require a huge and empty descriptor full of zeros.
|
2010-03-08 23:02:50 +01:00
|
|
|
class DIType : public DIScope {
|
2008-11-10 03:56:27 +01:00
|
|
|
protected:
|
2012-06-27 00:57:33 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2013-07-24 02:13:02 +02:00
|
|
|
|
2009-01-15 20:26:23 +01:00
|
|
|
public:
|
2013-07-24 03:06:21 +02:00
|
|
|
DIType(const MDNode *N = 0) : DIScope(N) {}
|
|
|
|
|
2009-01-20 00:21:49 +01:00
|
|
|
/// Verify - Verify that a type descriptor is well formed.
|
|
|
|
bool Verify() const;
|
2009-01-05 23:35:52 +01:00
|
|
|
|
2013-03-28 03:44:59 +01:00
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(2); }
|
|
|
|
StringRef getName() const { return getStringField(3); }
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(4); }
|
|
|
|
uint64_t getSizeInBits() const { return getUInt64Field(5); }
|
|
|
|
uint64_t getAlignInBits() const { return getUInt64Field(6); }
|
2008-11-10 03:56:27 +01:00
|
|
|
// FIXME: Offset is only used for DW_TAG_member nodes. Making every type
|
|
|
|
// carry this is just plain insane.
|
2013-03-28 03:44:59 +01:00
|
|
|
uint64_t getOffsetInBits() const { return getUInt64Field(7); }
|
|
|
|
unsigned getFlags() const { return getUnsignedField(8); }
|
2009-08-26 06:21:30 +02:00
|
|
|
bool isPrivate() const {
|
2009-09-19 22:40:05 +02:00
|
|
|
return (getFlags() & FlagPrivate) != 0;
|
2009-07-27 22:30:05 +02:00
|
|
|
}
|
2009-08-26 06:21:30 +02:00
|
|
|
bool isProtected() const {
|
2009-09-19 22:40:05 +02:00
|
|
|
return (getFlags() & FlagProtected) != 0;
|
2009-07-27 22:30:05 +02:00
|
|
|
}
|
2009-08-26 06:21:30 +02:00
|
|
|
bool isForwardDecl() const {
|
2009-09-19 22:40:05 +02:00
|
|
|
return (getFlags() & FlagFwdDecl) != 0;
|
2009-07-27 22:30:05 +02:00
|
|
|
}
|
2009-08-28 01:51:51 +02:00
|
|
|
// isAppleBlock - Return true if this is the Apple Blocks extension.
|
|
|
|
bool isAppleBlockExtension() const {
|
2009-09-19 22:40:05 +02:00
|
|
|
return (getFlags() & FlagAppleBlock) != 0;
|
2009-08-26 02:39:50 +02:00
|
|
|
}
|
2009-08-31 23:19:37 +02:00
|
|
|
bool isBlockByrefStruct() const {
|
|
|
|
return (getFlags() & FlagBlockByrefStruct) != 0;
|
|
|
|
}
|
2009-12-03 20:11:07 +01:00
|
|
|
bool isVirtual() const {
|
|
|
|
return (getFlags() & FlagVirtual) != 0;
|
|
|
|
}
|
2010-02-06 02:02:37 +01:00
|
|
|
bool isArtificial() const {
|
|
|
|
return (getFlags() & FlagArtificial) != 0;
|
|
|
|
}
|
2012-09-13 01:36:19 +02:00
|
|
|
bool isObjectPointer() const {
|
|
|
|
return (getFlags() & FlagObjectPointer) != 0;
|
|
|
|
}
|
2011-05-12 23:29:42 +02:00
|
|
|
bool isObjcClassComplete() const {
|
|
|
|
return (getFlags() & FlagObjcClassComplete) != 0;
|
2011-05-12 21:06:16 +02:00
|
|
|
}
|
2013-01-08 02:53:52 +01:00
|
|
|
bool isVector() const {
|
|
|
|
return (getFlags() & FlagVector) != 0;
|
|
|
|
}
|
2013-01-16 02:22:23 +01:00
|
|
|
bool isStaticMember() const {
|
|
|
|
return (getFlags() & FlagStaticMember) != 0;
|
|
|
|
}
|
2010-03-08 21:52:55 +01:00
|
|
|
bool isValid() const {
|
2013-05-29 19:33:31 +02:00
|
|
|
return DbgNode && isType();
|
2010-03-08 21:52:55 +01:00
|
|
|
}
|
2010-05-07 17:30:29 +02:00
|
|
|
|
2011-08-15 19:57:41 +02:00
|
|
|
/// isUnsignedDIType - Return true if type encoding is unsigned.
|
|
|
|
bool isUnsignedDIType();
|
|
|
|
|
2010-08-21 00:02:26 +02:00
|
|
|
/// replaceAllUsesWith - Replace all uses of debug info referenced by
|
|
|
|
/// this descriptor.
|
|
|
|
void replaceAllUsesWith(DIDescriptor &D);
|
2010-12-08 21:18:20 +01:00
|
|
|
void replaceAllUsesWith(MDNode *D);
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
/// DIBasicType - A basic type, like 'int' or 'float'.
|
|
|
|
class DIBasicType : public DIType {
|
|
|
|
public:
|
2010-05-07 22:54:48 +02:00
|
|
|
explicit DIBasicType(const MDNode *N = 0) : DIType(N) {}
|
2009-05-14 20:26:15 +02:00
|
|
|
|
2013-03-28 03:44:59 +01:00
|
|
|
unsigned getEncoding() const { return getUnsignedField(9); }
|
2009-01-30 02:03:10 +01:00
|
|
|
|
2010-08-23 20:25:56 +02:00
|
|
|
/// Verify - Verify that a basic type descriptor is well formed.
|
|
|
|
bool Verify() const;
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
/// DIDerivedType - A simple derived type, like a const qualified type,
|
2013-01-16 02:22:23 +01:00
|
|
|
/// a typedef, a pointer or reference, et cetera. Or, a data member of
|
|
|
|
/// a class/struct/union.
|
2008-11-10 03:56:27 +01:00
|
|
|
class DIDerivedType : public DIType {
|
2012-06-27 00:57:33 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2013-07-24 02:13:02 +02:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
public:
|
2013-07-24 03:21:02 +02:00
|
|
|
explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
|
2009-05-14 20:26:15 +02:00
|
|
|
|
2013-03-28 03:44:59 +01:00
|
|
|
DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
|
2009-01-30 02:03:10 +01:00
|
|
|
|
2009-02-17 22:23:59 +01:00
|
|
|
/// getOriginalTypeSize - If this type is derived from a base type then
|
|
|
|
/// return base type size.
|
|
|
|
uint64_t getOriginalTypeSize() const;
|
2010-05-07 17:30:29 +02:00
|
|
|
|
2012-11-20 01:15:36 +01:00
|
|
|
/// getObjCProperty - Return property node, if this ivar is
|
2012-02-06 18:49:43 +01:00
|
|
|
/// associated with one.
|
|
|
|
MDNode *getObjCProperty() const;
|
|
|
|
|
2013-01-07 06:51:15 +01:00
|
|
|
DIType getClassType() const {
|
|
|
|
assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
|
2013-03-28 03:44:59 +01:00
|
|
|
return getFieldAs<DIType>(10);
|
2013-01-07 06:51:15 +01:00
|
|
|
}
|
|
|
|
|
2013-01-16 02:22:23 +01:00
|
|
|
Constant *getConstant() const {
|
|
|
|
assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
|
2013-03-28 03:44:59 +01:00
|
|
|
return getConstantField(10);
|
2013-01-16 02:22:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-23 20:25:56 +02:00
|
|
|
/// Verify - Verify that a derived type descriptor is well formed.
|
|
|
|
bool Verify() const;
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/// DICompositeType - This descriptor holds a type that can refer to multiple
|
|
|
|
/// other types, like a function or struct.
|
2013-04-19 21:56:02 +02:00
|
|
|
/// DICompositeType is derived from DIDerivedType because some
|
|
|
|
/// composite types (such as enums) can be derived from basic types
|
|
|
|
// FIXME: Make this derive from DIType directly & just store the
|
|
|
|
// base type in a single DIType field.
|
2008-11-10 03:56:27 +01:00
|
|
|
class DICompositeType : public DIDerivedType {
|
2012-06-27 00:57:33 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2008-11-10 03:56:27 +01:00
|
|
|
public:
|
2013-07-24 03:21:02 +02:00
|
|
|
explicit DICompositeType(const MDNode *N = 0) : DIDerivedType(N) {}
|
2009-05-14 20:26:15 +02:00
|
|
|
|
2013-03-28 03:44:59 +01:00
|
|
|
DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
|
2013-03-26 22:59:17 +01:00
|
|
|
void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
|
2013-08-16 22:42:14 +02:00
|
|
|
void addMember(DIDescriptor D);
|
2013-03-28 03:44:59 +01:00
|
|
|
unsigned getRunTimeLang() const { return getUnsignedField(11); }
|
2010-01-26 22:14:59 +01:00
|
|
|
DICompositeType getContainingType() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return getFieldAs<DICompositeType>(12);
|
2010-01-26 22:14:59 +01:00
|
|
|
}
|
2013-03-27 00:46:36 +01:00
|
|
|
void setContainingType(DICompositeType ContainingType);
|
2013-03-28 03:44:59 +01:00
|
|
|
DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); }
|
2013-08-27 00:39:55 +02:00
|
|
|
MDString *getIdentifier() const;
|
2009-01-20 00:21:49 +01:00
|
|
|
|
|
|
|
/// Verify - Verify that a composite type descriptor is well formed.
|
|
|
|
bool Verify() const;
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2013-07-24 00:29:19 +02:00
|
|
|
/// DIFile - This is a wrapper for a file.
|
|
|
|
class DIFile : public DIScope {
|
|
|
|
friend class DIDescriptor;
|
2011-02-02 22:38:25 +01:00
|
|
|
public:
|
2013-07-24 02:36:11 +02:00
|
|
|
explicit DIFile(const MDNode *N = 0) : DIScope(N) {}
|
2013-07-24 00:29:19 +02:00
|
|
|
MDNode *getFileNode() const;
|
2013-03-12 00:39:23 +01:00
|
|
|
bool Verify() const;
|
2011-02-02 22:38:25 +01:00
|
|
|
};
|
|
|
|
|
2013-07-24 00:29:19 +02:00
|
|
|
/// DICompileUnit - A wrapper for a compile unit.
|
|
|
|
class DICompileUnit : public DIScope {
|
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2011-02-02 23:35:53 +01:00
|
|
|
public:
|
2013-07-24 00:29:19 +02:00
|
|
|
explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
|
2011-02-02 23:35:53 +01:00
|
|
|
|
2013-07-24 00:29:19 +02:00
|
|
|
unsigned getLanguage() const { return getUnsignedField(2); }
|
|
|
|
StringRef getProducer() const { return getStringField(3); }
|
|
|
|
|
|
|
|
bool isOptimized() const { return getUnsignedField(4) != 0; }
|
|
|
|
StringRef getFlags() const { return getStringField(5); }
|
|
|
|
unsigned getRunTimeVersion() const { return getUnsignedField(6); }
|
|
|
|
|
|
|
|
DIArray getEnumTypes() const;
|
|
|
|
DIArray getRetainedTypes() const;
|
|
|
|
DIArray getSubprograms() const;
|
|
|
|
DIArray getGlobalVariables() const;
|
|
|
|
DIArray getImportedEntities() const;
|
|
|
|
|
|
|
|
StringRef getSplitDebugFilename() const { return getStringField(12); }
|
|
|
|
|
|
|
|
/// Verify - Verify that a compile unit is well formed.
|
2013-03-12 00:39:23 +01:00
|
|
|
bool Verify() const;
|
2011-02-02 23:35:53 +01:00
|
|
|
};
|
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
/// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
|
2009-09-01 00:47:13 +02:00
|
|
|
class DISubprogram : public DIScope {
|
2012-06-27 00:57:33 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2008-11-10 03:56:27 +01:00
|
|
|
public:
|
2010-05-07 22:54:48 +02:00
|
|
|
explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {}
|
2009-05-14 20:26:15 +02:00
|
|
|
|
2013-03-28 03:44:59 +01:00
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(2); }
|
|
|
|
StringRef getName() const { return getStringField(3); }
|
|
|
|
StringRef getDisplayName() const { return getStringField(4); }
|
|
|
|
StringRef getLinkageName() const { return getStringField(5); }
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(6); }
|
|
|
|
DICompositeType getType() const { return getFieldAs<DICompositeType>(7); }
|
2009-01-20 00:21:49 +01:00
|
|
|
|
2009-09-01 00:47:13 +02:00
|
|
|
/// isLocalToUnit - Return true if this subprogram is local to the current
|
|
|
|
/// compile unit, like 'static' in C.
|
2013-03-28 03:44:59 +01:00
|
|
|
unsigned isLocalToUnit() const { return getUnsignedField(8); }
|
|
|
|
unsigned isDefinition() const { return getUnsignedField(9); }
|
2009-12-03 20:11:07 +01:00
|
|
|
|
2013-03-28 03:44:59 +01:00
|
|
|
unsigned getVirtuality() const { return getUnsignedField(10); }
|
|
|
|
unsigned getVirtualIndex() const { return getUnsignedField(11); }
|
2009-12-03 20:11:07 +01:00
|
|
|
|
|
|
|
DICompositeType getContainingType() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return getFieldAs<DICompositeType>(12);
|
2009-12-03 20:11:07 +01:00
|
|
|
}
|
2012-04-03 02:43:49 +02:00
|
|
|
|
2013-02-18 09:04:16 +01:00
|
|
|
unsigned getFlags() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return getUnsignedField(13);
|
2013-02-18 09:04:16 +01:00
|
|
|
}
|
|
|
|
|
2012-11-20 01:15:36 +01:00
|
|
|
unsigned isArtificial() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return (getUnsignedField(13) & FlagArtificial) != 0;
|
2010-09-29 23:04:46 +02:00
|
|
|
}
|
2010-09-29 23:44:16 +02:00
|
|
|
/// isPrivate - Return true if this subprogram has "private"
|
|
|
|
/// access specifier.
|
2012-11-20 01:15:36 +01:00
|
|
|
bool isPrivate() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return (getUnsignedField(13) & FlagPrivate) != 0;
|
2010-09-29 23:44:16 +02:00
|
|
|
}
|
|
|
|
/// isProtected - Return true if this subprogram has "protected"
|
|
|
|
/// access specifier.
|
2012-11-20 01:15:36 +01:00
|
|
|
bool isProtected() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return (getUnsignedField(13) & FlagProtected) != 0;
|
2010-09-29 23:44:16 +02:00
|
|
|
}
|
2010-10-02 01:31:40 +02:00
|
|
|
/// isExplicit - Return true if this subprogram is marked as explicit.
|
2012-11-20 01:15:36 +01:00
|
|
|
bool isExplicit() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return (getUnsignedField(13) & FlagExplicit) != 0;
|
2010-10-02 01:31:40 +02:00
|
|
|
}
|
2010-10-08 00:03:01 +02:00
|
|
|
/// isPrototyped - Return true if this subprogram is prototyped.
|
2012-11-20 01:15:36 +01:00
|
|
|
bool isPrototyped() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return (getUnsignedField(13) & FlagPrototyped) != 0;
|
2010-10-08 00:03:01 +02:00
|
|
|
}
|
2010-10-02 01:31:40 +02:00
|
|
|
|
2010-04-30 21:38:23 +02:00
|
|
|
unsigned isOptimized() const;
|
2009-12-03 20:11:07 +01:00
|
|
|
|
2009-01-20 00:21:49 +01:00
|
|
|
/// Verify - Verify that a subprogram descriptor is well formed.
|
|
|
|
bool Verify() const;
|
2009-01-30 02:03:10 +01:00
|
|
|
|
2009-04-15 02:06:07 +02:00
|
|
|
/// describes - Return true if this subprogram provides debugging
|
|
|
|
/// information for the function F.
|
|
|
|
bool describes(const Function *F);
|
2010-06-11 22:08:44 +02:00
|
|
|
|
2013-03-28 03:44:59 +01:00
|
|
|
Function *getFunction() const { return getFunctionField(15); }
|
|
|
|
void replaceFunction(Function *F) { replaceFunctionField(15, F); }
|
|
|
|
DIArray getTemplateParams() const { return getFieldAs<DIArray>(16); }
|
2011-04-23 01:10:17 +02:00
|
|
|
DISubprogram getFunctionDeclaration() const {
|
2013-03-28 03:44:59 +01:00
|
|
|
return getFieldAs<DISubprogram>(17);
|
2011-04-23 01:10:17 +02:00
|
|
|
}
|
2011-08-20 01:28:12 +02:00
|
|
|
MDNode *getVariablesNodes() const;
|
|
|
|
DIArray getVariables() const;
|
2013-05-29 04:05:07 +02:00
|
|
|
|
|
|
|
/// getScopeLineNumber - Get the beginning of the scope of the
|
|
|
|
/// function, not necessarily where the name of the program
|
|
|
|
/// starts.
|
|
|
|
unsigned getScopeLineNumber() const { return getUnsignedField(19); }
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2013-07-24 00:29:19 +02:00
|
|
|
/// DILexicalBlock - This is a wrapper for a lexical block.
|
|
|
|
class DILexicalBlock : public DIScope {
|
|
|
|
public:
|
|
|
|
explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
|
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(2); }
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(3); }
|
|
|
|
unsigned getColumnNumber() const { return getUnsignedField(4); }
|
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// DILexicalBlockFile - This is a wrapper for a lexical block with
|
|
|
|
/// a filename change.
|
|
|
|
class DILexicalBlockFile : public DIScope {
|
|
|
|
public:
|
|
|
|
explicit DILexicalBlockFile(const MDNode *N = 0) : DIScope(N) {}
|
|
|
|
DIScope getContext() const {
|
|
|
|
if (getScope().isSubprogram())
|
|
|
|
return getScope();
|
|
|
|
return getScope().getContext();
|
|
|
|
}
|
|
|
|
unsigned getLineNumber() const { return getScope().getLineNumber(); }
|
|
|
|
unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
|
|
|
|
DILexicalBlock getScope() const { return getFieldAs<DILexicalBlock>(2); }
|
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// DINameSpace - A wrapper for a C++ style name space.
|
|
|
|
class DINameSpace : public DIScope {
|
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
|
|
|
public:
|
|
|
|
explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
|
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(2); }
|
|
|
|
StringRef getName() const { return getStringField(3); }
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(4); }
|
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// DITemplateTypeParameter - This is a wrapper for template type parameter.
|
|
|
|
class DITemplateTypeParameter : public DIDescriptor {
|
|
|
|
public:
|
|
|
|
explicit DITemplateTypeParameter(const MDNode *N = 0) : DIDescriptor(N) {}
|
|
|
|
|
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
|
|
|
StringRef getName() const { return getStringField(2); }
|
|
|
|
DIType getType() const { return getFieldAs<DIType>(3); }
|
|
|
|
StringRef getFilename() const {
|
|
|
|
return getFieldAs<DIFile>(4).getFilename();
|
|
|
|
}
|
|
|
|
StringRef getDirectory() const {
|
|
|
|
return getFieldAs<DIFile>(4).getDirectory();
|
|
|
|
}
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(5); }
|
|
|
|
unsigned getColumnNumber() const { return getUnsignedField(6); }
|
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// DITemplateValueParameter - This is a wrapper for template value parameter.
|
|
|
|
class DITemplateValueParameter : public DIDescriptor {
|
|
|
|
public:
|
|
|
|
explicit DITemplateValueParameter(const MDNode *N = 0) : DIDescriptor(N) {}
|
|
|
|
|
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
|
|
|
StringRef getName() const { return getStringField(2); }
|
|
|
|
DIType getType() const { return getFieldAs<DIType>(3); }
|
|
|
|
Value *getValue() const;
|
|
|
|
StringRef getFilename() const {
|
|
|
|
return getFieldAs<DIFile>(5).getFilename();
|
|
|
|
}
|
|
|
|
StringRef getDirectory() const {
|
|
|
|
return getFieldAs<DIFile>(5).getDirectory();
|
|
|
|
}
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(6); }
|
|
|
|
unsigned getColumnNumber() const { return getUnsignedField(7); }
|
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
/// DIGlobalVariable - This is a wrapper for a global variable.
|
2010-05-08 01:19:07 +02:00
|
|
|
class DIGlobalVariable : public DIDescriptor {
|
2012-06-27 00:57:33 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2008-11-10 03:56:27 +01:00
|
|
|
public:
|
2010-05-08 01:19:07 +02:00
|
|
|
explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
|
|
|
|
|
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(2); }
|
|
|
|
StringRef getName() const { return getStringField(3); }
|
|
|
|
StringRef getDisplayName() const { return getStringField(4); }
|
|
|
|
StringRef getLinkageName() const { return getStringField(5); }
|
2011-09-26 19:40:42 +02:00
|
|
|
StringRef getFilename() const {
|
|
|
|
return getFieldAs<DIFile>(6).getFilename();
|
2012-11-20 01:15:36 +01:00
|
|
|
}
|
2011-09-26 19:40:42 +02:00
|
|
|
StringRef getDirectory() const {
|
|
|
|
return getFieldAs<DIFile>(6).getDirectory();
|
|
|
|
|
2012-11-20 01:15:36 +01:00
|
|
|
}
|
2010-05-08 01:19:07 +02:00
|
|
|
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(7); }
|
|
|
|
DIType getType() const { return getFieldAs<DIType>(8); }
|
|
|
|
unsigned isLocalToUnit() const { return getUnsignedField(9); }
|
|
|
|
unsigned isDefinition() const { return getUnsignedField(10); }
|
2009-05-14 20:26:15 +02:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
|
2010-08-09 23:39:24 +02:00
|
|
|
Constant *getConstant() const { return getConstantField(11); }
|
2013-01-16 02:22:23 +01:00
|
|
|
DIDerivedType getStaticDataMemberDeclaration() const {
|
|
|
|
return getFieldAs<DIDerivedType>(12);
|
|
|
|
}
|
2009-01-20 00:21:49 +01:00
|
|
|
|
|
|
|
/// Verify - Verify that a global variable descriptor is well formed.
|
|
|
|
bool Verify() const;
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2008-11-10 03:56:27 +01:00
|
|
|
/// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
|
|
|
|
/// global etc).
|
|
|
|
class DIVariable : public DIDescriptor {
|
2012-06-27 00:57:33 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2008-11-10 03:56:27 +01:00
|
|
|
public:
|
2013-07-24 03:21:02 +02:00
|
|
|
explicit DIVariable(const MDNode *N = 0) : DIDescriptor(N) {}
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2010-03-08 23:02:50 +01:00
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
|
|
|
StringRef getName() const { return getStringField(2); }
|
2012-12-12 15:31:53 +01:00
|
|
|
DIFile getFile() const { return getFieldAs<DIFile>(3); }
|
2012-11-20 01:15:36 +01:00
|
|
|
unsigned getLineNumber() const {
|
|
|
|
return (getUnsignedField(4) << 8) >> 8;
|
2011-03-01 23:58:13 +01:00
|
|
|
}
|
|
|
|
unsigned getArgNumber() const {
|
2012-11-20 01:15:36 +01:00
|
|
|
unsigned L = getUnsignedField(4);
|
2011-03-01 23:58:13 +01:00
|
|
|
return L >> 24;
|
|
|
|
}
|
2008-11-10 03:56:27 +01:00
|
|
|
DIType getType() const { return getFieldAs<DIType>(5); }
|
2012-11-20 01:15:36 +01:00
|
|
|
|
2010-09-30 01:07:21 +02:00
|
|
|
/// isArtificial - Return true if this variable is marked as "artificial".
|
2012-11-20 01:15:36 +01:00
|
|
|
bool isArtificial() const {
|
2010-09-30 01:07:21 +02:00
|
|
|
return (getUnsignedField(6) & FlagArtificial) != 0;
|
|
|
|
}
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2012-09-13 01:36:19 +02:00
|
|
|
bool isObjectPointer() const {
|
|
|
|
return (getUnsignedField(6) & FlagObjectPointer) != 0;
|
|
|
|
}
|
|
|
|
|
2013-06-19 23:52:48 +02:00
|
|
|
/// \brief Return true if this variable is represented as a pointer.
|
|
|
|
bool isIndirect() const {
|
|
|
|
return (getUnsignedField(6) & FlagIndirectVariable) != 0;
|
|
|
|
}
|
|
|
|
|
2011-07-21 00:18:50 +02:00
|
|
|
/// getInlinedAt - If this variable is inlined then return inline location.
|
2011-08-09 03:03:14 +02:00
|
|
|
MDNode *getInlinedAt() const;
|
2009-01-20 00:21:49 +01:00
|
|
|
|
|
|
|
/// Verify - Verify that a variable descriptor is well formed.
|
|
|
|
bool Verify() const;
|
2009-01-30 02:03:10 +01:00
|
|
|
|
2009-09-30 02:08:22 +02:00
|
|
|
/// HasComplexAddr - Return true if the variable has a complex address.
|
|
|
|
bool hasComplexAddress() const {
|
|
|
|
return getNumAddrElements() > 0;
|
|
|
|
}
|
|
|
|
|
2009-12-31 04:02:08 +01:00
|
|
|
unsigned getNumAddrElements() const;
|
2012-11-20 01:15:36 +01:00
|
|
|
|
2009-09-30 02:08:22 +02:00
|
|
|
uint64_t getAddrElement(unsigned Idx) const {
|
2011-07-19 21:41:54 +02:00
|
|
|
return getUInt64Field(Idx+8);
|
2009-09-30 02:08:22 +02:00
|
|
|
}
|
|
|
|
|
2009-08-31 23:19:37 +02:00
|
|
|
/// isBlockByrefVariable - Return true if the variable was declared as
|
|
|
|
/// a "__block" variable (Apple Blocks).
|
2009-09-19 22:40:05 +02:00
|
|
|
bool isBlockByrefVariable() const {
|
|
|
|
return getType().isBlockByrefStruct();
|
2009-08-31 23:19:37 +02:00
|
|
|
}
|
|
|
|
|
2013-01-25 21:47:58 +01:00
|
|
|
/// isInlinedFnArgument - Return true if this variable provides debugging
|
2010-04-29 22:48:12 +02:00
|
|
|
/// information for an inlined function arguments.
|
|
|
|
bool isInlinedFnArgument(const Function *CurFn);
|
|
|
|
|
2011-08-09 03:03:14 +02:00
|
|
|
void printExtendedName(raw_ostream &OS) const;
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2009-09-01 03:14:15 +02:00
|
|
|
/// DILocation - This object holds location information. This object
|
|
|
|
/// is not associated with any DWARF tag.
|
|
|
|
class DILocation : public DIDescriptor {
|
|
|
|
public:
|
2010-05-07 22:54:48 +02:00
|
|
|
explicit DILocation(const MDNode *N) : DIDescriptor(N) { }
|
2009-09-01 02:53:21 +02:00
|
|
|
|
2009-09-01 03:14:15 +02:00
|
|
|
unsigned getLineNumber() const { return getUnsignedField(0); }
|
|
|
|
unsigned getColumnNumber() const { return getUnsignedField(1); }
|
2009-09-29 20:40:58 +02:00
|
|
|
DIScope getScope() const { return getFieldAs<DIScope>(2); }
|
|
|
|
DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }
|
2009-11-25 18:36:49 +01:00
|
|
|
StringRef getFilename() const { return getScope().getFilename(); }
|
|
|
|
StringRef getDirectory() const { return getScope().getDirectory(); }
|
2010-03-08 21:52:55 +01:00
|
|
|
bool Verify() const;
|
2008-11-10 03:56:27 +01:00
|
|
|
};
|
2009-01-20 20:08:39 +01:00
|
|
|
|
2012-02-04 01:59:25 +01:00
|
|
|
class DIObjCProperty : public DIDescriptor {
|
2012-07-06 21:12:31 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
2012-02-04 01:59:25 +01:00
|
|
|
public:
|
|
|
|
explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) { }
|
|
|
|
|
|
|
|
StringRef getObjCPropertyName() const { return getStringField(1); }
|
2012-03-29 10:42:56 +02:00
|
|
|
DIFile getFile() const { return getFieldAs<DIFile>(2); }
|
|
|
|
unsigned getLineNumber() const { return getUnsignedField(3); }
|
|
|
|
|
2012-02-04 01:59:25 +01:00
|
|
|
StringRef getObjCPropertyGetterName() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return getStringField(4);
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
|
|
|
StringRef getObjCPropertySetterName() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return getStringField(5);
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
2013-06-07 20:53:29 +02:00
|
|
|
bool isReadOnlyObjCProperty() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
2013-06-07 20:53:29 +02:00
|
|
|
bool isReadWriteObjCProperty() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
2013-06-07 20:53:29 +02:00
|
|
|
bool isAssignObjCProperty() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
2013-06-07 20:53:29 +02:00
|
|
|
bool isRetainObjCProperty() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
2013-06-07 20:53:29 +02:00
|
|
|
bool isCopyObjCProperty() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
2013-06-07 20:53:29 +02:00
|
|
|
bool isNonAtomicObjCProperty() const {
|
2012-03-29 10:42:56 +02:00
|
|
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
|
2012-02-04 01:59:25 +01:00
|
|
|
}
|
|
|
|
|
2012-03-29 10:42:56 +02:00
|
|
|
DIType getType() const { return getFieldAs<DIType>(7); }
|
|
|
|
|
2012-02-04 01:59:25 +01:00
|
|
|
/// Verify - Verify that a derived type descriptor is well formed.
|
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
2013-04-22 08:12:31 +02:00
|
|
|
/// \brief An imported module (C++ using directive or similar).
|
2013-05-07 23:35:53 +02:00
|
|
|
class DIImportedEntity : public DIDescriptor {
|
2013-04-22 08:12:31 +02:00
|
|
|
friend class DIDescriptor;
|
|
|
|
void printInternal(raw_ostream &OS) const;
|
|
|
|
public:
|
2013-05-07 23:35:53 +02:00
|
|
|
explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) { }
|
2013-04-22 08:12:31 +02:00
|
|
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
2013-05-07 23:35:53 +02:00
|
|
|
DIDescriptor getEntity() const { return getFieldAs<DIDescriptor>(2); }
|
2013-04-22 08:12:31 +02:00
|
|
|
unsigned getLineNumber() const { return getUnsignedField(3); }
|
2013-05-21 00:50:35 +02:00
|
|
|
StringRef getName() const { return getStringField(4); }
|
2013-04-22 08:12:31 +02:00
|
|
|
bool Verify() const;
|
|
|
|
};
|
|
|
|
|
2009-11-24 02:14:22 +01:00
|
|
|
/// getDISubprogram - Find subprogram that is enclosing this scope.
|
2010-05-07 22:54:48 +02:00
|
|
|
DISubprogram getDISubprogram(const MDNode *Scope);
|
2009-11-24 02:14:22 +01:00
|
|
|
|
2013-07-09 02:16:56 +02:00
|
|
|
/// getDICompositeType - Find underlying composite type.
|
|
|
|
DICompositeType getDICompositeType(DIType T);
|
|
|
|
|
2011-08-15 19:57:41 +02:00
|
|
|
/// isSubprogramContext - Return true if Context is either a subprogram
|
|
|
|
/// or another context nested inside a subprogram.
|
|
|
|
bool isSubprogramContext(const MDNode *Context);
|
|
|
|
|
2010-11-10 23:19:21 +01:00
|
|
|
/// getOrInsertFnSpecificMDNode - Return a NameMDNode that is suitable
|
|
|
|
/// to hold function specific information.
|
2011-08-20 01:28:12 +02:00
|
|
|
NamedMDNode *getOrInsertFnSpecificMDNode(Module &M, DISubprogram SP);
|
2010-11-10 23:19:21 +01:00
|
|
|
|
2012-11-20 01:15:36 +01:00
|
|
|
/// getFnSpecificMDNode - Return a NameMDNode, if available, that is
|
2010-11-10 23:19:21 +01:00
|
|
|
/// suitable to hold function specific information.
|
2011-08-20 01:28:12 +02:00
|
|
|
NamedMDNode *getFnSpecificMDNode(const Module &M, DISubprogram SP);
|
2010-11-10 23:19:21 +01:00
|
|
|
|
2011-07-19 21:41:54 +02:00
|
|
|
/// createInlinedVariable - Create a new inlined variable based on current
|
|
|
|
/// variable.
|
|
|
|
/// @param DV Current Variable.
|
|
|
|
/// @param InlinedScope Location at current variable is inlined.
|
|
|
|
DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
|
|
|
|
LLVMContext &VMContext);
|
|
|
|
|
2011-08-10 23:50:54 +02:00
|
|
|
/// cleanseInlinedVariable - Remove inlined scope from the variable.
|
|
|
|
DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
|
|
|
|
|
2013-08-06 21:38:43 +02:00
|
|
|
/// DebugInfoFinder tries to list all debug info MDNodes used in a module. To
|
2013-07-23 02:22:51 +02:00
|
|
|
/// list debug info MDNodes used by an instruction, DebugInfoFinder uses
|
2013-08-06 21:38:43 +02:00
|
|
|
/// processDeclare, processValue and processLocation to handle DbgDeclareInst,
|
|
|
|
/// DbgValueInst and DbgLoc attached to instructions. processModule will go
|
|
|
|
/// through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
|
|
|
|
/// used by the CUs.
|
2009-07-30 20:25:15 +02:00
|
|
|
class DebugInfoFinder {
|
2009-07-28 21:55:13 +02:00
|
|
|
public:
|
2009-07-30 20:25:15 +02:00
|
|
|
/// processModule - Process entire module and collect debug info
|
2009-07-28 21:55:13 +02:00
|
|
|
/// anchors.
|
2012-11-19 23:42:15 +01:00
|
|
|
void processModule(const Module &M);
|
2009-09-19 22:40:05 +02:00
|
|
|
|
2013-07-23 02:22:51 +02:00
|
|
|
/// processDeclare - Process DbgDeclareInst.
|
|
|
|
void processDeclare(const DbgDeclareInst *DDI);
|
|
|
|
/// Process DbgValueInst.
|
|
|
|
void processValue(const DbgValueInst *DVI);
|
2013-08-06 21:38:43 +02:00
|
|
|
/// processLocation - Process DILocation.
|
|
|
|
void processLocation(DILocation Loc);
|
2013-07-23 02:22:51 +02:00
|
|
|
|
|
|
|
/// Clear all lists.
|
|
|
|
void reset();
|
2009-07-28 21:55:13 +02:00
|
|
|
private:
|
2009-07-30 20:25:15 +02:00
|
|
|
/// processType - Process DIType.
|
|
|
|
void processType(DIType DT);
|
2009-07-28 21:55:13 +02:00
|
|
|
|
2009-10-08 00:04:08 +02:00
|
|
|
/// processLexicalBlock - Process DILexicalBlock.
|
|
|
|
void processLexicalBlock(DILexicalBlock LB);
|
|
|
|
|
|
|
|
/// processSubprogram - Process DISubprogram.
|
2009-07-30 20:25:15 +02:00
|
|
|
void processSubprogram(DISubprogram SP);
|
2009-07-28 21:55:13 +02:00
|
|
|
|
2013-07-22 22:28:53 +02:00
|
|
|
void processScope(DIScope Scope);
|
|
|
|
|
2009-07-28 21:55:13 +02:00
|
|
|
/// addCompileUnit - Add compile unit into CUs.
|
|
|
|
bool addCompileUnit(DICompileUnit CU);
|
2009-09-19 22:40:05 +02:00
|
|
|
|
2009-07-28 21:55:13 +02:00
|
|
|
/// addGlobalVariable - Add global variable into GVs.
|
|
|
|
bool addGlobalVariable(DIGlobalVariable DIG);
|
|
|
|
|
2011-11-09 19:53:37 +01:00
|
|
|
// addSubprogram - Add subprogram into SPs.
|
2009-07-28 21:55:13 +02:00
|
|
|
bool addSubprogram(DISubprogram SP);
|
|
|
|
|
2009-08-11 00:09:58 +02:00
|
|
|
/// addType - Add type into Tys.
|
|
|
|
bool addType(DIType DT);
|
|
|
|
|
2013-07-20 02:38:46 +02:00
|
|
|
bool addScope(DIScope Scope);
|
|
|
|
|
2009-07-28 21:55:13 +02:00
|
|
|
public:
|
2013-07-03 17:07:05 +02:00
|
|
|
typedef SmallVectorImpl<MDNode *>::const_iterator iterator;
|
2010-05-07 17:36:10 +02:00
|
|
|
iterator compile_unit_begin() const { return CUs.begin(); }
|
|
|
|
iterator compile_unit_end() const { return CUs.end(); }
|
|
|
|
iterator subprogram_begin() const { return SPs.begin(); }
|
|
|
|
iterator subprogram_end() const { return SPs.end(); }
|
|
|
|
iterator global_variable_begin() const { return GVs.begin(); }
|
|
|
|
iterator global_variable_end() const { return GVs.end(); }
|
|
|
|
iterator type_begin() const { return TYs.begin(); }
|
|
|
|
iterator type_end() const { return TYs.end(); }
|
2013-07-20 02:38:46 +02:00
|
|
|
iterator scope_begin() const { return Scopes.begin(); }
|
|
|
|
iterator scope_end() const { return Scopes.end(); }
|
2010-05-07 17:36:10 +02:00
|
|
|
|
|
|
|
unsigned compile_unit_count() const { return CUs.size(); }
|
|
|
|
unsigned global_variable_count() const { return GVs.size(); }
|
|
|
|
unsigned subprogram_count() const { return SPs.size(); }
|
|
|
|
unsigned type_count() const { return TYs.size(); }
|
2013-07-20 02:38:46 +02:00
|
|
|
unsigned scope_count() const { return Scopes.size(); }
|
2009-07-28 21:55:13 +02:00
|
|
|
|
|
|
|
private:
|
2009-08-29 01:24:31 +02:00
|
|
|
SmallVector<MDNode *, 8> CUs; // Compile Units
|
|
|
|
SmallVector<MDNode *, 8> SPs; // Subprograms
|
|
|
|
SmallVector<MDNode *, 8> GVs; // Global Variables;
|
|
|
|
SmallVector<MDNode *, 8> TYs; // Types
|
2013-07-20 02:38:46 +02:00
|
|
|
SmallVector<MDNode *, 8> Scopes; // Scopes
|
2009-08-29 01:24:31 +02:00
|
|
|
SmallPtrSet<MDNode *, 64> NodesSeen;
|
2009-07-28 21:55:13 +02:00
|
|
|
};
|
2008-11-10 03:56:27 +01:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|