X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FIR%2FDebugInfo.cpp;h=a59fdcd4de97d13ed68c524fa08523b416c8d933;hb=23571f4f2c895d60c9ed23b831f988b49a55478e;hp=07508c879e26009f1652b7be95de13df54c38ac8;hpb=c2c50cdcdc19a1bca993c06d13d8cdca87083ce4;p=oota-llvm.git diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index 07508c879e2..a59fdcd4de9 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -17,12 +17,12 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/Analysis/ValueTracking.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/Instructions.h" -#include "llvm/IntrinsicInst.h" -#include "llvm/Intrinsics.h" -#include "llvm/Module.h" +#include "llvm/IR/Constants.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/Instructions.h" +#include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/Intrinsics.h" +#include "llvm/IR/Module.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/raw_ostream.h" @@ -172,6 +172,7 @@ bool DIDescriptor::isDerivedType() const { switch (getTag()) { case dwarf::DW_TAG_typedef: case dwarf::DW_TAG_pointer_type: + case dwarf::DW_TAG_ptr_to_member_type: case dwarf::DW_TAG_reference_type: case dwarf::DW_TAG_rvalue_reference_type: case dwarf::DW_TAG_const_type: @@ -196,7 +197,6 @@ bool DIDescriptor::isCompositeType() const { case dwarf::DW_TAG_structure_type: case dwarf::DW_TAG_union_type: case dwarf::DW_TAG_enumeration_type: - case dwarf::DW_TAG_vector_type: case dwarf::DW_TAG_subroutine_type: case dwarf::DW_TAG_class_type: return true; @@ -211,7 +211,6 @@ bool DIDescriptor::isVariable() const { switch (getTag()) { case dwarf::DW_TAG_auto_variable: case dwarf::DW_TAG_arg_variable: - case dwarf::DW_TAG_return_variable: return true; default: return false; @@ -384,7 +383,8 @@ bool DIType::isUnsignedDIType() { if (BTy.Verify()) { unsigned Encoding = BTy.getEncoding(); if (Encoding == dwarf::DW_ATE_unsigned || - Encoding == dwarf::DW_ATE_unsigned_char) + Encoding == dwarf::DW_ATE_unsigned_char || + Encoding == dwarf::DW_ATE_boolean) return true; } return false; @@ -423,9 +423,10 @@ bool DIType::Verify() const { unsigned Tag = getTag(); if (!isBasicType() && Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type && Tag != dwarf::DW_TAG_pointer_type && + Tag != dwarf::DW_TAG_ptr_to_member_type && Tag != dwarf::DW_TAG_reference_type && Tag != dwarf::DW_TAG_rvalue_reference_type && - Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_vector_type && + Tag != dwarf::DW_TAG_restrict_type && Tag != dwarf::DW_TAG_array_type && Tag != dwarf::DW_TAG_enumeration_type && Tag != dwarf::DW_TAG_subroutine_type && @@ -592,17 +593,14 @@ unsigned DISubprogram::isOptimized() const { MDNode *DISubprogram::getVariablesNodes() const { if (!DbgNode || DbgNode->getNumOperands() <= 19) return NULL; - if (MDNode *Temp = dyn_cast_or_null(DbgNode->getOperand(19))) - return dyn_cast_or_null(Temp->getOperand(0)); - return NULL; + return dyn_cast_or_null(DbgNode->getOperand(19)); } DIArray DISubprogram::getVariables() const { if (!DbgNode || DbgNode->getNumOperands() <= 19) return DIArray(); if (MDNode *T = dyn_cast_or_null(DbgNode->getOperand(19))) - if (MDNode *A = dyn_cast_or_null(T->getOperand(0))) - return DIArray(A); + return DIArray(T); return DIArray(); } @@ -651,8 +649,7 @@ DIArray DICompileUnit::getEnumTypes() const { return DIArray(); if (MDNode *N = dyn_cast_or_null(DbgNode->getOperand(10))) - if (MDNode *A = dyn_cast_or_null(N->getOperand(0))) - return DIArray(A); + return DIArray(N); return DIArray(); } @@ -661,8 +658,7 @@ DIArray DICompileUnit::getRetainedTypes() const { return DIArray(); if (MDNode *N = dyn_cast_or_null(DbgNode->getOperand(11))) - if (MDNode *A = dyn_cast_or_null(N->getOperand(0))) - return DIArray(A); + return DIArray(N); return DIArray(); } @@ -671,9 +667,7 @@ DIArray DICompileUnit::getSubprograms() const { return DIArray(); if (MDNode *N = dyn_cast_or_null(DbgNode->getOperand(12))) - if (N->getNumOperands() > 0) - if (MDNode *A = dyn_cast_or_null(N->getOperand(0))) - return DIArray(A); + return DIArray(N); return DIArray(); } @@ -683,8 +677,7 @@ DIArray DICompileUnit::getGlobalVariables() const { return DIArray(); if (MDNode *N = dyn_cast_or_null(DbgNode->getOperand(13))) - if (MDNode *A = dyn_cast_or_null(N->getOperand(0))) - return DIArray(A); + return DIArray(N); return DIArray(); } @@ -1062,8 +1055,8 @@ void DIScope::printInternal(raw_ostream &OS) const { void DICompileUnit::printInternal(raw_ostream &OS) const { DIScope::printInternal(OS); - if (unsigned Lang = getLanguage()) - OS << " [" << dwarf::LanguageString(Lang) << ']'; + if (const char *Lang = dwarf::LanguageString(getLanguage())) + OS << " [" << Lang << ']'; } void DIEnumerator::printInternal(raw_ostream &OS) const { @@ -1094,8 +1087,15 @@ void DIType::printInternal(raw_ostream &OS) const { else if (isProtected()) OS << " [protected]"; + if (isArtificial()) + OS << " [artificial]"; + if (isForwardDecl()) OS << " [fwd]"; + if (isVector()) + OS << " [vector]"; + if (isStaticMember()) + OS << " [static]"; } void DIDerivedType::printInternal(raw_ostream &OS) const { @@ -1122,6 +1122,11 @@ void DISubprogram::printInternal(raw_ostream &OS) const { if (getScopeLineNumber() != getLineNumber()) OS << " [scope " << getScopeLineNumber() << "]"; + if (isPrivate()) + OS << " [private]"; + else if (isProtected()) + OS << " [protected]"; + StringRef Res = getName(); if (!Res.empty()) OS << " [" << Res << ']';