@@ -7773,70 +7773,65 @@ bool ClangASTContext::StartTagDeclarationDefinition(const CompilerType &type) {
7773
7773
bool ClangASTContext::CompleteTagDeclarationDefinition (
7774
7774
const CompilerType &type) {
7775
7775
clang::QualType qual_type (ClangUtil::GetQualType (type));
7776
- if (!qual_type.isNull ()) {
7777
- // Make sure we use the same methodology as
7778
- // ClangASTContext::StartTagDeclarationDefinition() as to how we start/end
7779
- // the definition. Previously we were calling
7780
- const clang::TagType *tag_type = qual_type->getAs <clang::TagType>();
7781
- if (tag_type) {
7782
- clang::TagDecl *tag_decl = tag_type->getDecl ();
7783
- if (tag_decl) {
7784
- clang::CXXRecordDecl *cxx_record_decl =
7785
- llvm::dyn_cast_or_null<clang::CXXRecordDecl>(tag_decl);
7776
+ if (qual_type.isNull ())
7777
+ return false ;
7786
7778
7787
- if (cxx_record_decl) {
7788
- if (!cxx_record_decl->isCompleteDefinition ())
7789
- cxx_record_decl->completeDefinition ();
7790
- cxx_record_decl->setHasLoadedFieldsFromExternalStorage (true );
7791
- cxx_record_decl->setHasExternalLexicalStorage (false );
7792
- cxx_record_decl->setHasExternalVisibleStorage (false );
7793
- return true ;
7794
- }
7795
- }
7779
+ // Make sure we use the same methodology as
7780
+ // ClangASTContext::StartTagDeclarationDefinition() as to how we start/end
7781
+ // the definition.
7782
+ const clang::TagType *tag_type = qual_type->getAs <clang::TagType>();
7783
+ if (tag_type) {
7784
+ clang::TagDecl *tag_decl = tag_type->getDecl ();
7785
+
7786
+ if (auto *cxx_record_decl = llvm::dyn_cast<CXXRecordDecl>(tag_decl)) {
7787
+ if (!cxx_record_decl->isCompleteDefinition ())
7788
+ cxx_record_decl->completeDefinition ();
7789
+ cxx_record_decl->setHasLoadedFieldsFromExternalStorage (true );
7790
+ cxx_record_decl->setHasExternalLexicalStorage (false );
7791
+ cxx_record_decl->setHasExternalVisibleStorage (false );
7792
+ return true ;
7796
7793
}
7794
+ }
7797
7795
7798
- const clang::EnumType *enutype = qual_type->getAs <clang::EnumType>();
7796
+ const clang::EnumType *enutype = qual_type->getAs <clang::EnumType>();
7799
7797
7800
- if (enutype) {
7801
- clang::EnumDecl *enum_decl = enutype->getDecl ();
7798
+ if (!enutype)
7799
+ return false ;
7800
+ clang::EnumDecl *enum_decl = enutype->getDecl ();
7802
7801
7803
- if (enum_decl) {
7804
- if (!enum_decl->isCompleteDefinition ()) {
7805
- ClangASTContext *lldb_ast =
7806
- llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem ());
7807
- if (lldb_ast == nullptr )
7808
- return false ;
7809
- clang::ASTContext &ast = lldb_ast->getASTContext ();
7810
-
7811
- // / TODO This really needs to be fixed.
7812
-
7813
- QualType integer_type (enum_decl->getIntegerType ());
7814
- if (!integer_type.isNull ()) {
7815
- unsigned NumPositiveBits = 1 ;
7816
- unsigned NumNegativeBits = 0 ;
7817
-
7818
- clang::QualType promotion_qual_type;
7819
- // If the enum integer type is less than an integer in bit width,
7820
- // then we must promote it to an integer size.
7821
- if (ast.getTypeSize (enum_decl->getIntegerType ()) <
7822
- ast.getTypeSize (ast.IntTy )) {
7823
- if (enum_decl->getIntegerType ()->isSignedIntegerType ())
7824
- promotion_qual_type = ast.IntTy ;
7825
- else
7826
- promotion_qual_type = ast.UnsignedIntTy ;
7827
- } else
7828
- promotion_qual_type = enum_decl->getIntegerType ();
7802
+ if (enum_decl->isCompleteDefinition ())
7803
+ return true ;
7829
7804
7830
- enum_decl->completeDefinition (enum_decl->getIntegerType (),
7831
- promotion_qual_type, NumPositiveBits,
7832
- NumNegativeBits);
7833
- }
7834
- }
7835
- return true ;
7836
- }
7837
- }
7805
+ ClangASTContext *lldb_ast =
7806
+ llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem ());
7807
+ if (lldb_ast == nullptr )
7808
+ return false ;
7809
+ clang::ASTContext &ast = lldb_ast->getASTContext ();
7810
+
7811
+ // / TODO This really needs to be fixed.
7812
+
7813
+ QualType integer_type (enum_decl->getIntegerType ());
7814
+ if (!integer_type.isNull ()) {
7815
+ unsigned NumPositiveBits = 1 ;
7816
+ unsigned NumNegativeBits = 0 ;
7817
+
7818
+ clang::QualType promotion_qual_type;
7819
+ // If the enum integer type is less than an integer in bit width,
7820
+ // then we must promote it to an integer size.
7821
+ if (ast.getTypeSize (enum_decl->getIntegerType ()) <
7822
+ ast.getTypeSize (ast.IntTy )) {
7823
+ if (enum_decl->getIntegerType ()->isSignedIntegerType ())
7824
+ promotion_qual_type = ast.IntTy ;
7825
+ else
7826
+ promotion_qual_type = ast.UnsignedIntTy ;
7827
+ } else
7828
+ promotion_qual_type = enum_decl->getIntegerType ();
7829
+
7830
+ enum_decl->completeDefinition (enum_decl->getIntegerType (),
7831
+ promotion_qual_type, NumPositiveBits,
7832
+ NumNegativeBits);
7838
7833
}
7839
- return false ;
7834
+ return true ;
7840
7835
}
7841
7836
7842
7837
clang::EnumConstantDecl *ClangASTContext::AddEnumerationValueToEnumerationType (
0 commit comments