Deleted Added
full compact
CGRecordLayoutBuilder.cpp (199512) CGRecordLayoutBuilder.cpp (199990)
1//===--- CGRecordLayoutBuilder.cpp - Record builder helper ------*- 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//===----------------------------------------------------------------------===//

--- 316 unchanged lines hidden (view full) ---

325 if (Ty->isMemberPointerType()) {
326 // We have a member pointer!
327 ContainsMemberPointer = true;
328 return;
329 }
330
331}
332
1//===--- CGRecordLayoutBuilder.cpp - Record builder helper ------*- 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//===----------------------------------------------------------------------===//

--- 316 unchanged lines hidden (view full) ---

325 if (Ty->isMemberPointerType()) {
326 // We have a member pointer!
327 ContainsMemberPointer = true;
328 return;
329 }
330
331}
332
333static const CXXMethodDecl *GetKeyFunction(const RecordDecl *D) {
334 const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D);
335 if (!RD || !RD->isDynamicClass())
336 return 0;
337
338 for (CXXRecordDecl::method_iterator I = RD->method_begin(),
339 E = RD->method_end(); I != E; ++I) {
340 const CXXMethodDecl *MD = *I;
341
342 if (!MD->isVirtual())
343 continue;
344
345 if (MD->isPure())
346 continue;
347
348 // FIXME: This doesn't work. If we have an out of line body, that body will
349 // set the MD to have a body, what we want to know is, was the body present
350 // inside the declaration of the class. For now, we just avoid the problem
351 // by pretending there is no key function.
352 return 0;
353 if (MD->getBody())
354 continue;
355
356 // We found it.
357 return MD;
358 }
359
360 return 0;
361}
362
363CGRecordLayout *
364CGRecordLayoutBuilder::ComputeLayout(CodeGenTypes &Types,
365 const RecordDecl *D) {
366 CGRecordLayoutBuilder Builder(Types);
367
368 Builder.Layout(D);
369
370 const llvm::Type *Ty = llvm::StructType::get(Types.getLLVMContext(),

--- 13 unchanged lines hidden (view full) ---

384
385 // Add bitfield info.
386 for (unsigned i = 0, e = Builder.LLVMBitFields.size(); i != e; ++i) {
387 const LLVMBitFieldInfo &Info = Builder.LLVMBitFields[i];
388
389 Types.addBitFieldInfo(Info.FD, Info.FieldNo, Info.Start, Info.Size);
390 }
391
333CGRecordLayout *
334CGRecordLayoutBuilder::ComputeLayout(CodeGenTypes &Types,
335 const RecordDecl *D) {
336 CGRecordLayoutBuilder Builder(Types);
337
338 Builder.Layout(D);
339
340 const llvm::Type *Ty = llvm::StructType::get(Types.getLLVMContext(),

--- 13 unchanged lines hidden (view full) ---

354
355 // Add bitfield info.
356 for (unsigned i = 0, e = Builder.LLVMBitFields.size(); i != e; ++i) {
357 const LLVMBitFieldInfo &Info = Builder.LLVMBitFields[i];
358
359 Types.addBitFieldInfo(Info.FD, Info.FieldNo, Info.Start, Info.Size);
360 }
361
392 const CXXMethodDecl *KeyFunction = GetKeyFunction(D);
393
394 return new CGRecordLayout(Ty, Builder.ContainsMemberPointer, KeyFunction);
362 return new CGRecordLayout(Ty, Builder.ContainsMemberPointer);
395}
363}