 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
33.3% |
4 / 12 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
66.7% |
8 / 12 |
| |
|
Line Coverage: |
100.0% |
15 / 15 |
| |
 |
|
 |
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/Decl.h"
16 : #include "clang/AST/ASTContext.h"
17 : #include "llvm/Support/Allocator.h"
18 : using namespace clang;
19 :
20 1533: DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
0: branch 0 not taken
1533: branch 1 taken
21 1533: assert(NumDecls > 1 && "Invalid DeclGroup");
22 1533: unsigned Size = sizeof(DeclGroup) + sizeof(Decl*) * NumDecls;
23 1533: void* Mem = C.Allocate(Size, llvm::AlignOf<DeclGroup>::Alignment);
1533: branch 1 taken
0: branch 2 not taken
24 1533: new (Mem) DeclGroup(NumDecls, Decls);
25 1533: return static_cast<DeclGroup*>(Mem);
26 : }
27 :
28 1533: DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
0: branch 0 not taken
1533: branch 1 taken
0: branch 3 not taken
0: branch 4 not taken
29 1533: assert(numdecls > 0);
0: branch 0 not taken
1533: branch 1 taken
0: branch 3 not taken
0: branch 4 not taken
30 1533: assert(decls);
31 1533: memcpy(this+1, decls, numdecls * sizeof(*decls));
32 1533: }
33 :
34 5: void DeclGroup::Destroy(ASTContext& C) {
35 : // Decls are destroyed by the DeclContext.
36 5: this->~DeclGroup();
37 5: C.Deallocate((void*) this);
38 5: }
Generated: 2010-02-10 01:31 by zcov