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
This commit is contained in:
parent
f7a2594032
commit
68c01aed8e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; 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 @@ void CGDebugInfo::CreateCompileUnit() {
|
||||
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 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty,
|
||||
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::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->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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user