summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-02-25 19:38:11 +0000
committerAdrian Prantl <aprantl@apple.com>2014-02-25 19:38:11 +0000
commitd45ba2527c4c160ef20890f110a8ef9e24899047 (patch)
tree205c8ef048010de493d50e7325c6ee3cbad4183a /clang/lib
parent70ff4f70036de0ec02913a70d037500f9c193865 (diff)
downloadbcm5719-llvm-d45ba2527c4c160ef20890f110a8ef9e24899047.tar.gz
bcm5719-llvm-d45ba2527c4c160ef20890f110a8ef9e24899047.zip
Debug info: Generate debug info for variadic functions.
Paired commit with LLVM. rdar://problem/13690847 llvm-svn: 202185
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index a72f9e6bf77..2de4dde1279 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -765,6 +765,8 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty,
else if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(Ty)) {
for (unsigned i = 0, e = FPT->getNumParams(); i != e; ++i)
EltTys.push_back(getOrCreateType(FPT->getParamType(i), Unit));
+ if (FPT->isVariadic())
+ EltTys.push_back(DBuilder.createUnspecifiedParameter());
}
llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys);
@@ -2437,6 +2439,20 @@ llvm::DICompositeType CGDebugInfo::getOrCreateFunctionType(const Decl *D,
llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(Elts);
return DBuilder.createSubroutineType(F, EltTypeArray);
}
+
+ // Variadic function.
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
+ if (FD->isVariadic()) {
+ SmallVector<llvm::Value *, 16> EltTys;
+ EltTys.push_back(getOrCreateType(FD->getReturnType(), F));
+ if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FnType))
+ for (unsigned i = 0, e = FPT->getNumParams(); i != e; ++i)
+ EltTys.push_back(getOrCreateType(FPT->getParamType(i), F));
+ EltTys.push_back(DBuilder.createUnspecifiedParameter());
+ llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys);
+ return DBuilder.createSubroutineType(F, EltTypeArray);
+ }
+
return llvm::DICompositeType(getOrCreateType(FnType, F));
}
OpenPOWER on IntegriCloud