};
/// \brief Base class for variables.
-///
-/// TODO: Hardcode to DW_TAG_variable.
class DIVariable : public DINode {
unsigned Line;
protected:
- DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
- unsigned Line, ArrayRef<Metadata *> Ops)
- : DINode(C, ID, Storage, Tag, Ops), Line(Line) {}
+ DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Line,
+ ArrayRef<Metadata *> Ops)
+ : DINode(C, ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line) {}
~DIVariable() = default;
public:
DIGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
bool IsLocalToUnit, bool IsDefinition,
ArrayRef<Metadata *> Ops)
- : DIVariable(C, DIGlobalVariableKind, Storage, dwarf::DW_TAG_variable,
- Line, Ops),
+ : DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops),
IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
~DIGlobalVariable() = default;
/// \brief Local variable.
///
-/// TODO: Split between arguments and otherwise.
-/// TODO: Use \c DW_TAG_variable instead of fake tags.
/// TODO: Split up flags.
class DILocalVariable : public DIVariable {
friend class LLVMContextImpl;
unsigned Arg;
unsigned Flags;
- DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Tag,
- unsigned Line, unsigned Arg, unsigned Flags,
- ArrayRef<Metadata *> Ops)
- : DIVariable(C, DILocalVariableKind, Storage, Tag, Line, Ops), Arg(Arg),
+ DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
+ unsigned Arg, unsigned Flags, ArrayRef<Metadata *> Ops)
+ : DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg),
Flags(Flags) {}
~DILocalVariable() = default;
- static DILocalVariable *getImpl(LLVMContext &Context, unsigned Tag,
- DIScope *Scope, StringRef Name, DIFile *File,
- unsigned Line, DITypeRef Type, unsigned Arg,
- unsigned Flags, StorageType Storage,
+ static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope,
+ StringRef Name, DIFile *File, unsigned Line,
+ DITypeRef Type, unsigned Arg, unsigned Flags,
+ StorageType Storage,
bool ShouldCreate = true) {
- return getImpl(Context, Tag, Scope, getCanonicalMDString(Context, Name),
- File, Line, Type, Arg, Flags, Storage, ShouldCreate);
+ return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
+ Line, Type, Arg, Flags, Storage, ShouldCreate);
}
- static DILocalVariable *
- getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
- Metadata *File, unsigned Line, Metadata *Type, unsigned Arg,
- unsigned Flags, StorageType Storage, bool ShouldCreate = true);
+ static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
+ MDString *Name, Metadata *File, unsigned Line,
+ Metadata *Type, unsigned Arg, unsigned Flags,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempDILocalVariable cloneImpl() const {
- return getTemporary(getContext(), getTag(), getScope(), getName(),
- getFile(), getLine(), getType(), getArg(), getFlags());
+ return getTemporary(getContext(), getScope(), getName(), getFile(),
+ getLine(), getType(), getArg(), getFlags());
}
public:
DEFINE_MDNODE_GET(DILocalVariable,
- (unsigned Tag, DILocalScope *Scope, StringRef Name,
- DIFile *File, unsigned Line, DITypeRef Type, unsigned Arg,
+ (DILocalScope * Scope, StringRef Name, DIFile *File,
+ unsigned Line, DITypeRef Type, unsigned Arg,
unsigned Flags),
- (Tag, Scope, Name, File, Line, Type, Arg, Flags))
+ (Scope, Name, File, Line, Type, Arg, Flags))
DEFINE_MDNODE_GET(DILocalVariable,
- (unsigned Tag, Metadata *Scope, MDString *Name,
- Metadata *File, unsigned Line, Metadata *Type,
- unsigned Arg, unsigned Flags),
- (Tag, Scope, Name, File, Line, Type, Arg, Flags))
+ (Metadata * Scope, MDString *Name, Metadata *File,
+ unsigned Line, Metadata *Type, unsigned Arg,
+ unsigned Flags),
+ (Scope, Name, File, Line, Type, Arg, Flags))
TempDILocalVariable clone() const { return cloneImpl(); }
return cast<DILocalScope>(DIVariable::getScope());
}
+ bool isParameter() const { return Arg; }
unsigned getArg() const { return Arg; }
unsigned getFlags() const { return Flags; }