]> granicus.if.org Git - clang/commitdiff
Revert r269717. That change alone did not provide the intended benefit (which
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 17 May 2016 21:48:41 +0000 (21:48 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 17 May 2016 21:48:41 +0000 (21:48 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269849 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/AttrIterator.h

index 1176688fe0c4dc213bb13ba902445f43a30ebf50..a0c803096af86fa9bf25c21796d4eecfedf33292 100644 (file)
@@ -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 clang::ASTContext &C, size_t);
 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.