~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to clang/lib/CodeGen/CGCall.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
  // When translating an unprototyped function type, always use a
78
78
  // variadic type.
79
79
  return arrangeLLVMFunctionInfo(FTNP->getResultType().getUnqualifiedType(),
80
 
                                 ArrayRef<CanQualType>(),
81
 
                                 FTNP->getExtInfo(),
82
 
                                 RequiredArgs(0));
 
80
                                 None, FTNP->getExtInfo(), RequiredArgs(0));
83
81
}
84
82
 
85
83
/// Arrange the LLVM function layout for a value of the given function
257
255
  // non-variadic type.
258
256
  if (isa<FunctionNoProtoType>(FTy)) {
259
257
    CanQual<FunctionNoProtoType> noProto = FTy.getAs<FunctionNoProtoType>();
260
 
    return arrangeLLVMFunctionInfo(noProto->getResultType(),
261
 
                                   ArrayRef<CanQualType>(),
262
 
                                   noProto->getExtInfo(),
263
 
                                   RequiredArgs::All);
 
258
    return arrangeLLVMFunctionInfo(noProto->getResultType(), None,
 
259
                                   noProto->getExtInfo(), RequiredArgs::All);
264
260
  }
265
261
 
266
262
  assert(isa<FunctionProtoType>(FTy));
420
416
}
421
417
 
422
418
const CGFunctionInfo &CodeGenTypes::arrangeNullaryFunction() {
423
 
  return arrangeLLVMFunctionInfo(getContext().VoidTy, ArrayRef<CanQualType>(),
 
419
  return arrangeLLVMFunctionInfo(getContext().VoidTy, None,
424
420
                                 FunctionType::ExtInfo(), RequiredArgs::All);
425
421
}
426
422
 
1196
1192
  // initialize the return value.  TODO: it might be nice to have
1197
1193
  // a more general mechanism for this that didn't require synthesized
1198
1194
  // return statements.
1199
 
  if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(CurFuncDecl)) {
 
1195
  if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(CurCodeDecl)) {
1200
1196
    if (FD->hasImplicitReturnZero()) {
1201
1197
      QualType RetTy = FD->getResultType().getUnqualifiedType();
1202
1198
      llvm::Type* LLVMTy = CGM.getTypes().ConvertType(RetTy);
1625
1621
  return false;
1626
1622
}
1627
1623
 
1628
 
void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
 
1624
void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,
 
1625
                                         bool EmitRetDbgLoc) {
1629
1626
  // Functions with no result always return void.
1630
1627
  if (ReturnValue == 0) {
1631
1628
    Builder.CreateRetVoid();
1670
1667
      // If there is a dominating store to ReturnValue, we can elide
1671
1668
      // the load, zap the store, and usually zap the alloca.
1672
1669
      if (llvm::StoreInst *SI = findDominatingStoreToReturnValue(*this)) {
 
1670
        // Reuse the debug location from the store unless we're told not to.
 
1671
        if (EmitRetDbgLoc)
 
1672
          RetDbgLoc = SI->getDebugLoc();
1673
1673
        // Get the stored value and nuke the now-dead store.
1674
 
        RetDbgLoc = SI->getDebugLoc();
1675
1674
        RV = SI->getValueOperand();
1676
1675
        SI->eraseFromParent();
1677
1676