//===--- DeclBase.cpp - Declaration AST Node Implementation ---------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements the Decl and DeclContext classes.////===----------------------------------------------------------------------===//#include"clang/AST/DeclBase.h"#include"clang/AST/Decl.h"#include"clang/AST/DeclContextInternals.h"#include"clang/AST/DeclCXX.h"#include"clang/AST/DeclFriend.h"#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/Stmt.h"#include"clang/AST/StmtCXX.h"#include"clang/AST/ASTMutationListener.h"#include"clang/Basic/TargetInfo.h"#include"llvm/ADT/DenseMap.h"#include"llvm/Support/raw_ostream.h"#include<algorithm>usingnamespaceclang;//===----------------------------------------------------------------------===//// Statistics//===----------------------------------------------------------------------===//#define DECL(DERIVED, BASE) static int n##DERIVED##s = 0;#define ABSTRACT_DECL(DECL)#include"clang/AST/DeclNodes.inc"void*Decl::AllocateDeserializedDecl(constASTContext&Context,unsignedID,unsignedSize){// Allocate an extra 8 bytes worth of storage, which ensures that the// resulting pointer will still be 8-byte aligned. void*Start=Context.Allocate(Size+8);void*Result=(char*)Start+8;unsigned*PrefixPtr=(unsigned*)Result-2;// Zero out the first 4 bytes; this is used to store the owning module ID.PrefixPtr[0]=0;// Store the global declaration ID in the second 4 bytes.PrefixPtr[1]=ID;returnResult;}constchar*Decl::getDeclKindName()const{switch(DeclKind){default:llvm_unreachable("Declaration not in DeclNodes.inc!");#define DECL(DERIVED, BASE) case DERIVED: return #DERIVED;#define ABSTRACT_DECL(DECL)#include"clang/AST/DeclNodes.inc"}}voidDecl::setInvalidDecl(boolInvalid){InvalidDecl=Invalid;if(Invalid&&!isa<ParmVarDecl>(this)){// Defensive maneuver for ill-formed code: we're likely not to make it to// a point where