Lines Matching +full:clang +full:- +full:format
1 //===--- InterfaceStubFunctionsConsumer.cpp -------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "clang/AST/Mangle.h"
10 #include "clang/AST/RecursiveASTVisitor.h"
11 #include "clang/Basic/TargetInfo.h"
12 #include "clang/Frontend/CompilerInstance.h"
13 #include "clang/Frontend/FrontendActions.h"
14 #include "clang/Sema/TemplateInstCallback.h"
17 using namespace clang;
23 StringRef Format; member in __anonddb1d4dd0111::InterfaceStubFunctionsConsumer
43 // DefaultVisibility is set on a decl when -fvisibility is not specified on in WriteNamedDecl()
49 auto isVisible = [](const NamedDecl *ND) -> bool { in WriteNamedDecl()
50 return ND->getVisibility() == DefaultVisibility; in WriteNamedDecl()
53 auto ignoreDecl = [this, isVisible](const NamedDecl *ND) -> bool { in WriteNamedDecl()
58 if (const auto *Parent = VD->getParentFunctionOrMethod()) in WriteNamedDecl()
62 if ((VD->getStorageClass() == StorageClass::SC_Extern) || in WriteNamedDecl()
63 (VD->getStorageClass() == StorageClass::SC_Static && in WriteNamedDecl()
64 VD->getParentFunctionOrMethod() == nullptr)) in WriteNamedDecl()
69 if (FD->isInlined() && !isa<CXXMethodDecl>(FD) && in WriteNamedDecl()
73 if (const auto *RC = dyn_cast<CXXRecordDecl>(MD->getParent())) in WriteNamedDecl()
74 if (isa<ClassTemplateDecl>(RC->getParent()) || !isVisible(RC)) in WriteNamedDecl()
76 if (MD->isDependentContext() || !MD->hasBody()) in WriteNamedDecl()
79 if (FD->getStorageClass() == StorageClass::SC_Static) in WriteNamedDecl()
85 auto getParentFunctionDecl = [](const NamedDecl *ND) -> const NamedDecl * { in WriteNamedDecl()
88 dyn_cast_or_null<FunctionDecl>(VD->getParentFunctionOrMethod())) in WriteNamedDecl()
93 auto getMangledNames = [](const NamedDecl *ND) -> std::vector<std::string> { in WriteNamedDecl()
96 ASTNameGenerator NameGen(ND->getASTContext()); in WriteNamedDecl()
110 // - Currently have not figured out how to produce the names for FieldDecls. in WriteNamedDecl()
111 // - Do not want to produce symbols for function paremeters. in WriteNamedDecl()
125 if (FD->isDependentContext()) in WriteNamedDecl()
128 const bool IsWeak = (ND->hasAttr<WeakAttr>() || in WriteNamedDecl()
129 ND->hasAttr<WeakRefAttr>() || ND->isWeakImported()); in WriteNamedDecl()
167 switch (ND->getKind()) { in HandleNamedDecl()
171 HandleDecls(cast<NamespaceDecl>(ND)->decls(), Symbols, RDO); in HandleNamedDecl()
174 HandleDecls(cast<CXXRecordDecl>(ND)->decls(), Symbols, RDO); in HandleNamedDecl()
177 HandleDecls(cast<ClassTemplateSpecializationDecl>(ND)->decls(), Symbols, in HandleNamedDecl()
212 if (!ND->getIdentifier()) in HandleNamedDecl()
216 if (VD->isTemplated() || VD->getType()->isDependentType()) in HandleNamedDecl()
241 StringRef Format) in InterfaceStubFunctionsConsumer() argument
242 : Instance(Instance), InFile(InFile), Format(Format) {} in InterfaceStubFunctionsConsumer()
248 if (FD->isLateTemplateParsed()) { in HandleTranslationUnit()
275 clang::Sema &S = Instance.getSema(); in HandleTranslationUnit()
277 clang::LateParsedTemplate &LPT = in HandleTranslationUnit()
278 *S.LateParsedTemplateMap.find(cast<FunctionDecl>(FD))->second; in HandleTranslationUnit()
291 const ASTContext &context, StringRef Format, in HandleTranslationUnit()
292 raw_ostream &OS) -> void { in HandleTranslationUnit()
293 OS << "--- !" << Format << "\n"; in HandleTranslationUnit()
300 OS << " - { Name: \"" in HandleTranslationUnit()
308 "clang -emit-interface-stubs: Unexpected symbol type."); in HandleTranslationUnit()
313 auto VD = cast<ValueDecl>(E.first)->getType(); in HandleTranslationUnit()
331 assert(Format == "ifs-v1" && "Unexpected IFS Format."); in HandleTranslationUnit()
332 writeIfsV1(Instance.getTarget().getTriple(), Symbols, context, Format, *OS); in HandleTranslationUnit()
340 return std::make_unique<InterfaceStubFunctionsConsumer>(CI, InFile, "ifs-v1"); in CreateASTConsumer()