Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/AST/DeclGroup.cpp
Line
Count
Source
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
221k
DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
21
221k
  assert(NumDecls > 1 && "Invalid DeclGroup");
22
221k
  unsigned Size = totalSizeToAlloc<Decl *>(NumDecls);
23
221k
  void *Mem = C.Allocate(Size, alignof(DeclGroup));
24
221k
  new (Mem) DeclGroup(NumDecls, Decls);
25
221k
  return static_cast<DeclGroup*>(Mem);
26
221k
}
27
28
221k
DeclGroup::DeclGroup(unsigned numdecls, Decl** decls) : NumDecls(numdecls) {
29
221k
  assert(numdecls > 0);
30
221k
  assert(decls);
31
221k
  std::uninitialized_copy(decls, decls + numdecls,
32
221k
                          getTrailingObjects<Decl *>());
33
221k
}