clang 10.0.0git

DeclGroup.cpp
Go to the documentation of this file.
1 //===- DeclGroup.cpp - Classes for representing groups of Decls -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the DeclGroup and DeclGroupRef classes.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "clang/AST/DeclGroup.h"
14 #include "clang/AST/ASTContext.h"
15 #include <cassert>
16 #include <memory>
17
18 using namespace clang;
19
20 DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
21 assert(NumDecls > 1 && "Invalid DeclGroup");
22 unsigned Size = totalSizeToAlloc<Decl *>(NumDecls);
23 void *Mem = C.Allocate(Size, alignof(DeclGroup));
24 new (Mem) DeclGroup(NumDecls, Decls);
25 return static_cast<DeclGroup*>(Mem);
26 }
27
28 DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
29 assert(numdecls > 0);
30 assert(decls);
31 std::uninitialized_copy(decls, decls + numdecls,
32 getTrailingObjects<Decl *>());
33 }
ASTContext.h
Defines the clang::ASTContext interface.
clang::DeclGroup
Definition: DeclGroup.h:25
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
clang::DeclGroup::Create
static DeclGroup * Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
Definition: DeclGroup.cpp:20
clang::ASTContext::Allocate
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:686
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
DeclGroup.h
AttributeLangSupport::C
Definition: SemaDeclAttr.cpp:45