From dc97077d62c55c6f91988f073e9e645c3eb7a5ee Mon Sep 17 00:00:00 2001 From: emaste Date: Tue, 22 Jul 2014 23:16:28 +0000 Subject: 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 --- ...64827-clang-r202185-variadic-fn-debug-info.diff | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff (limited to 'contrib/llvm/patches/patch-r264827-clang-r202185-variadic-fn-debug-info.diff') 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(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(D)) ++ if (FD->isVariadic()) { ++ SmallVector EltTys; ++ EltTys.push_back(getOrCreateType(FD->getResultType(), F)); ++ if (const FunctionProtoType *FPT = dyn_cast(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)); + } + -- cgit v1.1