17 assert(type &&
"Type for variable must be valid!");
26 IdentifierInfo *ii =
m_decl_name.getAsIdentifierInfo();
28 clang::ASTContext &ast = lldb_ast->getASTContext();
30 clang::NamedDecl *Decl = VarDecl::Create(
40 assert(type &&
"Type for variable must be valid!");
56 clang::ASTContext &ast = lldb_ast->getASTContext();
58 const bool isInlineSpecified =
false;
59 const bool hasWrittenPrototype =
true;
60 const bool isConstexprSpecified =
false;
62 clang::DeclContext *context =
const_cast<DeclContext *
>(
m_decl_context);
65 context = LinkageSpecDecl::Create(ast, context, SourceLocation(),
67 clang::LinkageSpecLanguageIDs::C,
false);
73 clang::DeclarationName decl_name =
74 m_decl_name.getNameKind() == DeclarationName::Identifier
78 clang::FunctionDecl *func_decl = FunctionDecl::Create(
79 ast, context, SourceLocation(), SourceLocation(), decl_name, qual_type,
80 nullptr, SC_Extern,
false, isInlineSpecified, hasWrittenPrototype,
81 isConstexprSpecified ? ConstexprSpecKind::Constexpr
82 : ConstexprSpecKind::Unspecified);
88 const FunctionProtoType *func_proto_type =
89 qual_type.getTypePtr()->getAs<FunctionProtoType>();
91 if (func_proto_type) {
92 unsigned NumArgs = func_proto_type->getNumParams();
95 SmallVector<ParmVarDecl *, 5> parm_var_decls;
97 for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex) {
98 QualType arg_qual_type(func_proto_type->getParamType(ArgIndex));
100 parm_var_decls.push_back(
101 ParmVarDecl::Create(ast,
const_cast<DeclContext *
>(context),
102 SourceLocation(), SourceLocation(),
nullptr,
103 arg_qual_type,
nullptr, SC_Static,
nullptr));
106 func_decl->setParams(ArrayRef<ParmVarDecl *>(parm_var_decls));
110 LLDB_LOG(log,
"Function type wasn't a FunctionProtoType");
118 clang::OverloadedOperatorKind op_kind = clang::NUM_OVERLOADED_OPERATORS;
119 if (func_proto_type &&
122 false, op_kind, func_proto_type->getNumParams()))
131 FunctionProtoType::ExtProtoInfo proto_info;
133 proto_info.Variadic =
true;
135 QualType generic_function_type(
137 ArrayRef<QualType>(),
148 if (
const TypedefType *typedef_type =
149 llvm::dyn_cast<TypedefType>(qual_type)) {
150 TypedefNameDecl *typedef_name_decl = typedef_type->getDecl();
152 m_decls.push_back(typedef_name_decl);
154 return (NamedDecl *)typedef_name_decl;
155 }
else if (
const TagType *tag_type = qual_type->getAs<TagType>()) {
156 TagDecl *tag_decl = tag_type->getDecl();
161 }
else if (
const ObjCObjectType *objc_object_type =
162 qual_type->getAs<ObjCObjectType>()) {
163 ObjCInterfaceDecl *interface_decl = objc_object_type->getInterface();
165 m_decls.push_back((NamedDecl *)interface_decl);
167 return (NamedDecl *)interface_decl;
174 for (clang::NamedDecl *decl : result)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
std::shared_ptr< TypeSystemType > dyn_cast_or_null()
Return a shared_ptr<TypeSystemType> if dyn_cast succeeds.
Generic representation of a type in a programming language.
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
A TypeSystem implementation based on Clang.
static bool IsOperator(llvm::StringRef name, clang::OverloadedOperatorKind &op_kind)
CompilerType GetType(clang::QualType qt)
Creates a CompilerType from the given QualType with the current TypeSystemClang instance as the Compi...
static bool CheckOverloadedOperatorKindParameterCount(bool is_method, clang::OverloadedOperatorKind op_kind, uint32_t num_params)
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
static clang::QualType GetQualType(const CompilerType &ct)
static bool IsClangType(const CompilerType &ct)
clang::NamedDecl * AddTypeDecl(const CompilerType &compiler_type)
Create a TypeDecl with the name being searched for and the provided type and register it in the right...
TypeSystemClang & m_clang_ts
The type system of the AST from which the lookup originated.
const clang::DeclarationName m_decl_name
The name being looked for.
clang::ASTContext & GetASTContext() const
clang::NamedDecl * AddFunDecl(const CompilerType &type, bool extern_c=false)
Create a FunDecl with the name being searched for and the provided type and register it in the right ...
llvm::SmallVectorImpl< clang::NamedDecl * > & m_decls
The list of declarations already constructed.
clang::NamedDecl * AddGenericFunDecl()
Create a FunDecl with the name being searched for and generic type (i.e.
llvm::SmallSet< CompilerType, 5 > m_function_types
All the types of functions that have been reported, so we don't report conflicts.
const clang::DeclContext * m_decl_context
The DeclContext to put declarations into.
void AddNamedDecl(clang::NamedDecl *decl)
Add a NamedDecl to the list of results.
void AddLookupResult(clang::DeclContextLookupResult result)
Add Decls from the provided DeclContextLookupResult to the list of results.
clang::NamedDecl * AddVarDecl(const CompilerType &type)
Create a VarDecl with the name being searched for and the provided type and register it in the right ...