[llvm] r233340 - DIBuilder: Change a few helpers to return downcasted MDNodes
Duncan P. N. Exon Smith
dexonsmith at apple.com
Thu Mar 26 17:34:10 PDT 2015
Author: dexonsmith
Date: Thu Mar 26 19:34:10 2015
New Revision: 233340
URL: http://llvm.org/viewvc/llvm-project?rev=233340&view=rev
Log:
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.
Modified:
llvm/trunk/lib/IR/DIBuilder.cpp
Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=233340&r1=233339&r2=233340&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Thu Mar 26 19:34:10 2015
@@ -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::createMemberTyp
AlignInBits, OffsetInBits, Flags);
}
-static Metadata *getConstantOrNull(Constant *C) {
+static ConstantAsMetadata *getConstantOrNull(Constant *C) {
if (C)
return ConstantAsMetadata::get(C);
return nullptr;
More information about the llvm-commits
mailing list