From 2adffce40113c28d43ce3eac7bc64fdef0bf1e4b Mon Sep 17 00:00:00 2001 From: Puyan Lotfi Date: Fri, 11 Oct 2019 17:24:11 +0000 Subject: [PATCH] [clang][IFS] Fixing assert in clang interface stubs for enums, records, typedefs The clang IFS ASTConsumer was asserting on enums, records (struct definitions in C), and typedefs. All it needs to do is skip them because the stub just needs to expose global object instances and functions. Differential Revision: https://reviews.llvm.org/D68859 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374573 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InterfaceStubFunctionsConsumer.cpp | 4 ++++ test/InterfaceStubs/noninstancetypes.c | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/InterfaceStubs/noninstancetypes.c diff --git a/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/lib/Frontend/InterfaceStubFunctionsConsumer.cpp index 73584eb98d..5e6cc65e02 100644 --- a/lib/Frontend/InterfaceStubFunctionsConsumer.cpp +++ b/lib/Frontend/InterfaceStubFunctionsConsumer.cpp @@ -177,6 +177,10 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer { HandleTemplateSpecializations(*cast(ND), Symbols, RDO); return true; + case Decl::Kind::Record: + case Decl::Kind::Typedef: + case Decl::Kind::Enum: + case Decl::Kind::EnumConstant: case Decl::Kind::TemplateTypeParm: return true; case Decl::Kind::Var: diff --git a/test/InterfaceStubs/noninstancetypes.c b/test/InterfaceStubs/noninstancetypes.c new file mode 100644 index 0000000000..ad80aa6248 --- /dev/null +++ b/test/InterfaceStubs/noninstancetypes.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -o - -emit-interface-stubs %s | FileCheck %s +// TODO: Change clang_cc1 to clang when llvm-ifs can accept empty symbol lists. + +// CHECK: Symbols: +// CHECK-NEXT: ... + +struct a; +enum { b }; +typedef int c; + -- 2.40.0