r269849 - Revert r269717. That change alone did not provide the intended benefit (which

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 14:48:41 PDT 2016


Author: rsmith
Date: Tue May 17 16:48:41 2016
New Revision: 269849

URL: http://llvm.org/viewvc/llvm-project?rev=269849&view=rev
Log:
Revert r269717. That change alone did not provide the intended benefit (which
would come from changing the type of ASTContext::DeclAttrs from
DenseMap<Decl*,AttrVec*> to DenseMap<Decl*,AttrVec>), and it turns out to be
impractical to avoid the allocation there, because we expose the address of the
attribute vector in ways that are hard to fix.

Modified:
    cfe/trunk/include/clang/AST/AttrIterator.h

Modified: cfe/trunk/include/clang/AST/AttrIterator.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/AttrIterator.h?rev=269849&r1=269848&r2=269849&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/AttrIterator.h (original)
+++ cfe/trunk/include/clang/AST/AttrIterator.h Tue May 17 16:48:41 2016
@@ -15,7 +15,6 @@
 #define LLVM_CLANG_AST_ATTRITERATOR_H
 
 #include "clang/Basic/LLVM.h"
-#include "llvm/ADT/TinyPtrVector.h"
 #include <iterator>
 
 namespace clang {
@@ -23,19 +22,6 @@ namespace clang {
   class Attr;
 }
 
-namespace llvm {
-  // Explicitly opt into 4 byte alignment for Attr*, to avoid the need to
-  // include the heavyweight Attr.h to use a TinyPtrVector<Attr*>.
-  template <>
-  struct PointerLikeTypeTraits<clang::Attr *> {
-    static void *getAsVoidPointer(clang::Attr *P) { return P; }
-    static clang::Attr *getFromVoidPointer(void *P) {
-      return static_cast<clang::Attr *>(P);
-    }
-    enum { NumLowBitsAvailable = 2 };
-  };
-}
-
 // Defined in ASTContext.h
 void *operator new(size_t Bytes, const clang::ASTContext &C,
                    size_t Alignment = 8);
@@ -53,8 +39,8 @@ void operator delete[](void *Ptr, const
 namespace clang {
 
 /// AttrVec - A vector of Attr, which is how they are stored on the AST.
-typedef llvm::TinyPtrVector<Attr*> AttrVec;
-typedef llvm::TinyPtrVector<const Attr*> ConstAttrVec;
+typedef SmallVector<Attr*, 2> AttrVec;
+typedef SmallVector<const Attr*, 2> ConstAttrVec;
 
 /// specific_attr_iterator - Iterates over a subrange of an AttrVec, only
 /// providing attributes that are of a specific type.




More information about the cfe-commits mailing list