summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DIBuilder.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-02-08 00:22:26 +0000
committerEric Christopher <echristo@apple.com>2012-02-08 00:22:26 +0000
commitae56eecf5ff6242cd27607a7a258b78035b2169b (patch)
tree15147979a23501ce45202be0884737f3c0515e70 /llvm/lib/Analysis/DIBuilder.cpp
parenta93cc25b79f2545ef166b6682e4e896ed5eb9c49 (diff)
downloadbcm5719-llvm-ae56eecf5ff6242cd27607a7a258b78035b2169b.tar.gz
bcm5719-llvm-ae56eecf5ff6242cd27607a7a258b78035b2169b.zip
Add support for a temporary forward decl type. We want this so we
can rauw forward declarations if we decide to emit the full type. Part of rdar://10809898 llvm-svn: 150024
Diffstat (limited to 'llvm/lib/Analysis/DIBuilder.cpp')
-rw-r--r--llvm/lib/Analysis/DIBuilder.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DIBuilder.cpp b/llvm/lib/Analysis/DIBuilder.cpp
index 45603711afd..53a293af912 100644
--- a/llvm/lib/Analysis/DIBuilder.cpp
+++ b/llvm/lib/Analysis/DIBuilder.cpp
@@ -669,6 +669,28 @@ DIType DIBuilder::createTemporaryType(DIFile F) {
return DIType(Node);
}
+/// createForwardDecl - Create a temporary forward-declared type that
+/// can be RAUW'd if the full type is seen.
+DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIFile F,
+ unsigned Line) {
+ // Create a temporary MDNode.
+ Value *Elts[] = {
+ GetTagConstant(VMContext, Tag),
+ NULL, // TheCU
+ MDString::get(VMContext, Name),
+ F,
+ ConstantInt::get(Type::getInt32Ty(VMContext), Line),
+ // To ease transition include sizes etc of 0.
+ ConstantInt::get(Type::getInt32Ty(VMContext), 0),
+ ConstantInt::get(Type::getInt32Ty(VMContext), 0),
+ ConstantInt::get(Type::getInt32Ty(VMContext), 0),
+ ConstantInt::get(Type::getInt32Ty(VMContext),
+ DIDescriptor::FlagFwdDecl)
+ };
+ MDNode *Node = MDNode::getTemporary(VMContext, Elts);
+ return DIType(Node);
+}
+
/// getOrCreateArray - Get a DIArray, create one if required.
DIArray DIBuilder::getOrCreateArray(ArrayRef<Value *> Elements) {
if (Elements.empty()) {
OpenPOWER on IntegriCloud