diff --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp --- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp +++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp @@ -52,6 +52,14 @@ if (!isVisible(ND)) return true; + if (const VarDecl *VD = dyn_cast(ND)) + if (const auto *Parent = VD->getParentFunctionOrMethod()) { + if (const auto *BD = dyn_cast_or_null(Parent)) + return true; + if (const auto *MD = dyn_cast_or_null(Parent)) + return true; + } + if (const VarDecl *VD = dyn_cast(ND)) if ((VD->getStorageClass() == StorageClass::SC_Extern) || (VD->getStorageClass() == StorageClass::SC_Static && diff --git a/clang/test/InterfaceStubs/blocks.c b/clang/test/InterfaceStubs/blocks.c new file mode 100644 --- /dev/null +++ b/clang/test/InterfaceStubs/blocks.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-interface-stubs -fblocks -o - %s | FileCheck %s + +// CHECK: --- !experimental-ifs-v1 +// CHECK-NEXT: IfsVersion: 1.0 +// CHECK-NEXT: Triple: +// CHECK-NEXT: ObjectFileFormat: ELF +// CHECK-NEXT: Symbols: +// CHECK-NEXT: ... +static void (^f)(void*) = ^(void* data) { int i; }; diff --git a/clang/test/InterfaceStubs/lambda.cpp b/clang/test/InterfaceStubs/lambda.cpp new file mode 100644 --- /dev/null +++ b/clang/test/InterfaceStubs/lambda.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-interface-stubs -o - %s | FileCheck %s + +// CHECK: --- !experimental-ifs-v1 +// CHECK-NEXT: IfsVersion: 1.0 +// CHECK-NEXT: Triple: +// CHECK-NEXT: ObjectFileFormat: ELF +// CHECK-NEXT: Symbols: +// CHECK-NEXT: "f" : { Type: Object, Size: 1 } +// CHECK-NEXT: ... +auto f = [](void* data) { int i; };