clang
3.7.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
work
release_test
rc4
llvm.src
tools
clang
lib
AST
DeclGroup.cpp
Go to the documentation of this file.
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.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "
clang/AST/DeclGroup.h
"
15
#include "
clang/AST/ASTContext.h
"
16
#include "
clang/AST/Decl.h
"
17
#include "llvm/Support/Allocator.h"
18
using namespace
clang;
19
20
DeclGroup
*
DeclGroup::Create
(
ASTContext
&
C
,
Decl
**Decls,
unsigned
NumDecls) {
21
static_assert(
sizeof
(
DeclGroup
) % llvm::AlignOf<void *>::Alignment == 0,
22
"Trailing data is unaligned!"
);
23
assert(NumDecls > 1 &&
"Invalid DeclGroup"
);
24
unsigned
Size =
sizeof
(
DeclGroup
) +
sizeof
(
Decl
*) *
NumDecls
;
25
void
* Mem = C.
Allocate
(Size, llvm::AlignOf<DeclGroup>::Alignment);
26
new
(Mem)
DeclGroup
(NumDecls, Decls);
27
return
static_cast<
DeclGroup
*
>
(Mem);
28
}
29
30
DeclGroup::DeclGroup(
unsigned
numdecls,
Decl
** decls) : NumDecls(numdecls) {
31
assert(numdecls > 0);
32
assert(decls);
33
memcpy(
this
+1, decls, numdecls *
sizeof
(*decls));
34
}
ASTContext.h
Defines the clang::ASTContext interface.
clang::DeclGroup
Definition:
DeclGroup.h:27
clang::Decl
Definition:
DeclBase.h:73
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition:
ASTContext.h:89
clang::DeclGroup::NumDecls
unsigned NumDecls
Definition:
DeclGroup.h:30
clang::DeclGroup::Create
static DeclGroup * Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
Definition:
DeclGroup.cpp:20
Decl.h
DeclGroup.h
clang::ASTContext::Allocate
void * Allocate(size_t Size, unsigned Align=8) const
Definition:
ASTContext.h:501
AttributeLangSupport::C
Definition:
SemaDeclAttr.cpp:39
Generated on Mon Aug 31 2015 10:45:15 for clang by
1.8.6