diff options
| author | Devang Patel <dpatel@apple.com> | 2011-08-15 17:57:41 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2011-08-15 17:57:41 +0000 |
| commit | dfd6ec3ce1e60c2ecebcdd781ec28dec1a9827da (patch) | |
| tree | c975b9921b9bb759bfb883abc849395f6d97a1f6 /llvm/lib/Analysis/DebugInfo.cpp | |
| parent | 0a0ba9d883f5a5a4203f25b50cd0fd382d52414d (diff) | |
| download | bcm5719-llvm-dfd6ec3ce1e60c2ecebcdd781ec28dec1a9827da.tar.gz bcm5719-llvm-dfd6ec3ce1e60c2ecebcdd781ec28dec1a9827da.zip | |
Refactor. Global variables are part of compile unit so let CompileUnit create new global variable.
llvm-svn: 137621
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
| -rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index 77dca1d9478..de4b6021df7 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -328,6 +328,22 @@ void DIType::replaceAllUsesWith(MDNode *D) { } } +/// isUnsignedDIType - Return true if type encoding is unsigned. +bool DIType::isUnsignedDIType() { + DIDerivedType DTy(DbgNode); + if (DTy.Verify()) + return DTy.getTypeDerivedFrom().isUnsignedDIType(); + + DIBasicType BTy(DbgNode); + if (BTy.Verify()) { + unsigned Encoding = BTy.getEncoding(); + if (Encoding == dwarf::DW_ATE_unsigned || + Encoding == dwarf::DW_ATE_unsigned_char) + return true; + } + return false; +} + /// Verify - Verify that a compile unit is well formed. bool DICompileUnit::Verify() const { if (!DbgNode) @@ -1014,3 +1030,17 @@ DICompositeType llvm::getDICompositeType(DIType T) { return DICompositeType(); } + +/// isSubprogramContext - Return true if Context is either a subprogram +/// or another context nested inside a subprogram. +bool llvm::isSubprogramContext(const MDNode *Context) { + if (!Context) + return false; + DIDescriptor D(Context); + if (D.isSubprogram()) + return true; + if (D.isType()) + return isSubprogramContext(DIType(Context).getContext()); + return false; +} + |

