clang  14.0.0git
CGNonTrivialStruct.cpp
Go to the documentation of this file.
1 //===--- CGNonTrivialStruct.cpp - Emit Special Functions for C Structs ----===//
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 functions to generate various special functions for C
10 // structs.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "CodeGenFunction.h"
15 #include "CodeGenModule.h"
18 #include "llvm/Support/ScopedPrinter.h"
19 #include <array>
20 
21 using namespace clang;
22 using namespace CodeGen;
23 
24 // Return the size of a field in number of bits.
25 static uint64_t getFieldSize(const FieldDecl *FD, QualType FT,
26  ASTContext &Ctx) {
27  if (FD && FD->isBitField())
28  return FD->getBitWidthValue(Ctx);
29  return Ctx.getTypeSize(FT);
30 }
31 
32 namespace {
33 enum { DstIdx = 0, SrcIdx = 1 };
34 const char *ValNameStr[2] = {"dst", "src"};
35 
36 template <class Derived> struct StructVisitor {
37  StructVisitor(ASTContext &Ctx) : Ctx(Ctx) {}
38 
39  template <class... Ts>
40  void visitStructFields(QualType QT, CharUnits CurStructOffset, Ts... Args) {
41  const RecordDecl *RD = QT->castAs<RecordType>()->getDecl();
42 
43  // Iterate over the fields of the struct.
44  for (const FieldDecl *FD : RD->fields()) {
45  QualType FT = FD->getType();
46  FT = QT.isVolatileQualified() ? FT.withVolatile() : FT;
47  asDerived().visit(FT, FD, CurStructOffset, Args...);
48  }
49 
50  asDerived().flushTrivialFields(Args...);
51  }
52 
53  template <class... Ts> void visitTrivial(Ts... Args) {}
54 
55  template <class... Ts> void visitCXXDestructor(Ts... Args) {
56  llvm_unreachable("field of a C++ struct type is not expected");
57  }
58 
59  template <class... Ts> void flushTrivialFields(Ts... Args) {}
60 
61  uint64_t getFieldOffsetInBits(const FieldDecl *FD) {
62  return FD ? Ctx.getASTRecordLayout(FD->getParent())
63  .getFieldOffset(FD->getFieldIndex())
64  : 0;
65  }
66 
68  return Ctx.toCharUnitsFromBits(getFieldOffsetInBits(FD));
69  }
70 
71  Derived &asDerived() { return static_cast<Derived &>(*this); }
72 
73  ASTContext &getContext() { return Ctx; }
74  ASTContext &Ctx;
75 };
76 
77 template <class Derived, bool IsMove>
78 struct CopyStructVisitor : StructVisitor<Derived>,
79  CopiedTypeVisitor<Derived, IsMove> {
80  using StructVisitor<Derived>::asDerived;
82 
83  CopyStructVisitor(ASTContext &Ctx) : StructVisitor<Derived>(Ctx) {}
84 
85  template <class... Ts>
86  void preVisit(QualType::PrimitiveCopyKind PCK, QualType FT,
87  const FieldDecl *FD, CharUnits CurStructOffset, Ts &&... Args) {
88  if (PCK)
89  asDerived().flushTrivialFields(std::forward<Ts>(Args)...);
90  }
91 
92  template <class... Ts>
93  void visitWithKind(QualType::PrimitiveCopyKind PCK, QualType FT,
94  const FieldDecl *FD, CharUnits CurStructOffset,
95  Ts &&... Args) {
96  if (const auto *AT = asDerived().getContext().getAsArrayType(FT)) {
97  asDerived().visitArray(PCK, AT, FT.isVolatileQualified(), FD,
98  CurStructOffset, std::forward<Ts>(Args)...);
99  return;
100  }
101 
102  Super::visitWithKind(PCK, FT, FD, CurStructOffset,
103  std::forward<Ts>(Args)...);
104  }
105 
106  template <class... Ts>
107  void visitTrivial(QualType FT, const FieldDecl *FD, CharUnits CurStructOffset,
108  Ts... Args) {
109  assert(!FT.isVolatileQualified() && "volatile field not expected");
110  ASTContext &Ctx = asDerived().getContext();
111  uint64_t FieldSize = getFieldSize(FD, FT, Ctx);
112 
113  // Ignore zero-sized fields.
114  if (FieldSize == 0)
115  return;
116 
117  uint64_t FStartInBits = asDerived().getFieldOffsetInBits(FD);
118  uint64_t FEndInBits = FStartInBits + FieldSize;
119  uint64_t RoundedFEnd = llvm::alignTo(FEndInBits, Ctx.getCharWidth());
120 
121  // Set Start if this is the first field of a sequence of trivial fields.
122  if (Start == End)
123  Start = CurStructOffset + Ctx.toCharUnitsFromBits(FStartInBits);
124  End = CurStructOffset + Ctx.toCharUnitsFromBits(RoundedFEnd);
125  }
126 
128 };
129 
130 // This function creates the mangled name of a special function of a non-trivial
131 // C struct. Since there is no ODR in C, the function is mangled based on the
132 // struct contents and not the name. The mangled name has the following
133 // structure:
134 //
135 // <function-name> ::= <prefix> <alignment-info> "_" <struct-field-info>
136 // <prefix> ::= "__destructor_" | "__default_constructor_" |
137 // "__copy_constructor_" | "__move_constructor_" |
138 // "__copy_assignment_" | "__move_assignment_"
139 // <alignment-info> ::= <dst-alignment> ["_" <src-alignment>]
140 // <struct-field-info> ::= <field-info>+
141 // <field-info> ::= <struct-or-scalar-field-info> | <array-field-info>
142 // <struct-or-scalar-field-info> ::= "_S" <struct-field-info> |
143 // <strong-field-info> | <trivial-field-info>
144 // <array-field-info> ::= "_AB" <array-offset> "s" <element-size> "n"
145 // <num-elements> <innermost-element-info> "_AE"
146 // <innermost-element-info> ::= <struct-or-scalar-field-info>
147 // <strong-field-info> ::= "_s" ["b"] ["v"] <field-offset>
148 // <trivial-field-info> ::= "_t" ["v"] <field-offset> "_" <field-size>
149 
150 template <class Derived> struct GenFuncNameBase {
151  std::string getVolatileOffsetStr(bool IsVolatile, CharUnits Offset) {
152  std::string S;
153  if (IsVolatile)
154  S = "v";
155  S += llvm::to_string(Offset.getQuantity());
156  return S;
157  }
158 
159  void visitARCStrong(QualType FT, const FieldDecl *FD,
160  CharUnits CurStructOffset) {
161  appendStr("_s");
162  if (FT->isBlockPointerType())
163  appendStr("b");
164  CharUnits FieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
165  appendStr(getVolatileOffsetStr(FT.isVolatileQualified(), FieldOffset));
166  }
167 
168  void visitARCWeak(QualType FT, const FieldDecl *FD,
169  CharUnits CurStructOffset) {
170  appendStr("_w");
171  CharUnits FieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
172  appendStr(getVolatileOffsetStr(FT.isVolatileQualified(), FieldOffset));
173  }
174 
175  void visitStruct(QualType QT, const FieldDecl *FD,
176  CharUnits CurStructOffset) {
177  CharUnits FieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
178  appendStr("_S");
179  asDerived().visitStructFields(QT, FieldOffset);
180  }
181 
182  template <class FieldKind>
183  void visitArray(FieldKind FK, const ArrayType *AT, bool IsVolatile,
184  const FieldDecl *FD, CharUnits CurStructOffset) {
185  // String for non-volatile trivial fields is emitted when
186  // flushTrivialFields is called.
187  if (!FK)
188  return asDerived().visitTrivial(QualType(AT, 0), FD, CurStructOffset);
189 
190  asDerived().flushTrivialFields();
191  CharUnits FieldOffset = CurStructOffset + asDerived().getFieldOffset(FD);
192  ASTContext &Ctx = asDerived().getContext();
193  const ConstantArrayType *CAT = cast<ConstantArrayType>(AT);
194  unsigned NumElts = Ctx.getConstantArrayElementCount(CAT);
195  QualType EltTy = Ctx.getBaseElementType(CAT);
196  CharUnits EltSize = Ctx.getTypeSizeInChars(EltTy);
197  appendStr("_AB" + llvm::to_string(FieldOffset.getQuantity()) + "s" +
198  llvm::to_string(EltSize.getQuantity()) + "n" +
199  llvm::to_string(NumElts));
200  EltTy = IsVolatile ? EltTy.withVolatile() : EltTy;
201  asDerived().visitWithKind(FK, EltTy, nullptr, FieldOffset);
202  appendStr("_AE");
203  }
204 
205  void appendStr(StringRef Str) { Name += Str; }
206 
207  std::string getName(QualType QT, bool IsVolatile) {
208  QT = IsVolatile ? QT.withVolatile() : QT;
209  asDerived().visitStructFields(QT, CharUnits::Zero());
210  return Name;
211  }
212 
213  Derived &asDerived() { return static_cast<Derived &>(*this); }
214 
215  std::string Name;
216 };
217 
218 template <class Derived>
219 struct GenUnaryFuncName : StructVisitor<Derived>, GenFuncNameBase<Derived> {
220  GenUnaryFuncName(StringRef Prefix, CharUnits DstAlignment, ASTContext &Ctx)
221  : StructVisitor<Derived>(Ctx) {
222  this->appendStr(Prefix);
223  this->appendStr(llvm::to_string(DstAlignment.getQuantity()));
224  }
225 };
226 
227 // Helper function to create a null constant.
228 static llvm::Constant *getNullForVariable(Address Addr) {
229  llvm::Type *Ty = Addr.getElementType();
230  return llvm::ConstantPointerNull::get(cast<llvm::PointerType>(Ty));
231 }
232 
233 template <bool IsMove>
234 struct GenBinaryFuncName : CopyStructVisitor<GenBinaryFuncName<IsMove>, IsMove>,
235  GenFuncNameBase<GenBinaryFuncName<IsMove>> {
236 
237  GenBinaryFuncName(StringRef Prefix, CharUnits DstAlignment,
238  CharUnits SrcAlignment, ASTContext &Ctx)
239  : CopyStructVisitor<GenBinaryFuncName<IsMove>, IsMove>(Ctx) {
240  this->appendStr(Prefix);
241  this->appendStr(llvm::to_string(DstAlignment.getQuantity()));
242  this->appendStr("_" + llvm::to_string(SrcAlignment.getQuantity()));
243  }
244 
245  void flushTrivialFields() {
246  if (this->Start == this->End)
247  return;
248 
249  this->appendStr("_t" + llvm::to_string(this->Start.getQuantity()) + "w" +
250  llvm::to_string((this->End - this->Start).getQuantity()));
251 
252  this->Start = this->End = CharUnits::Zero();
253  }
254 
255  void visitVolatileTrivial(QualType FT, const FieldDecl *FD,
256  CharUnits CurStructOffset) {
257  // Zero-length bit-fields don't need to be copied/assigned.
258  if (FD && FD->isZeroLengthBitField(this->Ctx))
259  return;
260 
261  // Because volatile fields can be bit-fields and are individually copied,
262  // their offset and width are in bits.
263  uint64_t OffsetInBits =
264  this->Ctx.toBits(CurStructOffset) + this->getFieldOffsetInBits(FD);
265  this->appendStr("_tv" + llvm::to_string(OffsetInBits) + "w" +
266  llvm::to_string(getFieldSize(FD, FT, this->Ctx)));
267  }
268 };
269 
270 struct GenDefaultInitializeFuncName
271  : GenUnaryFuncName<GenDefaultInitializeFuncName>,
272  DefaultInitializedTypeVisitor<GenDefaultInitializeFuncName> {
274  GenDefaultInitializeFuncName(CharUnits DstAlignment, ASTContext &Ctx)
275  : GenUnaryFuncName<GenDefaultInitializeFuncName>("__default_constructor_",
276  DstAlignment, Ctx) {}
277  void visitWithKind(QualType::PrimitiveDefaultInitializeKind PDIK, QualType FT,
278  const FieldDecl *FD, CharUnits CurStructOffset) {
279  if (const auto *AT = getContext().getAsArrayType(FT)) {
280  visitArray(PDIK, AT, FT.isVolatileQualified(), FD, CurStructOffset);
281  return;
282  }
283 
284  Super::visitWithKind(PDIK, FT, FD, CurStructOffset);
285  }
286 };
287 
288 struct GenDestructorFuncName : GenUnaryFuncName<GenDestructorFuncName>,
289  DestructedTypeVisitor<GenDestructorFuncName> {
291  GenDestructorFuncName(const char *Prefix, CharUnits DstAlignment,
292  ASTContext &Ctx)
293  : GenUnaryFuncName<GenDestructorFuncName>(Prefix, DstAlignment, Ctx) {}
294  void visitWithKind(QualType::DestructionKind DK, QualType FT,
295  const FieldDecl *FD, CharUnits CurStructOffset) {
296  if (const auto *AT = getContext().getAsArrayType(FT)) {
297  visitArray(DK, AT, FT.isVolatileQualified(), FD, CurStructOffset);
298  return;
299  }
300 
301  Super::visitWithKind(DK, FT, FD, CurStructOffset);
302  }
303 };
304 
305 // Helper function that creates CGFunctionInfo for an N-ary special function.
306 template <size_t N>
307 static const CGFunctionInfo &getFunctionInfo(CodeGenModule &CGM,
308  FunctionArgList &Args) {
309  ASTContext &Ctx = CGM.getContext();
311  QualType ParamTy = Ctx.getPointerType(Ctx.VoidPtrTy);
312 
313  for (unsigned I = 0; I < N; ++I)
314  Params.push_back(ImplicitParamDecl::Create(
315  Ctx, nullptr, SourceLocation(), &Ctx.Idents.get(ValNameStr[I]), ParamTy,
317 
318  for (auto &P : Params)
319  Args.push_back(P);
320 
321  return CGM.getTypes().arrangeBuiltinFunctionDeclaration(Ctx.VoidTy, Args);
322 }
323 
324 template <size_t N, size_t... Ints>
325 static std::array<Address, N> getParamAddrs(std::index_sequence<Ints...> IntSeq,
326  std::array<CharUnits, N> Alignments,
327  FunctionArgList Args,
328  CodeGenFunction *CGF) {
329  return std::array<Address, N>{{
330  Address(CGF->Builder.CreateLoad(CGF->GetAddrOfLocalVar(Args[Ints])),
331  Alignments[Ints])...}};
332 }
333 
334 // Template classes that are used as bases for classes that emit special
335 // functions.
336 template <class Derived> struct GenFuncBase {
337  template <size_t N>
338  void visitStruct(QualType FT, const FieldDecl *FD, CharUnits CurStructOffset,
339  std::array<Address, N> Addrs) {
340  this->asDerived().callSpecialFunction(
341  FT, CurStructOffset + asDerived().getFieldOffset(FD), Addrs);
342  }
343 
344  template <class FieldKind, size_t N>
345  void visitArray(FieldKind FK, const ArrayType *AT, bool IsVolatile,
346  const FieldDecl *FD, CharUnits CurStructOffset,
347  std::array<Address, N> Addrs) {
348  // Non-volatile trivial fields are copied when flushTrivialFields is called.
349  if (!FK)
350  return asDerived().visitTrivial(QualType(AT, 0), FD, CurStructOffset,
351  Addrs);
352 
353  asDerived().flushTrivialFields(Addrs);
354  CodeGenFunction &CGF = *this->CGF;
355  ASTContext &Ctx = CGF.getContext();
356 
357  // Compute the end address.
358  QualType BaseEltQT;
359  std::array<Address, N> StartAddrs = Addrs;
360  for (unsigned I = 0; I < N; ++I)
361  StartAddrs[I] = getAddrWithOffset(Addrs[I], CurStructOffset, FD);
362  Address DstAddr = StartAddrs[DstIdx];
363  llvm::Value *NumElts = CGF.emitArrayLength(AT, BaseEltQT, DstAddr);
364  unsigned BaseEltSize = Ctx.getTypeSizeInChars(BaseEltQT).getQuantity();
365  llvm::Value *BaseEltSizeVal =
366  llvm::ConstantInt::get(NumElts->getType(), BaseEltSize);
367  llvm::Value *SizeInBytes =
368  CGF.Builder.CreateNUWMul(BaseEltSizeVal, NumElts);
369  Address BC = CGF.Builder.CreateBitCast(DstAddr, CGF.CGM.Int8PtrTy);
370  llvm::Value *DstArrayEnd =
371  CGF.Builder.CreateInBoundsGEP(CGF.Int8Ty, BC.getPointer(), SizeInBytes);
372  DstArrayEnd = CGF.Builder.CreateBitCast(DstArrayEnd, CGF.CGM.Int8PtrPtrTy,
373  "dstarray.end");
374  llvm::BasicBlock *PreheaderBB = CGF.Builder.GetInsertBlock();
375 
376  // Create the header block and insert the phi instructions.
377  llvm::BasicBlock *HeaderBB = CGF.createBasicBlock("loop.header");
378  CGF.EmitBlock(HeaderBB);
379  llvm::PHINode *PHIs[N];
380 
381  for (unsigned I = 0; I < N; ++I) {
382  PHIs[I] = CGF.Builder.CreatePHI(CGF.CGM.Int8PtrPtrTy, 2, "addr.cur");
383  PHIs[I]->addIncoming(StartAddrs[I].getPointer(), PreheaderBB);
384  }
385 
386  // Create the exit and loop body blocks.
387  llvm::BasicBlock *ExitBB = CGF.createBasicBlock("loop.exit");
388  llvm::BasicBlock *LoopBB = CGF.createBasicBlock("loop.body");
389 
390  // Emit the comparison and conditional branch instruction that jumps to
391  // either the exit or the loop body.
392  llvm::Value *Done =
393  CGF.Builder.CreateICmpEQ(PHIs[DstIdx], DstArrayEnd, "done");
394  CGF.Builder.CreateCondBr(Done, ExitBB, LoopBB);
395 
396  // Visit the element of the array in the loop body.
397  CGF.EmitBlock(LoopBB);
398  QualType EltQT = AT->getElementType();
399  CharUnits EltSize = Ctx.getTypeSizeInChars(EltQT);
400  std::array<Address, N> NewAddrs = Addrs;
401 
402  for (unsigned I = 0; I < N; ++I)
403  NewAddrs[I] = Address(
404  PHIs[I], StartAddrs[I].getAlignment().alignmentAtOffset(EltSize));
405 
406  EltQT = IsVolatile ? EltQT.withVolatile() : EltQT;
407  this->asDerived().visitWithKind(FK, EltQT, nullptr, CharUnits::Zero(),
408  NewAddrs);
409 
410  LoopBB = CGF.Builder.GetInsertBlock();
411 
412  for (unsigned I = 0; I < N; ++I) {
413  // Instrs to update the destination and source addresses.
414  // Update phi instructions.
415  NewAddrs[I] = getAddrWithOffset(NewAddrs[I], EltSize);
416  PHIs[I]->addIncoming(NewAddrs[I].getPointer(), LoopBB);
417  }
418 
419  // Insert an unconditional branch to the header block.
420  CGF.Builder.CreateBr(HeaderBB);
421  CGF.EmitBlock(ExitBB);
422  }
423 
424  /// Return an address with the specified offset from the passed address.
425  Address getAddrWithOffset(Address Addr, CharUnits Offset) {
426  assert(Addr.isValid() && "invalid address");
427  if (Offset.getQuantity() == 0)
428  return Addr;
429  Addr = CGF->Builder.CreateBitCast(Addr, CGF->CGM.Int8PtrTy);
430  Addr = CGF->Builder.CreateConstInBoundsGEP(Addr, Offset.getQuantity());
431  return CGF->Builder.CreateBitCast(Addr, CGF->CGM.Int8PtrPtrTy);
432  }
433 
434  Address getAddrWithOffset(Address Addr, CharUnits StructFieldOffset,
435  const FieldDecl *FD) {
436  return getAddrWithOffset(Addr, StructFieldOffset +
437  asDerived().getFieldOffset(FD));
438  }
439 
440  template <size_t N>
441  llvm::Function *getFunction(StringRef FuncName, QualType QT,
442  std::array<CharUnits, N> Alignments,
443  CodeGenModule &CGM) {
444  // If the special function already exists in the module, return it.
445  if (llvm::Function *F = CGM.getModule().getFunction(FuncName)) {
446  bool WrongType = false;
447  if (!F->getReturnType()->isVoidTy())
448  WrongType = true;
449  else {
450  for (const llvm::Argument &Arg : F->args())
451  if (Arg.getType() != CGM.Int8PtrPtrTy)
452  WrongType = true;
453  }
454 
455  if (WrongType) {
456  std::string FuncName = std::string(F->getName());
457  SourceLocation Loc = QT->castAs<RecordType>()->getDecl()->getLocation();
458  CGM.Error(Loc, "special function " + FuncName +
459  " for non-trivial C struct has incorrect type");
460  return nullptr;
461  }
462  return F;
463  }
464 
465  ASTContext &Ctx = CGM.getContext();
466  FunctionArgList Args;
467  const CGFunctionInfo &FI = getFunctionInfo<N>(CGM, Args);
468  llvm::FunctionType *FuncTy = CGM.getTypes().GetFunctionType(FI);
469  llvm::Function *F =
470  llvm::Function::Create(FuncTy, llvm::GlobalValue::LinkOnceODRLinkage,
471  FuncName, &CGM.getModule());
472  F->setVisibility(llvm::GlobalValue::HiddenVisibility);
473  CGM.SetLLVMFunctionAttributes(GlobalDecl(), FI, F, /*IsThunk=*/false);
475  CodeGenFunction NewCGF(CGM);
476  setCGF(&NewCGF);
477  CGF->StartFunction(GlobalDecl(), Ctx.VoidTy, F, FI, Args);
478  auto AL = ApplyDebugLocation::CreateArtificial(*CGF);
479  std::array<Address, N> Addrs =
480  getParamAddrs<N>(std::make_index_sequence<N>{}, Alignments, Args, CGF);
481  asDerived().visitStructFields(QT, CharUnits::Zero(), Addrs);
482  CGF->FinishFunction();
483  return F;
484  }
485 
486  template <size_t N>
487  void callFunc(StringRef FuncName, QualType QT, std::array<Address, N> Addrs,
488  CodeGenFunction &CallerCGF) {
489  std::array<CharUnits, N> Alignments;
490  llvm::Value *Ptrs[N];
491 
492  for (unsigned I = 0; I < N; ++I) {
493  Alignments[I] = Addrs[I].getAlignment();
494  Ptrs[I] =
495  CallerCGF.Builder.CreateBitCast(Addrs[I], CallerCGF.CGM.Int8PtrPtrTy)
496  .getPointer();
497  }
498 
499  if (llvm::Function *F =
500  getFunction(FuncName, QT, Alignments, CallerCGF.CGM))
501  CallerCGF.EmitNounwindRuntimeCall(F, Ptrs);
502  }
503 
504  Derived &asDerived() { return static_cast<Derived &>(*this); }
505 
506  void setCGF(CodeGenFunction *F) { CGF = F; }
507 
508  CodeGenFunction *CGF = nullptr;
509 };
510 
511 template <class Derived, bool IsMove>
512 struct GenBinaryFunc : CopyStructVisitor<Derived, IsMove>,
513  GenFuncBase<Derived> {
514  GenBinaryFunc(ASTContext &Ctx) : CopyStructVisitor<Derived, IsMove>(Ctx) {}
515 
516  void flushTrivialFields(std::array<Address, 2> Addrs) {
517  CharUnits Size = this->End - this->Start;
518 
519  if (Size.getQuantity() == 0)
520  return;
521 
522  Address DstAddr = this->getAddrWithOffset(Addrs[DstIdx], this->Start);
523  Address SrcAddr = this->getAddrWithOffset(Addrs[SrcIdx], this->Start);
524 
525  // Emit memcpy.
526  if (Size.getQuantity() >= 16 || !llvm::isPowerOf2_32(Size.getQuantity())) {
527  llvm::Value *SizeVal =
528  llvm::ConstantInt::get(this->CGF->SizeTy, Size.getQuantity());
529  DstAddr =
530  this->CGF->Builder.CreateElementBitCast(DstAddr, this->CGF->Int8Ty);
531  SrcAddr =
532  this->CGF->Builder.CreateElementBitCast(SrcAddr, this->CGF->Int8Ty);
533  this->CGF->Builder.CreateMemCpy(DstAddr, SrcAddr, SizeVal, false);
534  } else {
535  llvm::Type *Ty = llvm::Type::getIntNTy(
536  this->CGF->getLLVMContext(),
537  Size.getQuantity() * this->CGF->getContext().getCharWidth());
538  DstAddr = this->CGF->Builder.CreateElementBitCast(DstAddr, Ty);
539  SrcAddr = this->CGF->Builder.CreateElementBitCast(SrcAddr, Ty);
540  llvm::Value *SrcVal = this->CGF->Builder.CreateLoad(SrcAddr, false);
541  this->CGF->Builder.CreateStore(SrcVal, DstAddr, false);
542  }
543 
544  this->Start = this->End = CharUnits::Zero();
545  }
546 
547  template <class... Ts>
548  void visitVolatileTrivial(QualType FT, const FieldDecl *FD, CharUnits Offset,
549  std::array<Address, 2> Addrs) {
550  LValue DstLV, SrcLV;
551  if (FD) {
552  // No need to copy zero-length bit-fields.
553  if (FD->isZeroLengthBitField(this->CGF->getContext()))
554  return;
555 
556  QualType RT = QualType(FD->getParent()->getTypeForDecl(), 0);
557  llvm::PointerType *PtrTy = this->CGF->ConvertType(RT)->getPointerTo();
558  Address DstAddr = this->getAddrWithOffset(Addrs[DstIdx], Offset);
559  LValue DstBase = this->CGF->MakeAddrLValue(
560  this->CGF->Builder.CreateBitCast(DstAddr, PtrTy), FT);
561  DstLV = this->CGF->EmitLValueForField(DstBase, FD);
562  Address SrcAddr = this->getAddrWithOffset(Addrs[SrcIdx], Offset);
563  LValue SrcBase = this->CGF->MakeAddrLValue(
564  this->CGF->Builder.CreateBitCast(SrcAddr, PtrTy), FT);
565  SrcLV = this->CGF->EmitLValueForField(SrcBase, FD);
566  } else {
567  llvm::PointerType *Ty = this->CGF->ConvertTypeForMem(FT)->getPointerTo();
568  Address DstAddr = this->CGF->Builder.CreateBitCast(Addrs[DstIdx], Ty);
569  Address SrcAddr = this->CGF->Builder.CreateBitCast(Addrs[SrcIdx], Ty);
570  DstLV = this->CGF->MakeAddrLValue(DstAddr, FT);
571  SrcLV = this->CGF->MakeAddrLValue(SrcAddr, FT);
572  }
573  RValue SrcVal = this->CGF->EmitLoadOfLValue(SrcLV, SourceLocation());
574  this->CGF->EmitStoreThroughLValue(SrcVal, DstLV);
575  }
576 };
577 
578 // These classes that emit the special functions for a non-trivial struct.
579 struct GenDestructor : StructVisitor<GenDestructor>,
580  GenFuncBase<GenDestructor>,
581  DestructedTypeVisitor<GenDestructor> {
583  GenDestructor(ASTContext &Ctx) : StructVisitor<GenDestructor>(Ctx) {}
584 
585  void visitWithKind(QualType::DestructionKind DK, QualType FT,
586  const FieldDecl *FD, CharUnits CurStructOffset,
587  std::array<Address, 1> Addrs) {
588  if (const auto *AT = getContext().getAsArrayType(FT)) {
589  visitArray(DK, AT, FT.isVolatileQualified(), FD, CurStructOffset, Addrs);
590  return;
591  }
592 
593  Super::visitWithKind(DK, FT, FD, CurStructOffset, Addrs);
594  }
595 
596  void visitARCStrong(QualType QT, const FieldDecl *FD,
597  CharUnits CurStructOffset, std::array<Address, 1> Addrs) {
599  *CGF, getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
600  }
601 
602  void visitARCWeak(QualType QT, const FieldDecl *FD, CharUnits CurStructOffset,
603  std::array<Address, 1> Addrs) {
604  CGF->destroyARCWeak(
605  *CGF, getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
606  }
607 
609  std::array<Address, 1> Addrs) {
611  CGF->MakeAddrLValue(getAddrWithOffset(Addrs[DstIdx], Offset), FT));
612  }
613 };
614 
615 struct GenDefaultInitialize
616  : StructVisitor<GenDefaultInitialize>,
617  GenFuncBase<GenDefaultInitialize>,
618  DefaultInitializedTypeVisitor<GenDefaultInitialize> {
620  typedef GenFuncBase<GenDefaultInitialize> GenFuncBaseTy;
621 
622  GenDefaultInitialize(ASTContext &Ctx)
623  : StructVisitor<GenDefaultInitialize>(Ctx) {}
624 
625  void visitWithKind(QualType::PrimitiveDefaultInitializeKind PDIK, QualType FT,
626  const FieldDecl *FD, CharUnits CurStructOffset,
627  std::array<Address, 1> Addrs) {
628  if (const auto *AT = getContext().getAsArrayType(FT)) {
629  visitArray(PDIK, AT, FT.isVolatileQualified(), FD, CurStructOffset,
630  Addrs);
631  return;
632  }
633 
634  Super::visitWithKind(PDIK, FT, FD, CurStructOffset, Addrs);
635  }
636 
637  void visitARCStrong(QualType QT, const FieldDecl *FD,
638  CharUnits CurStructOffset, std::array<Address, 1> Addrs) {
640  getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
641  }
642 
643  void visitARCWeak(QualType QT, const FieldDecl *FD, CharUnits CurStructOffset,
644  std::array<Address, 1> Addrs) {
646  getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD), QT);
647  }
648 
649  template <class FieldKind, size_t... Is>
650  void visitArray(FieldKind FK, const ArrayType *AT, bool IsVolatile,
651  const FieldDecl *FD, CharUnits CurStructOffset,
652  std::array<Address, 1> Addrs) {
653  if (!FK)
654  return visitTrivial(QualType(AT, 0), FD, CurStructOffset, Addrs);
655 
656  ASTContext &Ctx = getContext();
658  QualType EltTy = Ctx.getBaseElementType(QualType(AT, 0));
659 
660  if (Size < CharUnits::fromQuantity(16) || EltTy->getAs<RecordType>()) {
661  GenFuncBaseTy::visitArray(FK, AT, IsVolatile, FD, CurStructOffset, Addrs);
662  return;
663  }
664 
665  llvm::Constant *SizeVal = CGF->Builder.getInt64(Size.getQuantity());
666  Address DstAddr = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
667  Address Loc = CGF->Builder.CreateElementBitCast(DstAddr, CGF->Int8Ty);
668  CGF->Builder.CreateMemSet(Loc, CGF->Builder.getInt8(0), SizeVal,
669  IsVolatile);
670  }
671 
673  std::array<Address, 1> Addrs) {
675  CGF->MakeAddrLValue(getAddrWithOffset(Addrs[DstIdx], Offset), FT));
676  }
677 };
678 
679 struct GenCopyConstructor : GenBinaryFunc<GenCopyConstructor, false> {
680  GenCopyConstructor(ASTContext &Ctx)
681  : GenBinaryFunc<GenCopyConstructor, false>(Ctx) {}
682 
683  void visitARCStrong(QualType QT, const FieldDecl *FD,
684  CharUnits CurStructOffset, std::array<Address, 2> Addrs) {
685  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
686  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
687  llvm::Value *SrcVal = CGF->EmitLoadOfScalar(
688  Addrs[SrcIdx], QT.isVolatileQualified(), QT, SourceLocation());
689  llvm::Value *Val = CGF->EmitARCRetain(QT, SrcVal);
690  CGF->EmitStoreOfScalar(Val, CGF->MakeAddrLValue(Addrs[DstIdx], QT), true);
691  }
692 
693  void visitARCWeak(QualType QT, const FieldDecl *FD, CharUnits CurStructOffset,
694  std::array<Address, 2> Addrs) {
695  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
696  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
697  CGF->EmitARCCopyWeak(Addrs[DstIdx], Addrs[SrcIdx]);
698  }
699 
701  std::array<Address, 2> Addrs) {
702  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
703  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
704  CGF->callCStructCopyConstructor(CGF->MakeAddrLValue(Addrs[DstIdx], FT),
705  CGF->MakeAddrLValue(Addrs[SrcIdx], FT));
706  }
707 };
708 
709 struct GenMoveConstructor : GenBinaryFunc<GenMoveConstructor, true> {
710  GenMoveConstructor(ASTContext &Ctx)
711  : GenBinaryFunc<GenMoveConstructor, true>(Ctx) {}
712 
713  void visitARCStrong(QualType QT, const FieldDecl *FD,
714  CharUnits CurStructOffset, std::array<Address, 2> Addrs) {
715  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
716  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
717  LValue SrcLV = CGF->MakeAddrLValue(Addrs[SrcIdx], QT);
718  llvm::Value *SrcVal =
720  CGF->EmitStoreOfScalar(getNullForVariable(SrcLV.getAddress(*CGF)), SrcLV);
721  CGF->EmitStoreOfScalar(SrcVal, CGF->MakeAddrLValue(Addrs[DstIdx], QT),
722  /* isInitialization */ true);
723  }
724 
725  void visitARCWeak(QualType QT, const FieldDecl *FD, CharUnits CurStructOffset,
726  std::array<Address, 2> Addrs) {
727  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
728  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
729  CGF->EmitARCMoveWeak(Addrs[DstIdx], Addrs[SrcIdx]);
730  }
731 
733  std::array<Address, 2> Addrs) {
734  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
735  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
736  CGF->callCStructMoveConstructor(CGF->MakeAddrLValue(Addrs[DstIdx], FT),
737  CGF->MakeAddrLValue(Addrs[SrcIdx], FT));
738  }
739 };
740 
741 struct GenCopyAssignment : GenBinaryFunc<GenCopyAssignment, false> {
742  GenCopyAssignment(ASTContext &Ctx)
743  : GenBinaryFunc<GenCopyAssignment, false>(Ctx) {}
744 
745  void visitARCStrong(QualType QT, const FieldDecl *FD,
746  CharUnits CurStructOffset, std::array<Address, 2> Addrs) {
747  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
748  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
749  llvm::Value *SrcVal = CGF->EmitLoadOfScalar(
750  Addrs[SrcIdx], QT.isVolatileQualified(), QT, SourceLocation());
751  CGF->EmitARCStoreStrong(CGF->MakeAddrLValue(Addrs[DstIdx], QT), SrcVal,
752  false);
753  }
754 
755  void visitARCWeak(QualType QT, const FieldDecl *FD, CharUnits CurStructOffset,
756  std::array<Address, 2> Addrs) {
757  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
758  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
759  CGF->emitARCCopyAssignWeak(QT, Addrs[DstIdx], Addrs[SrcIdx]);
760  }
761 
763  std::array<Address, 2> Addrs) {
764  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
765  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
767  CGF->MakeAddrLValue(Addrs[DstIdx], FT),
768  CGF->MakeAddrLValue(Addrs[SrcIdx], FT));
769  }
770 };
771 
772 struct GenMoveAssignment : GenBinaryFunc<GenMoveAssignment, true> {
773  GenMoveAssignment(ASTContext &Ctx)
774  : GenBinaryFunc<GenMoveAssignment, true>(Ctx) {}
775 
776  void visitARCStrong(QualType QT, const FieldDecl *FD,
777  CharUnits CurStructOffset, std::array<Address, 2> Addrs) {
778  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
779  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
780  LValue SrcLV = CGF->MakeAddrLValue(Addrs[SrcIdx], QT);
781  llvm::Value *SrcVal =
783  CGF->EmitStoreOfScalar(getNullForVariable(SrcLV.getAddress(*CGF)), SrcLV);
784  LValue DstLV = CGF->MakeAddrLValue(Addrs[DstIdx], QT);
785  llvm::Value *DstVal =
787  CGF->EmitStoreOfScalar(SrcVal, DstLV);
788  CGF->EmitARCRelease(DstVal, ARCImpreciseLifetime);
789  }
790 
791  void visitARCWeak(QualType QT, const FieldDecl *FD, CharUnits CurStructOffset,
792  std::array<Address, 2> Addrs) {
793  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], CurStructOffset, FD);
794  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], CurStructOffset, FD);
795  CGF->emitARCMoveAssignWeak(QT, Addrs[DstIdx], Addrs[SrcIdx]);
796  }
797 
799  std::array<Address, 2> Addrs) {
800  Addrs[DstIdx] = getAddrWithOffset(Addrs[DstIdx], Offset);
801  Addrs[SrcIdx] = getAddrWithOffset(Addrs[SrcIdx], Offset);
803  CGF->MakeAddrLValue(Addrs[DstIdx], FT),
804  CGF->MakeAddrLValue(Addrs[SrcIdx], FT));
805  }
806 };
807 
808 } // namespace
809 
811  Address Addr, QualType Type) {
812  CGF.callCStructDestructor(CGF.MakeAddrLValue(Addr, Type));
813 }
814 
815 // Default-initialize a variable that is a non-trivial struct or an array of
816 // such structure.
818  GenDefaultInitialize Gen(getContext());
819  Address DstPtr =
821  Gen.setCGF(this);
822  QualType QT = Dst.getType();
823  QT = Dst.isVolatile() ? QT.withVolatile() : QT;
824  Gen.visit(QT, nullptr, CharUnits::Zero(), std::array<Address, 1>({{DstPtr}}));
825 }
826 
827 template <class G, size_t N>
828 static void callSpecialFunction(G &&Gen, StringRef FuncName, QualType QT,
829  bool IsVolatile, CodeGenFunction &CGF,
830  std::array<Address, N> Addrs) {
831  auto SetArtificialLoc = ApplyDebugLocation::CreateArtificial(CGF);
832  for (unsigned I = 0; I < N; ++I)
833  Addrs[I] = CGF.Builder.CreateBitCast(Addrs[I], CGF.CGM.Int8PtrPtrTy);
834  QT = IsVolatile ? QT.withVolatile() : QT;
835  Gen.callFunc(FuncName, QT, Addrs, CGF);
836 }
837 
838 template <class G, size_t N>
839 static llvm::Function *
840 getSpecialFunction(G &&Gen, StringRef FuncName, QualType QT, bool IsVolatile,
841  std::array<CharUnits, N> Alignments, CodeGenModule &CGM) {
842  QT = IsVolatile ? QT.withVolatile() : QT;
843  // The following call requires an array of addresses as arguments, but doesn't
844  // actually use them (it overwrites them with the addresses of the arguments
845  // of the created function).
846  return Gen.getFunction(FuncName, QT, Alignments, CGM);
847 }
848 
849 // Functions to emit calls to the special functions of a non-trivial C struct.
851  bool IsVolatile = Dst.isVolatile();
852  Address DstPtr = Dst.getAddress(*this);
853  QualType QT = Dst.getType();
854  GenDefaultInitializeFuncName GenName(DstPtr.getAlignment(), getContext());
855  std::string FuncName = GenName.getName(QT, IsVolatile);
856  callSpecialFunction(GenDefaultInitialize(getContext()), FuncName, QT,
857  IsVolatile, *this, std::array<Address, 1>({{DstPtr}}));
858 }
859 
861  QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx) {
862  GenBinaryFuncName<false> GenName("", Alignment, Alignment, Ctx);
863  return GenName.getName(QT, IsVolatile);
864 }
865 
867  CharUnits Alignment,
868  bool IsVolatile,
869  ASTContext &Ctx) {
870  GenDestructorFuncName GenName("", Alignment, Ctx);
871  return GenName.getName(QT, IsVolatile);
872 }
873 
875  bool IsVolatile = Dst.isVolatile();
876  Address DstPtr = Dst.getAddress(*this);
877  QualType QT = Dst.getType();
878  GenDestructorFuncName GenName("__destructor_", DstPtr.getAlignment(),
879  getContext());
880  std::string FuncName = GenName.getName(QT, IsVolatile);
881  callSpecialFunction(GenDestructor(getContext()), FuncName, QT, IsVolatile,
882  *this, std::array<Address, 1>({{DstPtr}}));
883 }
884 
886  bool IsVolatile = Dst.isVolatile() || Src.isVolatile();
887  Address DstPtr = Dst.getAddress(*this), SrcPtr = Src.getAddress(*this);
888  QualType QT = Dst.getType();
889  GenBinaryFuncName<false> GenName("__copy_constructor_", DstPtr.getAlignment(),
890  SrcPtr.getAlignment(), getContext());
891  std::string FuncName = GenName.getName(QT, IsVolatile);
892  callSpecialFunction(GenCopyConstructor(getContext()), FuncName, QT,
893  IsVolatile, *this,
894  std::array<Address, 2>({{DstPtr, SrcPtr}}));
895 }
896 
898 
899 ) {
900  bool IsVolatile = Dst.isVolatile() || Src.isVolatile();
901  Address DstPtr = Dst.getAddress(*this), SrcPtr = Src.getAddress(*this);
902  QualType QT = Dst.getType();
903  GenBinaryFuncName<false> GenName("__copy_assignment_", DstPtr.getAlignment(),
904  SrcPtr.getAlignment(), getContext());
905  std::string FuncName = GenName.getName(QT, IsVolatile);
906  callSpecialFunction(GenCopyAssignment(getContext()), FuncName, QT, IsVolatile,
907  *this, std::array<Address, 2>({{DstPtr, SrcPtr}}));
908 }
909 
911  bool IsVolatile = Dst.isVolatile() || Src.isVolatile();
912  Address DstPtr = Dst.getAddress(*this), SrcPtr = Src.getAddress(*this);
913  QualType QT = Dst.getType();
914  GenBinaryFuncName<true> GenName("__move_constructor_", DstPtr.getAlignment(),
915  SrcPtr.getAlignment(), getContext());
916  std::string FuncName = GenName.getName(QT, IsVolatile);
917  callSpecialFunction(GenMoveConstructor(getContext()), FuncName, QT,
918  IsVolatile, *this,
919  std::array<Address, 2>({{DstPtr, SrcPtr}}));
920 }
921 
923 
924 ) {
925  bool IsVolatile = Dst.isVolatile() || Src.isVolatile();
926  Address DstPtr = Dst.getAddress(*this), SrcPtr = Src.getAddress(*this);
927  QualType QT = Dst.getType();
928  GenBinaryFuncName<true> GenName("__move_assignment_", DstPtr.getAlignment(),
929  SrcPtr.getAlignment(), getContext());
930  std::string FuncName = GenName.getName(QT, IsVolatile);
931  callSpecialFunction(GenMoveAssignment(getContext()), FuncName, QT, IsVolatile,
932  *this, std::array<Address, 2>({{DstPtr, SrcPtr}}));
933 }
934 
936  CodeGenModule &CGM, CharUnits DstAlignment, bool IsVolatile, QualType QT) {
937  ASTContext &Ctx = CGM.getContext();
938  GenDefaultInitializeFuncName GenName(DstAlignment, Ctx);
939  std::string FuncName = GenName.getName(QT, IsVolatile);
940  return getSpecialFunction(GenDefaultInitialize(Ctx), FuncName, QT, IsVolatile,
941  std::array<CharUnits, 1>({{DstAlignment}}), CGM);
942 }
943 
945  CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
946  bool IsVolatile, QualType QT) {
947  ASTContext &Ctx = CGM.getContext();
948  GenBinaryFuncName<false> GenName("__copy_constructor_", DstAlignment,
949  SrcAlignment, Ctx);
950  std::string FuncName = GenName.getName(QT, IsVolatile);
951  return getSpecialFunction(
952  GenCopyConstructor(Ctx), FuncName, QT, IsVolatile,
953  std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
954 }
955 
957  CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
958  bool IsVolatile, QualType QT) {
959  ASTContext &Ctx = CGM.getContext();
960  GenBinaryFuncName<true> GenName("__move_constructor_", DstAlignment,
961  SrcAlignment, Ctx);
962  std::string FuncName = GenName.getName(QT, IsVolatile);
963  return getSpecialFunction(
964  GenMoveConstructor(Ctx), FuncName, QT, IsVolatile,
965  std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
966 }
967 
969  CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
970  bool IsVolatile, QualType QT) {
971  ASTContext &Ctx = CGM.getContext();
972  GenBinaryFuncName<false> GenName("__copy_assignment_", DstAlignment,
973  SrcAlignment, Ctx);
974  std::string FuncName = GenName.getName(QT, IsVolatile);
975  return getSpecialFunction(
976  GenCopyAssignment(Ctx), FuncName, QT, IsVolatile,
977  std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
978 }
979 
981  CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment,
982  bool IsVolatile, QualType QT) {
983  ASTContext &Ctx = CGM.getContext();
984  GenBinaryFuncName<true> GenName("__move_assignment_", DstAlignment,
985  SrcAlignment, Ctx);
986  std::string FuncName = GenName.getName(QT, IsVolatile);
987  return getSpecialFunction(
988  GenMoveAssignment(Ctx), FuncName, QT, IsVolatile,
989  std::array<CharUnits, 2>({{DstAlignment, SrcAlignment}}), CGM);
990 }
991 
993  CodeGenModule &CGM, CharUnits DstAlignment, bool IsVolatile, QualType QT) {
994  ASTContext &Ctx = CGM.getContext();
995  GenDestructorFuncName GenName("__destructor_", DstAlignment, Ctx);
996  std::string FuncName = GenName.getName(QT, IsVolatile);
997  return getSpecialFunction(GenDestructor(Ctx), FuncName, QT, IsVolatile,
998  std::array<CharUnits, 1>({{DstAlignment}}), CGM);
999 }
clang::CodeGen::CodeGenFunction::ConvertTypeForMem
llvm::Type * ConvertTypeForMem(QualType T)
Definition: CodeGenFunction.cpp:207
clang::ASTContext::getTypeSizeInChars
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
Definition: ASTContext.cpp:2450
clang::FieldDecl::getBitWidthValue
unsigned getBitWidthValue(const ASTContext &Ctx) const
Definition: Decl.cpp:4196
clang::CodeGen::CodeGenFunction::callCStructCopyConstructor
void callCStructCopyConstructor(LValue Dst, LValue Src)
Definition: CGNonTrivialStruct.cpp:885
clang::CodeGen::CGBuilderTy::CreateMemCpy
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:286
clang::CodeGen::CodeGenTypeCache::SizeTy
llvm::IntegerType * SizeTy
Definition: CodeGenTypeCache.h:50
clang::HiddenVisibility
@ HiddenVisibility
Objects with "hidden" visibility are not seen by the dynamic linker.
Definition: Visibility.h:36
getNullForVariable
static llvm::Constant * getNullForVariable(Address addr)
Given the address of a variable of pointer type, find the correct null to store into it.
Definition: CGObjC.cpp:42
clang::CodeGen::CodeGenTypeCache::Int8PtrTy
llvm::PointerType * Int8PtrTy
Definition: CodeGenTypeCache.h:57
clang::CodeGen::CodeGenFunction::EmitNullInitialization
void EmitNullInitialization(Address DestPtr, QualType Ty)
EmitNullInitialization - Generate code to set a value of the given type to null, If the type contains...
Definition: CodeGenFunction.cpp:1908
clang::Type::isBlockPointerType
bool isBlockPointerType() const
Definition: Type.h:6681
clang::CodeGen::CodeGenFunction::emitARCCopyAssignWeak
void emitARCCopyAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
Definition: CGObjC.cpp:2633
clang::CodeGen::RValue
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
Definition: CGValue.h:39
clang::ASTContext::getCharWidth
uint64_t getCharWidth() const
Return the size of the character type, in bits.
Definition: ASTContext.h:2249
CodeGenFunction.h
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::ConstantArrayType
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2929
clang::CodeGen::getNonTrivialCStructCopyConstructor
llvm::Function * getNonTrivialCStructCopyConstructor(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Returns the copy constructor for a C struct with non-trivially copyable fields, generating it if nece...
Definition: CGNonTrivialStruct.cpp:944
clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
clang::CodeGen::Address::getAlignment
CharUnits getAlignment() const
Return the alignment of this pointer.
Definition: Address.h:66
clang::CodeGen::getNonTrivialCStructDefaultConstructor
llvm::Function * getNonTrivialCStructDefaultConstructor(CodeGenModule &GCM, CharUnits DstAlignment, bool IsVolatile, QualType QT)
Returns the default constructor for a C struct with non-trivially copyable fields,...
Definition: CGNonTrivialStruct.cpp:935
clang::ASTContext::VoidTy
CanQualType VoidTy
Definition: ASTContext.h:1075
llvm::SmallVector
Definition: LLVM.h:38
clang::IdentifierTable::get
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Definition: IdentifierTable.h:592
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::CodeGen::LValue::getAddress
Address getAddress(CodeGenFunction &CGF) const
Definition: CGValue.h:329
clang::CodeGen::CodeGenFunction::emitArrayLength
llvm::Value * emitArrayLength(const ArrayType *arrayType, QualType &baseType, Address &addr)
emitArrayLength - Compute the length of an array, even if it's a VLA, and drill down to the base elem...
Definition: CodeGenFunction.cpp:2009
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::TypeDecl::getTypeForDecl
const Type * getTypeForDecl() const
Definition: Decl.h:3162
clang::CodeGen::CodeGenModule::getContext
ASTContext & getContext() const
Definition: CodeGenModule.h:702
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2835
clang::CodeGen::Address::isValid
bool isValid() const
Definition: Address.h:35
clang::ASTContext::getBaseElementType
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Definition: ASTContext.cpp:6300
clang::CodeGen::CodeGenFunction::createBasicBlock
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
Definition: CodeGenFunction.h:2394
clang::CodeGen::CodeGenFunction::EmitARCCopyWeak
void EmitARCCopyWeak(Address dst, Address src)
void @objc_copyWeak(i8** dest, i8** src) Disregards the current value in dest.
Definition: CGObjC.cpp:2627
clang::CodeGen::CGBuilderTy::CreateStore
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
Definition: CGBuilder.h:95
clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration
const CGFunctionInfo & arrangeBuiltinFunctionDeclaration(QualType resultType, const FunctionArgList &args)
A builtin function is a freestanding function using the default C conventions.
Definition: CGCall.cpp:657
clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributes
void SetLLVMFunctionAttributes(GlobalDecl GD, const CGFunctionInfo &Info, llvm::Function *F, bool IsThunk)
Set the LLVM function attributes (sext, zext, etc).
Definition: CodeGenModule.cpp:1512
clang::QualType::isVolatileQualified
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
Definition: Type.h:6495
clang::CodeGen::CodeGenFunction::EmitLValueForField
LValue EmitLValueForField(LValue Base, const FieldDecl *Field)
Definition: CGExpr.cpp:4275
clang::CodeGen::CodeGenFunction::EmitStoreOfScalar
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
Definition: CodeGenFunction.h:3802
clang::ASTContext::toBits
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
Definition: ASTContext.cpp:2444
clang::CodeGen::getNonTrivialCStructDestructor
llvm::Function * getNonTrivialCStructDestructor(CodeGenModule &CGM, CharUnits DstAlignment, bool IsVolatile, QualType QT)
Returns the destructor for a C struct with non-trivially copyable fields, generating it if necessary.
Definition: CGNonTrivialStruct.cpp:992
End
SourceLocation End
Definition: USRLocFinder.cpp:167
clang::FieldDecl::isZeroLengthBitField
bool isZeroLengthBitField(const ASTContext &Ctx) const
Is this a zero-length bit-field? Such bit-fields aren't really bit-fields at all and instead act as a...
Definition: Decl.cpp:4201
clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
Definition: CGExpr.cpp:2053
clang::CodeGen::CodeGenFunction::Builder
CGBuilderTy Builder
Definition: CodeGenFunction.h:274
CodeGenABITypes.h
clang::QualType::withVolatile
QualType withVolatile() const
Definition: Type.h:853
clang::CodeGen::CGBuilderTy::CreateBitCast
Address CreateBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Definition: CGBuilder.h:151
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1490
clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
Definition: CodeGenFunction.h:2679
clang::CodeGen::CodeGenFunction::destroyARCWeak
static Destroyer destroyARCWeak
Definition: CodeGenFunction.h:4297
Offset
unsigned Offset
Definition: Format.cpp:2335
clang::CodeGen::ARCImpreciseLifetime
@ ARCImpreciseLifetime
Definition: CGValue.h:121
clang::GlobalDecl
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:55
clang::CodeGen::CodeGenFunction::EmitLoadOfScalar
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, AlignmentSource Source=AlignmentSource::Type, bool isNontemporal=false)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
Definition: CodeGenFunction.h:3780
clang::CodeGen::getNonTrivialCStructMoveAssignmentOperator
llvm::Function * getNonTrivialCStructMoveAssignmentOperator(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Return the move assignment operator for a C struct with non-trivially copyable fields,...
Definition: CGNonTrivialStruct.cpp:980
getFieldOffset
static uint64_t getFieldOffset(const ASTContext &C, const FieldDecl *FD)
Definition: RecordLayoutBuilder.cpp:3384
callSpecialFunction
static void callSpecialFunction(G &&Gen, StringRef FuncName, QualType QT, bool IsVolatile, CodeGenFunction &CGF, std::array< Address, N > Addrs)
Definition: CGNonTrivialStruct.cpp:828
clang::CodeGen::CGBuilderTy::CreateConstInBoundsGEP
Address CreateConstInBoundsGEP(Address Addr, uint64_t Index, const llvm::Twine &Name="")
Given addr = T* ...
Definition: CGBuilder.h:226
clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
Set the LLVM function attributes which only apply to a function definition.
Definition: CodeGenModule.cpp:1756
clang::RecordType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4613
clang::CodeGen::CodeGenFunction::getNonTrivialCopyConstructorStr
static std::string getNonTrivialCopyConstructorStr(QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx)
Definition: CGNonTrivialStruct.cpp:860
clang::CodeGen::getNonTrivialCStructMoveConstructor
llvm::Function * getNonTrivialCStructMoveConstructor(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Returns the move constructor for a C struct with non-trivially copyable fields, generating it if nece...
Definition: CGNonTrivialStruct.cpp:956
clang::CharUnits::fromQuantity
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition: CharUnits.h:63
clang::CodeGen::CodeGenFunction::defaultInitNonTrivialCStructVar
void defaultInitNonTrivialCStructVar(LValue Dst)
Definition: CGNonTrivialStruct.cpp:817
clang::CopiedTypeVisitor
Definition: NonTrivialTypeVisitor.h:78
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
clang::ArrayType
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2883
clang::ASTContext::getConstantArrayElementCount
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
Definition: ASTContext.cpp:6320
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:7162
clang::CodeGen::CodeGenModule::getModule
llvm::Module & getModule() const
Definition: CodeGenModule.h:709
clang::ASTContext::getTypeSize
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Definition: ASTContext.h:2245
clang::CodeGen::CodeGenFunction::callCStructMoveAssignmentOperator
void callCStructMoveAssignmentOperator(LValue Dst, LValue Src)
Definition: CGNonTrivialStruct.cpp:922
clang::CodeGen::LValue::isVolatile
bool isVolatile() const
Definition: CGValue.h:303
clang::CodeGen::LValue::getType
QualType getType() const
Definition: CGValue.h:266
clang::CodeGen::CodeGenModule::getTypes
CodeGenTypes & getTypes()
Definition: CodeGenModule.h:726
clang::CodeGen::CodeGenFunction::getLLVMContext
llvm::LLVMContext & getLLVMContext()
Definition: CodeGenFunction.h:1990
clang::CodeGen::CodeGenFunction::getContext
ASTContext & getContext() const
Definition: CodeGenFunction.h:1947
clang::CharUnits::Zero
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Definition: CharUnits.h:53
clang::CodeGen::CodeGenFunction::callCStructCopyAssignmentOperator
void callCStructCopyAssignmentOperator(LValue Dst, LValue Src)
Definition: CGNonTrivialStruct.cpp:897
clang::CodeGen::CodeGenFunction::FinishFunction
void FinishFunction(SourceLocation EndLoc=SourceLocation())
FinishFunction - Complete IR generation of the current function.
Definition: CodeGenFunction.cpp:324
clang::CodeGen::Address
An aligned address.
Definition: Address.h:24
clang::CodeGen::CodeGenFunction::callCStructDefaultConstructor
void callCStructDefaultConstructor(LValue Dst)
Definition: CGNonTrivialStruct.cpp:850
CodeGenModule.h
getName
static std::string getName(const CallEvent &Call)
Definition: ReturnValueChecker.cpp:60
clang::CodeGen::CodeGenFunction::callCStructMoveConstructor
void callCStructMoveConstructor(LValue Dst, LValue Src)
Definition: CGNonTrivialStruct.cpp:910
clang::CodeGen::CodeGenFunction::destroyARCStrongImprecise
static Destroyer destroyARCStrongImprecise
Definition: CodeGenFunction.h:4295
clang::CodeGen::CodeGenTypes::GetFunctionType
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.
Definition: CGCall.cpp:1595
clang::FieldDecl::getFieldIndex
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
Definition: Decl.cpp:4239
clang::Type::castAs
const T * castAs() const
Member-template castAs<specific type>.
Definition: Type.h:7227
clang::CodeGen::CodeGenFunction::StartFunction
void StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function *Fn, const CGFunctionInfo &FnInfo, const FunctionArgList &Args, SourceLocation Loc=SourceLocation(), SourceLocation StartLoc=SourceLocation())
Emit code for the start of a function.
Definition: CodeGenFunction.cpp:700
clang::CodeGen::LValue
LValue - This represents an lvalue references.
Definition: CGValue.h:167
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::ASTContext::VoidPtrTy
CanQualType VoidPtrTy
Definition: ASTContext.h:1102
clang::FieldDecl::isBitField
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2913
clang::syntax::NodeRole::Size
@ Size
false
#define false
Definition: stdbool.h:17
clang::CodeGen::Address::getPointer
llvm::Value * getPointer() const
Definition: Address.h:37
clang::CodeGen::CodeGenFunction
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Definition: CodeGenFunction.h:235
clang::CodeGen::getNonTrivialCStructCopyAssignmentOperator
llvm::Function * getNonTrivialCStructCopyAssignmentOperator(CodeGenModule &CGM, CharUnits DstAlignment, CharUnits SrcAlignment, bool IsVolatile, QualType QT)
Returns the copy assignment operator for a C struct with non-trivially copyable fields,...
Definition: CGNonTrivialStruct.cpp:968
clang::ASTContext::Idents
IdentifierTable & Idents
Definition: ASTContext.h:648
getFieldSize
static uint64_t getFieldSize(const FieldDecl *FD, QualType FT, ASTContext &Ctx)
Definition: CGNonTrivialStruct.cpp:25
clang::CodeGen::CodeGenFunction::EmitARCMoveWeak
void EmitARCMoveWeak(Address dst, Address src)
void @objc_moveWeak(i8** dest, i8** src) Disregards the current value in dest.
Definition: CGObjC.cpp:2618
getSpecialFunction
static llvm::Function * getSpecialFunction(G &&Gen, StringRef FuncName, QualType QT, bool IsVolatile, std::array< CharUnits, N > Alignments, CodeGenModule &CGM)
Definition: CGNonTrivialStruct.cpp:840
clang::CodeGen::CodeGenModule
This class organizes the cross-function state that is used while generating LLVM code.
Definition: CodeGenModule.h:284
clang::RecordDecl::fields
field_range fields() const
Definition: Decl.h:4079
clang::CodeGen::CodeGenFunction::EmitARCRelease
void EmitARCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
Release the given object.
Definition: CGObjC.cpp:2403
Value
Value
Definition: UninitializedValues.cpp:102
clang::CodeGen::FunctionArgList
FunctionArgList - Type for representing both the decl and type of parameters to a function.
Definition: CGCall.h:358
clang::QualType::DestructionKind
DestructionKind
Definition: Type.h:1202
clang::CodeGen::CodeGenFunction::ConvertType
llvm::Type * ConvertType(QualType T)
Definition: CodeGenFunction.cpp:211
clang::CodeGen::Address::getElementType
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Definition: Address.h:51
clang::CodeGen::CodeGenFunction::MakeAddrLValue
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
Definition: CodeGenFunction.h:2456
clang::CodeGen::CGBuilderTy::CreateElementBitCast
Address CreateElementBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Cast the element type of the given address to a different type, preserving information like the align...
Definition: CGBuilder.h:166
clang::CodeGen::CodeGenFunction::destroyNonTrivialCStruct
static Destroyer destroyNonTrivialCStruct
Definition: CodeGenFunction.h:4299
clang::CodeGen::CGFunctionInfo
CGFunctionInfo - Class to encapsulate the information about a function definition.
Definition: CGFunctionInfo.h:546
clang::CodeGen::CodeGenFunction::EmitLoadOfLValue
RValue EmitLoadOfLValue(LValue V, SourceLocation Loc)
EmitLoadOfLValue - Given an expression that represents a value lvalue, this method emits the address ...
Definition: CGExpr.cpp:1883
clang::CodeGen::CodeGenFunction::CGM
CodeGenModule & CGM
Definition: CodeGenFunction.h:266
clang::CodeGen::CodeGenFunction::emitARCMoveAssignWeak
void emitARCMoveAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
Definition: CGObjC.cpp:2640
clang::ImplicitParamDecl::Create
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, ImplicitParamKind ParamKind)
Create implicit parameter.
Definition: Decl.cpp:4869
clang::FieldDecl::getParent
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
Definition: Decl.h:3027
clang
Definition: CalledOnceCheck.h:17
clang::ASTContext::toCharUnitsFromBits
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Definition: ASTContext.cpp:2439
clang::CodeGen::ApplyDebugLocation::CreateArtificial
static ApplyDebugLocation CreateArtificial(CodeGenFunction &CGF)
Apply TemporaryLocation if it is valid.
Definition: CGDebugInfo.h:810
clang::CodeGen::CodeGenFunction::getNonTrivialDestructorStr
static std::string getNonTrivialDestructorStr(QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx)
Definition: CGNonTrivialStruct.cpp:866
clang::CodeGen::CodeGenFunction::EmitARCRetain
llvm::Value * EmitARCRetain(QualType type, llvm::Value *value)
Produce the code to do a retain.
Definition: CGObjC.cpp:2255
clang::DefaultInitializedTypeVisitor
Definition: NonTrivialTypeVisitor.h:50
clang::CodeGen::RValue::getScalarVal
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
Definition: CGValue.h:59
clang::ASTContext::getPointerType
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
Definition: ASTContext.cpp:3249
clang::QualType::PrimitiveDefaultInitializeKind
PrimitiveDefaultInitializeKind
Definition: Type.h:1135
clang::CharUnits
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
clang::DestructedTypeVisitor
Definition: NonTrivialTypeVisitor.h:21
true
#define true
Definition: stdbool.h:16
clang::ArrayType::getElementType
QualType getElementType() const
Definition: Type.h:2904
clang::CodeGen::CodeGenTypeCache::Int8Ty
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Definition: CodeGenTypeCache.h:37
clang::QualType::PrimitiveCopyKind
PrimitiveCopyKind
Definition: Type.h:1161
clang::CodeGen::CodeGenFunction::EmitARCStoreStrong
llvm::Value * EmitARCStoreStrong(LValue lvalue, llvm::Value *value, bool resultIgnored)
Store into a strong object.
Definition: CGObjC.cpp:2468
clang::CodeGen::CodeGenFunction::callCStructDestructor
void callCStructDestructor(LValue Dst)
Definition: CGNonTrivialStruct.cpp:874
NonTrivialTypeVisitor.h
clang::CodeGen::CGBuilderTy::CreateMemSet
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
Definition: CGBuilder.h:315
clang::RecordDecl
Represents a struct/union/class.
Definition: Decl.h:3859
clang::CodeGen::CodeGenTypeCache::Int8PtrPtrTy
llvm::PointerType * Int8PtrPtrTy
Definition: CodeGenTypeCache.h:63
clang::CodeGen::CodeGenFunction::EmitBlock
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
Definition: CGStmt.cpp:529
clang::CodeGen::CodeGenModule::Error
void Error(SourceLocation loc, StringRef error)
Emit a general error that something can't be done.
Definition: CodeGenModule.cpp:952
clang::CharUnits::getQuantity
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:179
clang::ImplicitParamDecl::Other
@ Other
Other implicit parameter.
Definition: Decl.h:1625
clang::CodeGen::CGBuilderTy::CreateLoad
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
Definition: CGBuilder.h:68