summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-07-22 23:16:28 +0000
committeremaste <emaste@FreeBSD.org>2014-07-22 23:16:28 +0000
commitdc97077d62c55c6f91988f073e9e645c3eb7a5ee (patch)
tree7d419fa8215f29523019edac2056e94672e6ada5 /contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff
parentce450da4301f9fcfa34afaa8d4e1b69a4877a2f7 (diff)
downloadFreeBSD-src-dc97077d62c55c6f91988f073e9e645c3eb7a5ee.zip
FreeBSD-src-dc97077d62c55c6f91988f073e9e645c3eb7a5ee.tar.gz
MFC debug info for variadic functions
r264826: Merge LLVM r202188: Debug info: Support variadic functions. Variadic functions have an unspecified parameter tag after the last argument. In IR this is represented as an unspecified parameter in the subroutine type. Paired commit with CFE r202185. rdar://problem/13690847 This re-applies r202184 + a bugfix in DwarfDebug's argument handling. This merge includes a change to use the LLVM 3.4 API in lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp: DwarfUnit -> CompileUnit r264827: Merge Clang r202185: Debug info: Generate debug info for variadic functions. Paired commit with LLVM. rdar://problem/13690847 This merege includes changes to use the Clang 3.4 API (revisions 199686 and 200082) in lib/CodeGen/CGDebugInfo.cpp: getParamType -> getArgType getNumParams -> getNumArgs getReturnType -> getResultType r264828: Add patches corresponding to r264826 and r264827 Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff')
-rw-r--r--contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff74
1 files changed, 74 insertions, 0 deletions
diff --git a/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff b/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff
new file mode 100644
index 0000000..7084f7b
--- /dev/null
+++ b/contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff
@@ -0,0 +1,74 @@
+Merge Clang r202185:
+
+ Debug info: Generate debug info for variadic functions.
+ Paired commit with LLVM.
+
+ rdar://problem/13690847
+
+This merege includes changes to use the Clang 3.4 API (revisions
+199686 and 200082) in lib/CodeGen/CGDebugInfo.cpp:
+
+getParamType -> getArgType
+getNumParams -> getNumArgs
+getReturnType -> getResultType
+
+Sponsored by: DARPA, AFRL
+
+http://svnweb.freebsd.org/changeset/base/264827
+
+Index: tools/clang/lib/CodeGen/CGDebugInfo.cpp
+===================================================================
+--- tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 264826)
++++ tools/clang/lib/CodeGen/CGDebugInfo.cpp (revision 264827)
+@@ -37,7 +37,7 @@
+ #include "llvm/IR/Module.h"
+ #include "llvm/Support/Dwarf.h"
+ #include "llvm/Support/FileSystem.h"
+-#include "llvm/Support/Path.h"
++#include "llvm/Support/Path.h"
+ using namespace clang;
+ using namespace clang::CodeGen;
+
+@@ -342,9 +342,9 @@
+ if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
+ MainFileDir = MainFile->getDir()->getName();
+ if (MainFileDir != ".") {
+- llvm::SmallString<1024> MainFileDirSS(MainFileDir);
+- llvm::sys::path::append(MainFileDirSS, MainFileName);
+- MainFileName = MainFileDirSS.str();
++ llvm::SmallString<1024> MainFileDirSS(MainFileDir);
++ llvm::sys::path::append(MainFileDirSS, MainFileName);
++ MainFileName = MainFileDirSS.str();
+ }
+ }
+
+@@ -760,6 +760,8 @@
+ else if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(Ty)) {
+ for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i)
+ EltTys.push_back(getOrCreateType(FPT->getArgType(i), Unit));
++ if (FPT->isVariadic())
++ EltTys.push_back(DBuilder.createUnspecifiedParameter());
+ }
+
+ llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(EltTys);
+@@ -2420,6 +2422,20 @@
+ 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->getResultType(), F));
++ if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FnType))
++ for (unsigned i = 0, e = FPT->getNumArgs(); i != e; ++i)
++ EltTys.push_back(getOrCreateType(FPT->getArgType(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