From ea70eb30a030b5ac3afb32c5d91ec2a4f580511d Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 1 Dec 2012 15:09:41 +0000 Subject: Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092 --- clang/lib/AST/DeclBase.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'clang/lib/AST/DeclBase.cpp') diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index b04c149..bfd6c27c 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -19,12 +19,13 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/DependentDiagnostic.h" -#include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" -#include "clang/AST/Type.h" +#include "clang/AST/ASTMutationListener.h" +#include "clang/AST/Attr.h" +#include "clang/AST/ExternalASTSource.h" #include "clang/AST/Stmt.h" #include "clang/AST/StmtCXX.h" -#include "clang/AST/ASTMutationListener.h" +#include "clang/AST/Type.h" #include "clang/Basic/TargetInfo.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/raw_ostream.h" @@ -253,6 +254,19 @@ ASTMutationListener *Decl::getASTMutationListener() const { return getASTContext().getASTMutationListener(); } +unsigned Decl::getMaxAlignment() const { + if (!hasAttrs()) + return 0; + + unsigned Align = 0; + const AttrVec &V = getAttrs(); + ASTContext &Ctx = getASTContext(); + specific_attr_iterator I(V.begin()), E(V.end()); + for (; I != E; ++I) + Align = std::max(Align, I->getAlignment(Ctx)); + return Align; +} + bool Decl::isUsed(bool CheckUsedAttr) const { if (Used) return true; -- cgit v1.1