[PDB] Test variadic function type in PDB

This adds back the test case reverted in commit: d260a269200824c5c1c8c6de531fd5aa63db9c35

llvm-svn: 344809
This commit is contained in:
Aaron Smith 2018-10-19 19:30:59 +00:00
parent 5c81c68385
commit 80ed0fd6e0
4 changed files with 15 additions and 7 deletions

View File

@ -34,7 +34,7 @@ class NSClass {
float f;
double d;
};
}
} // namespace NS
class Class {
public:
@ -48,6 +48,10 @@ int test_func(int a, int b) { return a + b; }
typedef Class ClassTypedef;
typedef NS::NSClass NSClassTypedef;
typedef int (*FuncPointerTypedef)();
typedef int (*VariadicFuncPointerTypedef)(char, ...);
FuncPointerTypedef GlobalFunc;
VariadicFuncPointerTypedef GlobalVariadicFunc;
int GlobalArray[10];
static const int sizeof_NSClass = sizeof(NS::NSClass);
@ -57,6 +61,9 @@ static const int sizeof_Enum = sizeof(Enum);
static const int sizeof_ShortEnum = sizeof(ShortEnum);
static const int sizeof_ClassTypedef = sizeof(ClassTypedef);
static const int sizeof_NSClassTypedef = sizeof(NSClassTypedef);
static const int sizeof_FuncPointerTypedef = sizeof(FuncPointerTypedef);
static const int sizeof_VariadicFuncPointerTypedef =
sizeof(VariadicFuncPointerTypedef);
static const int sizeof_GlobalArray = sizeof(GlobalArray);
int main(int argc, char **argv) {

View File

@ -200,8 +200,7 @@ TEST_F(SymbolFilePDBTests, TestResolveSymbolContextFullPath) {
EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
}
TEST_F(SymbolFilePDBTests,
TestLookupOfHeaderFileWithInlines) {
TEST_F(SymbolFilePDBTests, TestLookupOfHeaderFileWithInlines) {
// Test that when looking up a header file via ResolveSymbolContext (i.e. a
// file that was not by itself
// compiled, but only contributes to the combined code of other source files),
@ -531,7 +530,9 @@ TEST_F(SymbolFilePDBTests, TestTypedefs) {
llvm::DenseSet<SymbolFile *> searched_files;
TypeMap results;
const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef"};
const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef",
"FuncPointerTypedef",
"VariadicFuncPointerTypedef"};
for (auto Typedef : TypedefsToCheck) {
TypeMap results;
EXPECT_EQ(1u, symfile->FindTypes(sc, ConstString(Typedef), nullptr, false,
@ -561,7 +562,7 @@ TEST_F(SymbolFilePDBTests, TestRegexNameMatch) {
SymbolFilePDB *symfile =
static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());
TypeMap results;
symfile->FindTypesByRegex(RegularExpression(".*"), 0, results);
EXPECT_GT(results.GetSize(), 1u);
@ -583,8 +584,8 @@ TEST_F(SymbolFilePDBTests, TestMaxMatches) {
llvm::DenseSet<SymbolFile *> searched_files;
TypeMap results;
const ConstString name("ClassTypedef");
uint32_t num_results = symfile->FindTypes(sc, name, nullptr,
false, 0, searched_files, results);
uint32_t num_results =
symfile->FindTypes(sc, name, nullptr, false, 0, searched_files, results);
// Try to limit ourselves from 1 to 10 results, otherwise we could be doing
// this thousands of times.
// The idea is just to make sure that for a variety of values, the number of