Skip to content

ClangImporter: support __isoc_va_list for WASI/musl #31692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ClangImporter/ImportType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ namespace {
}

static const llvm::StringLiteral vaListNames[] = {
"va_list", "__gnuc_va_list", "__va_list"
"va_list", "__gnuc_va_list", "__isoc_va_list", "__va_list"
};

ImportHint hint = ImportHint::None;
Expand Down
1 change: 1 addition & 0 deletions lib/ClangImporter/MappedTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ MAP_STDLIB_TYPE("u_int64_t", UnsignedInt, 64, "UInt64", false, DoNothing)
// There's an explicit workaround in ImportType.cpp's VisitDecayedType for that.
MAP_STDLIB_TYPE("va_list", VaList, 0, "CVaListPointer", false, DoNothing)
MAP_STDLIB_TYPE("__gnuc_va_list", VaList, 0, "CVaListPointer", false, DoNothing)
MAP_STDLIB_TYPE("__isoc_va_list", VaList, 0, "CVaListPointer", false, DoNothing)
MAP_STDLIB_TYPE("__va_list", VaList, 0, "CVaListPointer", false, DoNothing)

// libkern/OSTypes.h types.
Expand Down
4 changes: 4 additions & 0 deletions test/Interop/C/va_list/Inputs/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module ImportCVAList {
header "va_list.h"
export *
}
10 changes: 10 additions & 0 deletions test/Interop/C/va_list/Inputs/va_list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdarg.h>

typedef va_list __gnuc_va_list;
typedef va_list __isoc_va_list;
typedef va_list __va_list;

va_list va;
__gnuc_va_list gnu;
__isoc_va_list isoC;
__va_list underscore;
6 changes: 6 additions & 0 deletions test/Interop/C/va_list/va_list.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %target-swift-ide-test -print-module -module-to-print=ImportCVAList -I %S/Inputs -source-filename=x | %FileCheck %s

// CHECK: var va: CVaListPointer
// CHECK: var gnu: CVaListPointer
// CHECK: var isoC: CVaListPointer
// CHECK: var underscore: CVaListPointer