Allow resolving headers from a PCH even after headers+PCH were moved to another path.
[clang.git] / lib / AST / DeclGroup.cpp
blob036acc2d77a5ca9d0775326dd7883df17cc78779
1 //===--- DeclGroup.cpp - Classes for representing groups of Decls -*- C++ -*-==//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the DeclGroup and DeclGroupRef classes.
12 //===----------------------------------------------------------------------===//
14 #include "clang/AST/DeclGroup.h"
15 #include "clang/AST/Decl.h"
16 #include "clang/AST/ASTContext.h"
17 #include "llvm/Support/Allocator.h"
18 using namespace clang;
20 DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
21 assert(NumDecls > 1 && "Invalid DeclGroup");
22 unsigned Size = sizeof(DeclGroup) + sizeof(Decl*) * NumDecls;
23 void* Mem = C.Allocate(Size, llvm::AlignOf<DeclGroup>::Alignment);
24 new (Mem) DeclGroup(NumDecls, Decls);
25 return static_cast<DeclGroup*>(Mem);
28 DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
29 assert(numdecls > 0);
30 assert(decls);
31 memcpy(this+1, decls, numdecls * sizeof(*decls));