diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-27 00:34:10 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-27 00:34:10 +0000 |
commit | 9f2b49c5219ff512d3033d6cbaa2467621d03e26 (patch) | |
tree | efae31b9a57facb092cd6337869935633930e5fe | |
parent | 50b75d5804fe530a5985d25e0e19dffb166dfcc4 (diff) |
DIBuilder: Change a few helpers to return downcasted MDNodes
Change `getNonCompileUnitScope()` to return `MDScope` and
`getConstantAsMetadata()` to return `ConstantAsMetadata`. This will
make it easier to start requiring more type safety in the debug info
hierarchy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233340 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/IR/DIBuilder.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index 981e3fd3062..9677de47f7b 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -121,10 +121,10 @@ void DIBuilder::finalize() { } /// If N is compile unit return NULL otherwise return N. -static MDNode *getNonCompileUnitScope(MDNode *N) { - if (DIDescriptor(N).isCompileUnit()) +static MDScope *getNonCompileUnitScope(MDNode *N) { + if (!N || isa<MDCompileUnit>(N)) return nullptr; - return N; + return cast<MDScope>(N); } DICompileUnit DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename, @@ -304,7 +304,7 @@ DIDerivedType DIBuilder::createMemberType(DIDescriptor Scope, StringRef Name, AlignInBits, OffsetInBits, Flags); } -static Metadata *getConstantOrNull(Constant *C) { +static ConstantAsMetadata *getConstantOrNull(Constant *C) { if (C) return ConstantAsMetadata::get(C); return nullptr; |