r256403 - Revert r256399 "[Sema] ArrayRef-ize ActOnBaseSpecifiers. NFC"

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 7 21:00:13 PST 2016


I think lldb was calling the setBases method. It could probably be easily
fixed, but I don't normally contribute to lldb and thus don't have a local
copy to commit with.

On Thu, Jan 7, 2016 at 6:58 PM, David Blaikie <dblaikie at gmail.com> wrote:

>
>
> On Thu, Dec 24, 2015 at 4:36 PM, Craig Topper via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: ctopper
>> Date: Thu Dec 24 18:36:02 2015
>> New Revision: 256403
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=256403&view=rev
>> Log:
>> Revert r256399 "[Sema] ArrayRef-ize ActOnBaseSpecifiers. NFC"
>>
>> It broke lldb build.
>>
>
> Any idea why?
>
>
>>
>> Modified:
>>     cfe/trunk/include/clang/AST/DeclCXX.h
>>     cfe/trunk/include/clang/Sema/Sema.h
>>     cfe/trunk/lib/AST/ASTImporter.cpp
>>     cfe/trunk/lib/AST/DeclCXX.cpp
>>     cfe/trunk/lib/Parse/ParseDeclCXX.cpp
>>     cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>>     cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/DeclCXX.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=256403&r1=256402&r2=256403&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/DeclCXX.h (original)
>> +++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Dec 24 18:36:02 2015
>> @@ -701,7 +701,7 @@ public:
>>    }
>>
>>    /// \brief Sets the base classes of this struct or class.
>> -  void setBases(ArrayRef<const CXXBaseSpecifier *> Bases);
>> +  void setBases(CXXBaseSpecifier const * const *Bases, unsigned
>> NumBases);
>>
>>    /// \brief Retrieves the number of base classes of this class.
>>    unsigned getNumBases() const { return data().NumBases; }
>>
>> Modified: cfe/trunk/include/clang/Sema/Sema.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=256403&r1=256402&r2=256403&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Sema/Sema.h (original)
>> +++ cfe/trunk/include/clang/Sema/Sema.h Thu Dec 24 18:36:02 2015
>> @@ -5365,10 +5365,10 @@ public:
>>                                  SourceLocation BaseLoc,
>>                                  SourceLocation EllipsisLoc);
>>
>> -  bool AttachBaseSpecifiers(CXXRecordDecl *Class,
>> -                            MutableArrayRef<CXXBaseSpecifier *> Bases);
>> -  void ActOnBaseSpecifiers(Decl *ClassDecl,
>> -                           MutableArrayRef<CXXBaseSpecifier *> Bases);
>> +  bool AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier
>> **Bases,
>> +                            unsigned NumBases);
>> +  void ActOnBaseSpecifiers(Decl *ClassDecl, CXXBaseSpecifier **Bases,
>> +                           unsigned NumBases);
>>
>>    bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType
>> Base);
>>    bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base,
>>
>> Modified: cfe/trunk/lib/AST/ASTImporter.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=256403&r1=256402&r2=256403&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/AST/ASTImporter.cpp (original)
>> +++ cfe/trunk/lib/AST/ASTImporter.cpp Thu Dec 24 18:36:02 2015
>> @@ -2073,7 +2073,7 @@ bool ASTNodeImporter::ImportDefinition(R
>>                                         EllipsisLoc));
>>      }
>>      if (!Bases.empty())
>> -      ToCXX->setBases(Bases);
>> +      ToCXX->setBases(Bases.data(), Bases.size());
>>    }
>>
>>    if (shouldForceImportDeclContext(Kind))
>>
>> Modified: cfe/trunk/lib/AST/DeclCXX.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=256403&r1=256402&r2=256403&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/AST/DeclCXX.cpp (original)
>> +++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Dec 24 18:36:02 2015
>> @@ -135,13 +135,14 @@ CXXRecordDecl::CreateDeserialized(const
>>  }
>>
>>  void
>> -CXXRecordDecl::setBases(ArrayRef<const CXXBaseSpecifier *> Bases) {
>> +CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
>> +                        unsigned NumBases) {
>>    ASTContext &C = getASTContext();
>>
>>    if (!data().Bases.isOffset() && data().NumBases > 0)
>>      C.Deallocate(data().getBases());
>>
>> -  if (!Bases.empty()) {
>> +  if (NumBases) {
>>      // C++ [dcl.init.aggr]p1:
>>      //   An aggregate is [...] a class with [...] no base classes [...].
>>      data().Aggregate = false;
>> @@ -157,9 +158,9 @@ CXXRecordDecl::setBases(ArrayRef<const C
>>    // The virtual bases of this class.
>>    SmallVector<const CXXBaseSpecifier *, 8> VBases;
>>
>> -  data().Bases = new(C) CXXBaseSpecifier [Bases.size()];
>> -  data().NumBases = Bases.size();
>> -  for (unsigned i = 0; i < Bases.size(); ++i) {
>> +  data().Bases = new(C) CXXBaseSpecifier [NumBases];
>> +  data().NumBases = NumBases;
>> +  for (unsigned i = 0; i < NumBases; ++i) {
>>      data().getBases()[i] = *Bases[i];
>>      // Keep track of inherited vbases for this base class.
>>      const CXXBaseSpecifier *Base = Bases[i];
>>
>> Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=256403&r1=256402&r2=256403&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Thu Dec 24 18:36:02 2015
>> @@ -1844,7 +1844,7 @@ void Parser::ParseBaseClause(Decl *Class
>>    }
>>
>>    // Attach the base specifiers
>> -  Actions.ActOnBaseSpecifiers(ClassDecl, BaseInfo);
>> +  Actions.ActOnBaseSpecifiers(ClassDecl, BaseInfo.data(),
>> BaseInfo.size());
>>  }
>>
>>  /// ParseBaseSpecifier - Parse a C++ base-specifier. A base-specifier is
>>
>> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=256403&r1=256402&r2=256403&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Dec 24 18:36:02 2015
>> @@ -1553,9 +1553,9 @@ NoteIndirectBases(ASTContext &Context, I
>>
>>  /// \brief Performs the actual work of attaching the given base class
>>  /// specifiers to a C++ class.
>> -bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class,
>> -                                MutableArrayRef<CXXBaseSpecifier *>
>> Bases) {
>> - if (Bases.empty())
>> +bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier
>> **Bases,
>> +                                unsigned NumBases) {
>> + if (NumBases == 0)
>>      return false;
>>
>>    // Used to keep track of which base types we have already seen, so
>> @@ -1571,7 +1571,7 @@ bool Sema::AttachBaseSpecifiers(CXXRecor
>>    // Copy non-redundant base specifiers into permanent storage.
>>    unsigned NumGoodBases = 0;
>>    bool Invalid = false;
>> -  for (unsigned idx = 0; idx < Bases.size(); ++idx) {
>> +  for (unsigned idx = 0; idx < NumBases; ++idx) {
>>      QualType NewBaseType
>>        = Context.getCanonicalType(Bases[idx]->getType());
>>      NewBaseType = NewBaseType.getLocalUnqualifiedType();
>> @@ -1597,7 +1597,7 @@ bool Sema::AttachBaseSpecifiers(CXXRecor
>>        Bases[NumGoodBases++] = Bases[idx];
>>
>>        // Note this base's direct & indirect bases, if there could be
>> ambiguity.
>> -      if (Bases.size() > 1)
>> +      if (NumBases > 1)
>>          NoteIndirectBases(Context, IndirectBaseTypes, NewBaseType);
>>
>>        if (const RecordType *Record = NewBaseType->getAs<RecordType>()) {
>> @@ -1619,7 +1619,7 @@ bool Sema::AttachBaseSpecifiers(CXXRecor
>>    }
>>
>>    // Attach the remaining base class specifiers to the derived class.
>> -  Class->setBases(Bases.slice(0, NumGoodBases));
>> +  Class->setBases(Bases, NumGoodBases);
>>
>>    for (unsigned idx = 0; idx < NumGoodBases; ++idx) {
>>      // Check whether this direct base is inaccessible due to ambiguity.
>> @@ -1654,13 +1654,13 @@ bool Sema::AttachBaseSpecifiers(CXXRecor
>>  /// ActOnBaseSpecifiers - Attach the given base specifiers to the
>>  /// class, after checking whether there are any duplicate base
>>  /// classes.
>> -void Sema::ActOnBaseSpecifiers(Decl *ClassDecl,
>> -                               MutableArrayRef<CXXBaseSpecifier *>
>> Bases) {
>> -  if (!ClassDecl || Bases.empty())
>> +void Sema::ActOnBaseSpecifiers(Decl *ClassDecl, CXXBaseSpecifier **Bases,
>> +                               unsigned NumBases) {
>> +  if (!ClassDecl || !Bases || !NumBases)
>>      return;
>>
>>    AdjustDeclIfTemplate(ClassDecl);
>> -  AttachBaseSpecifiers(cast<CXXRecordDecl>(ClassDecl), Bases);
>> +  AttachBaseSpecifiers(cast<CXXRecordDecl>(ClassDecl), Bases, NumBases);
>>  }
>>
>>  /// \brief Determine whether the type \p Derived is a C++ class that is
>>
>> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=256403&r1=256402&r2=256403&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu Dec 24 18:36:02
>> 2015
>> @@ -1837,7 +1837,9 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl
>>        Invalid = true;
>>    }
>>
>> -  if (!Invalid && AttachBaseSpecifiers(Instantiation, InstantiatedBases))
>> +  if (!Invalid &&
>> +      AttachBaseSpecifiers(Instantiation, InstantiatedBases.data(),
>> +                           InstantiatedBases.size()))
>>      Invalid = true;
>>
>>    return Invalid;
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160107/70475455/attachment-0001.html>


More information about the cfe-commits mailing list