]> granicus.if.org Git - clang/commitdiff
Small cleanup: move trailing-return-type special-casing into
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 15 Mar 2012 01:02:11 +0000 (01:02 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 15 Mar 2012 01:02:11 +0000 (01:02 +0000)
getDeclSpecContextFromDeclaratorContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152766 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp

index 3ff9da035fd961af40c5b178ec345f63c43764d1..2fac0dca40253b4be04c792f4e78d8c8c9227de5 100644 (file)
@@ -36,9 +36,7 @@ TypeResult Parser::ParseTypeName(SourceRange *Range,
                                  Declarator::TheContext Context,
                                  AccessSpecifier AS,
                                  Decl **OwnedType) {
-  DeclSpecContext DSC = DSC_normal;
-  if (Context == Declarator::TrailingReturnContext)
-    DSC = DSC_trailing;
+  DeclSpecContext DSC = getDeclSpecContextFromDeclaratorContext(Context);
 
   // Parse the common declaration-specifiers piece.
   DeclSpec DS(AttrFactory);
@@ -1629,6 +1627,8 @@ Parser::getDeclSpecContextFromDeclaratorContext(unsigned Context) {
     return DSC_class;
   if (Context == Declarator::FileContext)
     return DSC_top_level;
+  if (Context == Declarator::TrailingReturnContext)
+    return DSC_trailing;
   return DSC_normal;
 }