diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-22 15:35:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-22 15:35:07 +0000 |
commit | d6542d8efcf8389c3aab764f9e29ac284e16eda6 (patch) | |
tree | 4d383f402c5436bc5a23ed146ab9c75d2a233fcb /lib/Sema/SemaStmt.cpp | |
parent | bdc601b196c48d4cd56a5ceb45d41ae4e87371ab (diff) |
Switch InitializedEntity from TypeLoc down to just QualTypes, since we don't use the location information but we did spend a bunch of time building faked-up TypeLocs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 6a68db75ea..0ff933325e 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1028,23 +1028,11 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprArg rex) { return ActOnBlockReturnStmt(ReturnLoc, RetValExp); QualType FnRetType; - TypeLoc FnRetTypeLoc; if (const FunctionDecl *FD = getCurFunctionDecl()) { FnRetType = FD->getResultType(); if (FD->hasAttr<NoReturnAttr>()) Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << getCurFunctionOrMethodDecl()->getDeclName(); - -#if 0 - // FIXME: Useful, once we're sure it has all of the information we - // need. - if (TypeSourceInfo *TInfo = FD->getTypeSourceInfo()) { - TypeLoc TL = TInfo->getTypeLoc(); - if (FunctionTypeLoc *FTL = dyn_cast<FunctionTypeLoc>(&TL)) - FnRetTypeLoc = FTL->getResultLoc(); - } -#endif - } else if (ObjCMethodDecl *MD = getCurMethodDecl()) FnRetType = MD->getResultType(); else // If we don't have a function/method context, bail. @@ -1108,27 +1096,11 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprArg rex) { // FIXME: Elidable (void)Elidable; - // If we somehow didn't get a - - // FIXME: Should we allocate the TypeSourceInfo and attach it to - // the declaration? Alternatively, we could require that all - // function and method declarations have TypeSourceInfos, so that - // this is never required. FIXME: Also, the allocated TInfo goes - // into the bump pointer, so it cannot actually be freed. - TypeSourceInfo *AllocatedTInfo = 0; - if (!FnRetTypeLoc) { - const FunctionDecl *FD = getCurFunctionDecl(); - SourceLocation Loc = FD? FD->getLocation() - : getCurMethodDecl()->getLocation(); - AllocatedTInfo = Context.getTrivialTypeSourceInfo(FnRetType, Loc); - FnRetTypeLoc = AllocatedTInfo->getTypeLoc(); - } - // In C++ the return statement is handled via a copy initialization. // the C version of which boils down to CheckSingleAssignmentConstraints. OwningExprResult Res = PerformCopyInitialization( InitializedEntity::InitializeResult(ReturnLoc, - FnRetTypeLoc), + FnRetType), SourceLocation(), Owned(RetValExp)); if (Res.isInvalid()) { |