clang 8.0.0

DeclGroup.cpp
Go to the documentation of this file.
1 //===- DeclGroup.cpp - Classes for representing groups of Decls -----------===//
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.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "clang/AST/DeclGroup.h"
15 #include "clang/AST/ASTContext.h"
16 #include <cassert>
17 #include <memory>
18
19 using namespace clang;
20
21 DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
22 assert(NumDecls > 1 && "Invalid DeclGroup");
23 unsigned Size = totalSizeToAlloc<Decl *>(NumDecls);
24 void *Mem = C.Allocate(Size, alignof(DeclGroup));
25 new (Mem) DeclGroup(NumDecls, Decls);
26 return static_cast<DeclGroup*>(Mem);
27 }
28
29 DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
30 assert(numdecls > 0);
31 assert(decls);
32 std::uninitialized_copy(decls, decls + numdecls,
33 getTrailingObjects<Decl *>());
34 }
ASTContext.h
Defines the clang::ASTContext interface.
clang::DeclGroup
Definition: DeclGroup.h:26
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:155
clang::DeclGroup::Create
static DeclGroup * Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
Definition: DeclGroup.cpp:21
clang::ASTContext::Allocate
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:669
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
DeclGroup.h
AttributeLangSupport::C
Definition: SemaDeclAttr.cpp:45