summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-02-06 01:02:37 +0000
committerDevang Patel <dpatel@apple.com>2010-02-06 01:02:37 +0000
commit6efc8e512058a827ea9c9f10406ab7245b358e58 (patch)
tree6721621199ac7f321bf40954a6d98ff6ed9ba0b8 /llvm/lib/Analysis/DebugInfo.cpp
parent5abd69d946374a8a40fe4fd47f95b49c24d9643a (diff)
downloadbcm5719-llvm-6efc8e512058a827ea9c9f10406ab7245b358e58.tar.gz
bcm5719-llvm-6efc8e512058a827ea9c9f10406ab7245b358e58.zip
Set DW_AT_artificial only if argument is marked as artificial.
llvm-svn: 95461
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
-rw-r--r--llvm/lib/Analysis/DebugInfo.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index 13350ad9176..258f1dbc63d 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/lib/Analysis/DebugInfo.cpp
@@ -725,6 +725,29 @@ DIBasicType DIFactory::CreateBasicTypeEx(DIDescriptor Context,
return DIBasicType(MDNode::get(VMContext, &Elts[0], 10));
}
+/// CreateArtificialType - Create a new DIType with "artificial" flag set.
+DIType DIFactory::CreateArtificialType(DIType Ty) {
+ if (Ty.isArtificial())
+ return Ty;
+
+ SmallVector<Value *, 9> Elts;
+ MDNode *N = Ty.getNode();
+ assert (N && "Unexpected input DIType!");
+ for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
+ if (Value *V = N->getOperand(i))
+ Elts.push_back(V);
+ else
+ Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
+ }
+
+ unsigned CurFlags = Ty.getFlags();
+ CurFlags = CurFlags | DIType::FlagArtificial;
+
+ // Flags are stored at this slot.
+ Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
+
+ return DIType(MDNode::get(VMContext, Elts.data(), Elts.size()));
+}
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
OpenPOWER on IntegriCloud