forked from OSchip/llvm-project
Fix expression evaluation for resolving anonymous aggregrate types with a typedefed name
This fixes a recently reported a bug(https://llvm.org/bugs/show_bug.cgi?id=26790) relating to the clang expression evaluator no longer being able to resolve calls to functions with arguments to typedefed anonymous structs, unions, or enums after a cleanup to the expression parsing code in r260768 This fixes the issue by attaching the tagged name to the original clang::TagDecl object when generating the typedef in lldb::ClangAstContext::CreateTypeDef. This also fixes the issue for anonymous typedefs for non-struct types (unions and enums) where we have a tag name. Author: Luke Drummond <luke.drummond@codeplay.com> Differential Revision: http://reviews.llvm.org/D18099 llvm-svn: 263544
This commit is contained in:
parent
22dff0aafc
commit
27fc7a7b47
|
@ -4640,6 +4640,20 @@ ClangASTContext::CreateTypedef (lldb::opaque_compiler_type_t type, const char *t
|
|||
&clang_ast->Idents.get(typedef_name),
|
||||
clang_ast->getTrivialTypeSourceInfo(qual_type));
|
||||
|
||||
clang::TagDecl *tdecl = nullptr;
|
||||
if (!qual_type.isNull())
|
||||
{
|
||||
if (const clang::RecordType *rt = qual_type->getAs<clang::RecordType>())
|
||||
tdecl = rt->getDecl();
|
||||
if (const clang::EnumType *et = qual_type->getAs<clang::EnumType>())
|
||||
tdecl = et->getDecl();
|
||||
}
|
||||
|
||||
// Check whether this declaration is an anonymous struct, union, or enum, hidden behind a typedef. If so, we
|
||||
// try to check whether we have a typedef tag to attach to the original record declaration
|
||||
if (tdecl && !tdecl->getIdentifier() && !tdecl->getTypedefNameForAnonDecl())
|
||||
tdecl->setTypedefNameForAnonDecl(decl);
|
||||
|
||||
decl->setAccess(clang::AS_public); // TODO respect proper access specifier
|
||||
|
||||
// Get a uniqued clang::QualType for the typedef decl type
|
||||
|
|
Loading…
Reference in New Issue