Sema: address post-commit review comment
authorSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 17 Oct 2014 17:20:33 +0000 (17:20 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Fri, 17 Oct 2014 17:20:33 +0000 (17:20 +0000)
Hoist the IgnoreParens so that we ignore it around attributes as well in order
to future-proof the code.  Addresses Richard's comments for SVN r219974.

llvm-svn: 220053

clang/lib/Sema/SemaStmt.cpp

index 8a28b29a1cabc1be32f9eb846ac4f5297aa778a0..0c2d9e3e7a07c30a3d163f7adfed667cc4448fda 100644 (file)
@@ -2756,10 +2756,10 @@ bool LocalTypedefNameReferencer::VisitRecordType(const RecordType *RT) {
 }
 
 TypeLoc Sema::getReturnTypeLoc(FunctionDecl *FD) const {
-  TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc();
+  TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc().IgnoreParens();
   while (auto ATL = TL.getAs<AttributedTypeLoc>())
     TL = ATL.getModifiedLoc().IgnoreParens();
-  return TL.IgnoreParens().castAs<FunctionProtoTypeLoc>().getReturnLoc();
+  return TL.castAs<FunctionProtoTypeLoc>().getReturnLoc();
 }
 
 /// Deduce the return type for a function from a returned expression, per