One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112244 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index 61c4d3e..d327db4 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -27,7 +27,7 @@
   assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try)) &&
          "Current token not a '{', ':' or 'try'!");
 
-  Action::MultiTemplateParamsArg TemplateParams(Actions,
+  MultiTemplateParamsArg TemplateParams(Actions,
           TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->data() : 0,
           TemplateInfo.TemplateParams ? TemplateInfo.TemplateParams->size() : 0);
 
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 8db4964..0cc9103 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -15,6 +15,7 @@
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Sema/Scope.h"
 #include "clang/Sema/ParsedTemplate.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
 #include "RAIIObjectsForParser.h"
 #include "llvm/ADT/SmallSet.h"
 using namespace clang;
@@ -28,7 +29,7 @@
 ///         specifier-qualifier-list abstract-declarator[opt]
 ///
 /// Called type-id in C++.
-Action::TypeResult Parser::ParseTypeName(SourceRange *Range) {
+TypeResult Parser::ParseTypeName(SourceRange *Range) {
   // Parse the common declaration-specifiers piece.
   DeclSpec DS;
   ParseSpecifierQualifierList(DS);
@@ -541,7 +542,7 @@
   case ParsedTemplateInfo::Template:
   case ParsedTemplateInfo::ExplicitSpecialization:
     ThisDecl = Actions.ActOnTemplateDeclarator(getCurScope(),
-                             Action::MultiTemplateParamsArg(Actions,
+                             MultiTemplateParamsArg(Actions,
                                           TemplateInfo.TemplateParams->data(),
                                           TemplateInfo.TemplateParams->size()),
                                                D);
@@ -870,7 +871,7 @@
       return;
 
     case tok::code_completion: {
-      Action::ParserCompletionContext CCC = Action::PCC_Namespace;
+      Sema::ParserCompletionContext CCC = Sema::PCC_Namespace;
       if (DS.hasTypeSpecifier()) {
         bool AllowNonIdentifiers
           = (getCurScope()->getFlags() & (Scope::ControlScope |
@@ -889,12 +890,12 @@
       } 
       
       if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate)
-        CCC = DSContext == DSC_class? Action::PCC_MemberTemplate 
-                                    : Action::PCC_Template;
+        CCC = DSContext == DSC_class? Sema::PCC_MemberTemplate 
+                                    : Sema::PCC_Template;
       else if (DSContext == DSC_class)
-        CCC = Action::PCC_Class;
+        CCC = Sema::PCC_Class;
       else if (ObjCImpDecl)
-        CCC = Action::PCC_ObjCImplementation;
+        CCC = Sema::PCC_ObjCImplementation;
       
       Actions.CodeCompleteOrdinaryName(getCurScope(), CCC);
       ConsumeCodeCompletionToken();
@@ -1798,9 +1799,8 @@
 ///
 void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
                                   unsigned TagType, Decl *TagDecl) {
-  PrettyStackTraceActionsDecl CrashInfo(TagDecl, RecordLoc, Actions,
-                                        PP.getSourceManager(),
-                                        "parsing struct/union body");
+  PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc,
+                                      "parsing struct/union body");
 
   SourceLocation LBraceLoc = ConsumeBrace();
 
@@ -1972,18 +1972,18 @@
   // enum foo {..};  void bar() { enum foo; }    <- new foo in bar.
   // enum foo {..};  void bar() { enum foo x; }  <- use of old foo.
   //
-  Action::TagUseKind TUK;
+  Sema::TagUseKind TUK;
   if (Tok.is(tok::l_brace))
-    TUK = Action::TUK_Definition;
+    TUK = Sema::TUK_Definition;
   else if (Tok.is(tok::semi))
-    TUK = Action::TUK_Declaration;
+    TUK = Sema::TUK_Declaration;
   else
-    TUK = Action::TUK_Reference;
+    TUK = Sema::TUK_Reference;
   
   // enums cannot be templates, although they can be referenced from a 
   // template.
   if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate &&
-      TUK != Action::TUK_Reference) {
+      TUK != Sema::TUK_Reference) {
     Diag(Tok, diag::err_enum_template);
     
     // Skip the rest of this declarator, up until the comma or semicolon.
@@ -1999,7 +1999,7 @@
   Decl *TagDecl = Actions.ActOnTag(getCurScope(), DeclSpec::TST_enum, TUK,
                                    StartLoc, SS, Name, NameLoc, Attr.get(),
                                    AS,
-                                   Action::MultiTemplateParamsArg(Actions),
+                                   MultiTemplateParamsArg(Actions),
                                    Owned, IsDependent);
   if (IsDependent) {
     // This enum has a dependent nested-name-specifier. Handle it as a 
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index d80410c..df707b2 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -17,6 +17,7 @@
 #include "clang/Sema/DeclSpec.h"
 #include "clang/Sema/Scope.h"
 #include "clang/Sema/ParsedTemplate.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
 #include "RAIIObjectsForParser.h"
 using namespace clang;
 
@@ -102,9 +103,8 @@
     Actions.ActOnStartNamespaceDef(getCurScope(), IdentLoc, Ident, LBrace,
                                    AttrList.get());
 
-  PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions,
-                                        PP.getSourceManager(),
-                                        "parsing namespace");
+  PrettyDeclStackTraceEntry CrashInfo(Actions, NamespcDecl, NamespaceLoc,
+                                      "parsing namespace");
 
   while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
     CXX0XAttributeList Attr;
@@ -439,7 +439,7 @@
   // C++0x [dcl.type.simple]p4:
   //   The operand of the decltype specifier is an unevaluated operand.
   EnterExpressionEvaluationContext Unevaluated(Actions,
-                                               Action::Unevaluated);
+                                               Sema::Unevaluated);
   ExprResult Result = ParseExpression();
   if (Result.isInvalid()) {
     SkipUntil(tok::r_paren);
@@ -784,9 +784,9 @@
   // or
   // &T::operator struct s;
   // For these, SuppressDeclarations is true.
-  Action::TagUseKind TUK;
+  Sema::TagUseKind TUK;
   if (SuppressDeclarations)
-    TUK = Action::TUK_Reference;
+    TUK = Sema::TUK_Reference;
   else if (Tok.is(tok::l_brace) || (getLang().CPlusPlus && Tok.is(tok::colon))){
     if (DS.isFriendSpecified()) {
       // C++ [class.friend]p2:
@@ -797,18 +797,18 @@
       // Skip everything up to the semicolon, so that this looks like a proper
       // friend class (or template thereof) declaration.
       SkipUntil(tok::semi, true, true);
-      TUK = Action::TUK_Friend;
+      TUK = Sema::TUK_Friend;
     } else {
       // Okay, this is a class definition.
-      TUK = Action::TUK_Definition;
+      TUK = Sema::TUK_Definition;
     }
   } else if (Tok.is(tok::semi))
-    TUK = DS.isFriendSpecified() ? Action::TUK_Friend : Action::TUK_Declaration;
+    TUK = DS.isFriendSpecified() ? Sema::TUK_Friend : Sema::TUK_Declaration;
   else
-    TUK = Action::TUK_Reference;
+    TUK = Sema::TUK_Reference;
 
   if (!Name && !TemplateId && (DS.getTypeSpecType() == DeclSpec::TST_error ||
-                               TUK != Action::TUK_Definition)) {
+                               TUK != Sema::TUK_Definition)) {
     if (DS.getTypeSpecType() != DeclSpec::TST_error) {
       // We have a declaration or reference to an anonymous class.
       Diag(StartLoc, diag::err_anon_type_definition)
@@ -834,7 +834,7 @@
                                        TemplateId->getTemplateArgs(),
                                        TemplateId->NumArgs);
     if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
-        TUK == Action::TUK_Declaration) {
+        TUK == Sema::TUK_Declaration) {
       // This is an explicit instantiation of a class template.
       TagOrTempResult
         = Actions.ActOnExplicitInstantiation(getCurScope(),
@@ -854,8 +854,8 @@
     // they have template headers, in which case they're ill-formed
     // (FIXME: "template <class T> friend class A<T>::B<int>;").
     // We diagnose this error in ActOnClassTemplateSpecialization.
-    } else if (TUK == Action::TUK_Reference ||
-               (TUK == Action::TUK_Friend &&
+    } else if (TUK == Sema::TUK_Reference ||
+               (TUK == Sema::TUK_Friend &&
                 TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate)) {
       TypeResult
         = Actions.ActOnTemplateIdType(TemplateId->Template,
@@ -880,7 +880,7 @@
         // but it actually has a definition. Most likely, this was
         // meant to be an explicit specialization, but the user forgot
         // the '<>' after 'template'.
-        assert(TUK == Action::TUK_Definition && "Expected a definition here");
+        assert(TUK == Sema::TUK_Definition && "Expected a definition here");
 
         SourceLocation LAngleLoc
           = PP.getLocForEndOfToken(TemplateInfo.TemplateLoc);
@@ -911,13 +911,13 @@
                        TemplateArgsPtr,
                        TemplateId->RAngleLoc,
                        AttrList,
-                       Action::MultiTemplateParamsArg(Actions,
+                       MultiTemplateParamsArg(Actions,
                                     TemplateParams? &(*TemplateParams)[0] : 0,
                                  TemplateParams? TemplateParams->size() : 0));
     }
     TemplateId->Destroy();
   } else if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
-             TUK == Action::TUK_Declaration) {
+             TUK == Sema::TUK_Declaration) {
     // Explicit instantiation of a member of a class template
     // specialization, e.g.,
     //
@@ -931,7 +931,7 @@
                                            NameLoc, AttrList);
   } else {
     if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
-        TUK == Action::TUK_Definition) {
+        TUK == Sema::TUK_Definition) {
       // FIXME: Diagnose this particular error.
     }
 
@@ -940,7 +940,7 @@
     // Declaration or definition of a class type
     TagOrTempResult = Actions.ActOnTag(getCurScope(), TagType, TUK, StartLoc, SS,
                                        Name, NameLoc, AttrList, AS,
-                                  Action::MultiTemplateParamsArg(Actions,
+                                       MultiTemplateParamsArg(Actions,
                                     TemplateParams? &(*TemplateParams)[0] : 0,
                                     TemplateParams? TemplateParams->size() : 0),
                                        Owned, IsDependent);
@@ -953,7 +953,7 @@
   }
 
   // If there is a body, parse it and inform the actions module.
-  if (TUK == Action::TUK_Definition) {
+  if (TUK == Sema::TUK_Definition) {
     assert(Tok.is(tok::l_brace) ||
            (getLang().CPlusPlus && Tok.is(tok::colon)));
     if (getLang().CPlusPlus)
@@ -990,7 +990,7 @@
   // the end of the declaration and recover that way.
   //
   // This switch enumerates the valid "follow" set for definition.
-  if (TUK == Action::TUK_Definition) {
+  if (TUK == Sema::TUK_Definition) {
     bool ExpectedSemi = true;
     switch (Tok.getKind()) {
     default: break;
@@ -1337,7 +1337,7 @@
   DS.AddAttributes(AttrList.AttrList);
   ParseDeclarationSpecifiers(DS, TemplateInfo, AS, DSC_class);
 
-  Action::MultiTemplateParamsArg TemplateParams(Actions,
+  MultiTemplateParamsArg TemplateParams(Actions,
       TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->data() : 0,
       TemplateInfo.TemplateParams? TemplateInfo.TemplateParams->size() : 0);
 
@@ -1538,9 +1538,8 @@
          TagType == DeclSpec::TST_union  ||
          TagType == DeclSpec::TST_class) && "Invalid TagType!");
 
-  PrettyStackTraceActionsDecl CrashInfo(TagDecl, RecordLoc, Actions,
-                                        PP.getSourceManager(),
-                                        "parsing struct/union/class body");
+  PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc,
+                                      "parsing struct/union/class body");
 
   // Determine whether this is a non-nested class. Note that local
   // classes are *not* considered to be nested classes.
@@ -2062,8 +2061,7 @@
 /// [C++0x] 'align' '(' assignment-expression ')'
 ExprResult Parser::ParseCXX0XAlignArgument(SourceLocation Start) {
   if (isTypeIdInParens()) {
-    EnterExpressionEvaluationContext Unevaluated(Actions,
-                                                  Action::Unevaluated);
+    EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
     SourceLocation TypeLoc = Tok.getLocation();
     ParsedType Ty = ParseTypeName().get();
     SourceRange TypeRange(Start, Tok.getLocation());
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 7020fa4..d70eb63 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -220,7 +220,7 @@
 ///
 ExprResult Parser::ParseAssignmentExpression() {
   if (Tok.is(tok::code_completion)) {
-    Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Expression);
+    Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Expression);
     ConsumeCodeCompletionToken();
   }
 
@@ -261,7 +261,7 @@
   //   An expression is potentially evaluated unless it appears where an
   //   integral constant expression is required (see 5.19) [...].
   EnterExpressionEvaluationContext Unevaluated(Actions,
-                                               Action::Unevaluated);
+                                               Sema::Unevaluated);
 
   ExprResult LHS(ParseCastExpression(false));
   if (LHS.isInvalid()) return move(LHS);
@@ -905,7 +905,7 @@
   case tok::caret:
     return ParsePostfixExpressionSuffix(ParseBlockLiteralExpression());
   case tok::code_completion:
-    Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Expression);
+    Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Expression);
     ConsumeCodeCompletionToken();
     return ParseCastExpression(isUnaryExpression, isAddressOfOperand, 
                                NotCastExpr, TypeOfCast);
@@ -995,7 +995,7 @@
       }
       
       if (Tok.isNot(tok::r_paren)) {
-        if (ParseExpressionList(ArgExprs, CommaLocs, &Action::CodeCompleteCall,
+        if (ParseExpressionList(ArgExprs, CommaLocs, &Sema::CodeCompleteCall,
                                 LHS.get())) {
           SkipUntil(tok::r_paren);
           return ExprError();
@@ -1132,7 +1132,7 @@
     // The GNU typeof and alignof extensions also behave as unevaluated
     // operands.
     EnterExpressionEvaluationContext Unevaluated(Actions,
-                                                 Action::Unevaluated);
+                                                 Sema::Unevaluated);
     Operand = ParseCastExpression(true/*isUnaryExpression*/);
   } else {
     // If it starts with a '(', we know that it is either a parenthesized
@@ -1149,7 +1149,7 @@
     // The GNU typeof and alignof extensions also behave as unevaluated
     // operands.
     EnterExpressionEvaluationContext Unevaluated(Actions,
-                                                 Action::Unevaluated);
+                                                 Sema::Unevaluated);
     Operand = ParseParenExpression(ExprType, true/*stopIfCastExpr*/, 
                                    ParsedType(), CastTy, RParenLoc);
     CastRange = SourceRange(LParenLoc, RParenLoc);
@@ -1287,9 +1287,9 @@
     }
 
     // Keep track of the various subcomponents we see.
-    llvm::SmallVector<Action::OffsetOfComponent, 4> Comps;
+    llvm::SmallVector<Sema::OffsetOfComponent, 4> Comps;
 
-    Comps.push_back(Action::OffsetOfComponent());
+    Comps.push_back(Sema::OffsetOfComponent());
     Comps.back().isBrackets = false;
     Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
     Comps.back().LocStart = Comps.back().LocEnd = ConsumeToken();
@@ -1298,7 +1298,7 @@
     while (1) {
       if (Tok.is(tok::period)) {
         // offsetof-member-designator: offsetof-member-designator '.' identifier
-        Comps.push_back(Action::OffsetOfComponent());
+        Comps.push_back(Sema::OffsetOfComponent());
         Comps.back().isBrackets = false;
         Comps.back().LocStart = ConsumeToken();
 
@@ -1312,7 +1312,7 @@
 
       } else if (Tok.is(tok::l_square)) {
         // offsetof-member-designator: offsetof-member-design '[' expression ']'
-        Comps.push_back(Action::OffsetOfComponent());
+        Comps.push_back(Sema::OffsetOfComponent());
         Comps.back().isBrackets = true;
         Comps.back().LocStart = ConsumeBracket();
         Res = ParseExpression();
@@ -1579,7 +1579,7 @@
 ///
 bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
                             llvm::SmallVectorImpl<SourceLocation> &CommaLocs,
-                                 void (Action::*Completer)(Scope *S, 
+                                 void (Sema::*Completer)(Scope *S, 
                                                            Expr *Data,
                                                            Expr **Args,
                                                            unsigned NumArgs),
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index de9498e..7270f6a 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -530,7 +530,7 @@
     // polymorphic class type until after we've parsed the expression, so
     // we the expression is potentially potentially evaluated.
     EnterExpressionEvaluationContext Unevaluated(Actions,
-                                       Action::PotentiallyPotentiallyEvaluated);
+                                       Sema::PotentiallyPotentiallyEvaluated);
     Result = ParseExpression();
 
     // Match the ')'.
@@ -735,7 +735,7 @@
                                SourceLocation Loc,
                                bool ConvertToBoolean) {
   if (Tok.is(tok::code_completion)) {
-    Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Condition);
+    Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Condition);
     ConsumeCodeCompletionToken();
   }
 
@@ -1147,7 +1147,7 @@
                                      TemplateArgs.size());
   
   // Constructor and destructor names.
-  Action::TypeResult Type
+  TypeResult Type
     = Actions.ActOnTemplateIdType(Template, NameLoc,
                                   LAngleLoc, TemplateArgsPtr,
                                   RAngleLoc);
@@ -1339,7 +1339,7 @@
   ParseDeclaratorInternal(D, /*DirectDeclParser=*/0);
   
   // Finish up the type.
-  Action::TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D);
+  TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D);
   if (Ty.isInvalid())
     return true;
   
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index 2589867..4347294 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -184,15 +184,15 @@
       // Three cases. This is a message send to a type: [type foo]
       // This is a message send to super:  [super foo]
       // This is a message sent to an expr:  [super.bar foo]
-      switch (Action::ObjCMessageKind Kind
+      switch (Sema::ObjCMessageKind Kind
                 = Actions.getObjCMessageKind(getCurScope(), II, IILoc, 
                                              II == Ident_super,
                                              NextToken().is(tok::period),
                                              ReceiverType)) {
-      case Action::ObjCSuperMessage:
-      case Action::ObjCClassMessage:
+      case Sema::ObjCSuperMessage:
+      case Sema::ObjCClassMessage:
         CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
-        if (Kind == Action::ObjCSuperMessage)
+        if (Kind == Sema::ObjCSuperMessage)
           return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
                                                              ConsumeToken(),
                                                              ParsedType(),
@@ -208,7 +208,7 @@
                                                            ReceiverType, 
                                                            0);
 
-      case Action::ObjCInstanceMessage:
+      case Sema::ObjCInstanceMessage:
         // Fall through; we'll just parse the expression and
         // (possibly) treat this like an Objective-C message send
         // later.
@@ -321,7 +321,7 @@
     if (!getLang().CPlusPlus)
       Diag(LBraceLoc, diag::ext_gnu_empty_initializer);
     // Match the '}'.
-    return Actions.ActOnInitList(LBraceLoc, Action::MultiExprArg(Actions),
+    return Actions.ActOnInitList(LBraceLoc, MultiExprArg(Actions),
                                  ConsumeBrace());
   }
 
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 4b65652..914d52e 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -14,6 +14,7 @@
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Parse/Parser.h"
 #include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
 #include "clang/Sema/Scope.h"
 #include "llvm/ADT/SmallVector.h"
 using namespace clang;
@@ -348,8 +349,8 @@
     // Code completion within an Objective-C interface.
     if (Tok.is(tok::code_completion)) {
       Actions.CodeCompleteOrdinaryName(getCurScope(), 
-                                  ObjCImpDecl? Action::PCC_ObjCImplementation
-                                             : Action::PCC_ObjCInterface);
+                                  ObjCImpDecl? Sema::PCC_ObjCImplementation
+                                             : Sema::PCC_ObjCInterface);
       ConsumeCodeCompletionToken();
     }
     
@@ -840,10 +841,10 @@
   }
 
   llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
-  llvm::SmallVector<Action::ObjCArgInfo, 12> ArgInfos;
+  llvm::SmallVector<Sema::ObjCArgInfo, 12> ArgInfos;
 
   while (1) {
-    Action::ObjCArgInfo ArgInfo;
+    Sema::ObjCArgInfo ArgInfo;
 
     // Each iteration parses a single keyword argument.
     if (Tok.isNot(tok::colon)) {
@@ -951,7 +952,7 @@
   PD.complete(Result);
   
   // Delete referenced AttributeList objects.
-  for (llvm::SmallVectorImpl<Action::ObjCArgInfo>::iterator
+  for (llvm::SmallVectorImpl<Sema::ObjCArgInfo>::iterator
        I = ArgInfos.begin(), E = ArgInfos.end(); I != E; ++I)
     delete I->ArgAttrs;
   
@@ -1076,7 +1077,7 @@
 
     if (Tok.is(tok::code_completion)) {
       Actions.CodeCompleteOrdinaryName(getCurScope(), 
-                                       Action::PCC_ObjCInstanceVariableList);
+                                       Sema::PCC_ObjCInstanceVariableList);
       ConsumeCodeCompletionToken();
     }
     
@@ -1634,9 +1635,8 @@
 Decl *Parser::ParseObjCMethodDefinition() {
   Decl *MDecl = ParseObjCMethodPrototype(ObjCImpDecl);
 
-  PrettyStackTraceActionsDecl CrashInfo(MDecl, Tok.getLocation(), Actions,
-                                        PP.getSourceManager(),
-                                        "parsing Objective-C method");
+  PrettyDeclStackTraceEntry CrashInfo(Actions, MDecl, Tok.getLocation(),
+                                      "parsing Objective-C method");
 
   // parse optional ';'
   if (Tok.is(tok::semi)) {
@@ -1896,11 +1896,11 @@
                                        Name == Ident_super,
                                        NextToken().is(tok::period),
                                        ReceiverType)) {
-    case Action::ObjCSuperMessage:
+    case Sema::ObjCSuperMessage:
       return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(),
                                             ParsedType(), 0);
 
-    case Action::ObjCClassMessage:
+    case Sema::ObjCClassMessage:
       if (!ReceiverType) {
         SkipUntil(tok::r_square);
         return ExprError();
@@ -1911,7 +1911,7 @@
       return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), 
                                             ReceiverType, 0);
         
-    case Action::ObjCInstanceMessage:
+    case Sema::ObjCInstanceMessage:
       // Fall through to parse an expression.
       break;
     }
@@ -2090,20 +2090,20 @@
   if (SuperLoc.isValid())
     return Actions.ActOnSuperMessage(getCurScope(), SuperLoc, Sel,
                                      LBracLoc, SelectorLoc, RBracLoc,
-                                     Action::MultiExprArg(Actions, 
-                                                          KeyExprs.take(),
-                                                          KeyExprs.size()));
+                                     MultiExprArg(Actions, 
+                                                  KeyExprs.take(),
+                                                  KeyExprs.size()));
   else if (ReceiverType)
     return Actions.ActOnClassMessage(getCurScope(), ReceiverType, Sel,
                                      LBracLoc, SelectorLoc, RBracLoc,
-                                     Action::MultiExprArg(Actions, 
-                                                          KeyExprs.take(), 
-                                                          KeyExprs.size()));
+                                     MultiExprArg(Actions, 
+                                                  KeyExprs.take(), 
+                                                  KeyExprs.size()));
   return Actions.ActOnInstanceMessage(getCurScope(), ReceiverExpr, Sel,
                                       LBracLoc, SelectorLoc, RBracLoc,
-                                      Action::MultiExprArg(Actions, 
-                                                           KeyExprs.take(), 
-                                                           KeyExprs.size()));
+                                      MultiExprArg(Actions, 
+                                                   KeyExprs.take(), 
+                                                   KeyExprs.size()));
 }
 
 ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp
index e4693ad..ddba09a 100644
--- a/lib/Parse/ParsePragma.cpp
+++ b/lib/Parse/ParsePragma.cpp
@@ -15,7 +15,6 @@
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Parse/Parser.h"
 #include "clang/Lex/Preprocessor.h"
-#include "clang/Sema/Action.h"
 using namespace clang;
 
 
@@ -85,7 +84,7 @@
     return;
   }
 
-  Action::PragmaPackKind Kind = Action::PPK_Default;
+  Sema::PragmaPackKind Kind = Sema::PPK_Default;
   IdentifierInfo *Name = 0;
   ExprResult Alignment;
   SourceLocation LParenLoc = Tok.getLocation();
@@ -99,13 +98,13 @@
   } else if (Tok.is(tok::identifier)) {
     const IdentifierInfo *II = Tok.getIdentifierInfo();
     if (II->isStr("show")) {
-      Kind = Action::PPK_Show;
+      Kind = Sema::PPK_Show;
       PP.Lex(Tok);
     } else {
       if (II->isStr("push")) {
-        Kind = Action::PPK_Push;
+        Kind = Sema::PPK_Push;
       } else if (II->isStr("pop")) {
-        Kind = Action::PPK_Pop;
+        Kind = Sema::PPK_Pop;
       } else {
         PP.Diag(Tok.getLocation(), diag::warn_pragma_pack_invalid_action);
         return;
@@ -165,7 +164,7 @@
 
 // #pragma 'align' '=' {'native','natural','mac68k','power','reset'}
 // #pragma 'options 'align' '=' {'native','natural','mac68k','power','reset'}
-static void ParseAlignPragma(Action &Actions, Preprocessor &PP, Token &FirstTok,
+static void ParseAlignPragma(Sema &Actions, Preprocessor &PP, Token &FirstTok,
                              bool IsOptions) {
   Token Tok;
 
@@ -192,20 +191,20 @@
     return;
   }
 
-  Action::PragmaOptionsAlignKind Kind = Action::POAK_Natural;
+  Sema::PragmaOptionsAlignKind Kind = Sema::POAK_Natural;
   const IdentifierInfo *II = Tok.getIdentifierInfo();
   if (II->isStr("native"))
-    Kind = Action::POAK_Native;
+    Kind = Sema::POAK_Native;
   else if (II->isStr("natural"))
-    Kind = Action::POAK_Natural;
+    Kind = Sema::POAK_Natural;
   else if (II->isStr("packed"))
-    Kind = Action::POAK_Packed;
+    Kind = Sema::POAK_Packed;
   else if (II->isStr("power"))
-    Kind = Action::POAK_Power;
+    Kind = Sema::POAK_Power;
   else if (II->isStr("mac68k"))
-    Kind = Action::POAK_Mac68k;
+    Kind = Sema::POAK_Mac68k;
   else if (II->isStr("reset"))
-    Kind = Action::POAK_Reset;
+    Kind = Sema::POAK_Reset;
   else {
     PP.Diag(Tok.getLocation(), diag::warn_pragma_align_invalid_option)
       << IsOptions;
diff --git a/lib/Parse/ParsePragma.h b/lib/Parse/ParsePragma.h
index 8aef400..0feaa99 100644
--- a/lib/Parse/ParsePragma.h
+++ b/lib/Parse/ParsePragma.h
@@ -17,58 +17,58 @@
 #include "clang/Lex/Pragma.h"
 
 namespace clang {
-  class Action;
+  class Sema;
   class Parser;
 
 class PragmaAlignHandler : public PragmaHandler {
-  Action &Actions;
+  Sema &Actions;
 public:
-  explicit PragmaAlignHandler(Action &A) : PragmaHandler("align"), Actions(A) {}
+  explicit PragmaAlignHandler(Sema &A) : PragmaHandler("align"), Actions(A) {}
 
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
 };
 
 class PragmaGCCVisibilityHandler : public PragmaHandler {
-  Action &Actions;
+  Sema &Actions;
 public:
-  explicit PragmaGCCVisibilityHandler(Action &A) : PragmaHandler("visibility"),
-                                                   Actions(A) {}
+  explicit PragmaGCCVisibilityHandler(Sema &A) : PragmaHandler("visibility"),
+                                                 Actions(A) {}
 
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
 };
 
 class PragmaOptionsHandler : public PragmaHandler {
-  Action &Actions;
+  Sema &Actions;
 public:
-  explicit PragmaOptionsHandler(Action &A) : PragmaHandler("options"),
-                                             Actions(A) {}
+  explicit PragmaOptionsHandler(Sema &A) : PragmaHandler("options"),
+                                           Actions(A) {}
 
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
 };
 
 class PragmaPackHandler : public PragmaHandler {
-  Action &Actions;
+  Sema &Actions;
 public:
-  explicit PragmaPackHandler(Action &A) : PragmaHandler("pack"),
-                                          Actions(A) {}
+  explicit PragmaPackHandler(Sema &A) : PragmaHandler("pack"),
+                                        Actions(A) {}
 
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
 };
 
 class PragmaUnusedHandler : public PragmaHandler {
-  Action &Actions;
+  Sema &Actions;
   Parser &parser;
 public:
-  PragmaUnusedHandler(Action &A, Parser& p)
+  PragmaUnusedHandler(Sema &A, Parser& p)
     : PragmaHandler("unused"), Actions(A), parser(p) {}
 
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
 };
 
 class PragmaWeakHandler : public PragmaHandler {
-  Action &Actions;
+  Sema &Actions;
 public:
-  explicit PragmaWeakHandler(Action &A)
+  explicit PragmaWeakHandler(Sema &A)
     : PragmaHandler("weak"), Actions(A) {}
 
   virtual void HandlePragma(Preprocessor &PP, Token &FirstToken);
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 6e0a482..af92728 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -15,6 +15,7 @@
 #include "clang/Parse/Parser.h"
 #include "RAIIObjectsForParser.h"
 #include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/PrettyDeclStackTrace.h"
 #include "clang/Sema/Scope.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/PrettyStackTrace.h"
@@ -98,7 +99,7 @@
     }
 
   case tok::code_completion:
-    Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Statement);
+    Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Statement);
     ConsumeCodeCompletionToken();
     return ParseStatementOrDeclaration(OnlyStatement);
       
@@ -994,8 +995,8 @@
   
   if (Tok.is(tok::code_completion)) {
     Actions.CodeCompleteOrdinaryName(getCurScope(), 
-                                     C99orCXXorObjC? Action::PCC_ForInit
-                                                   : Action::PCC_Expression);
+                                     C99orCXXorObjC? Sema::PCC_ForInit
+                                                   : Sema::PCC_Expression);
     ConsumeCodeCompletionToken();
   }
   
@@ -1468,9 +1469,8 @@
   assert(Tok.is(tok::l_brace));
   SourceLocation LBraceLoc = Tok.getLocation();
 
-  PrettyStackTraceActionsDecl CrashInfo(Decl, LBraceLoc, Actions,
-                                        PP.getSourceManager(),
-                                        "parsing function body");
+  PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, LBraceLoc,
+                                      "parsing function body");
 
   // Do not enter a scope for the brace, as the arguments are in the same scope
   // (the function body) as the body itself.  Instead, just read the statement
@@ -1494,9 +1494,8 @@
   assert(Tok.is(tok::kw_try) && "Expected 'try'");
   SourceLocation TryLoc = ConsumeToken();
 
-  PrettyStackTraceActionsDecl CrashInfo(Decl, TryLoc, Actions,
-                                        PP.getSourceManager(),
-                                        "parsing function try block");
+  PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, TryLoc,
+                                      "parsing function try block");
 
   // Constructor initializer list?
   if (Tok.is(tok::colon))
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index d9a468e..dfb4785 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -772,7 +772,7 @@
 
   // Build the annotation token.
   if (TNK == TNK_Type_template && AllowTypeAnnotation) {
-    Action::TypeResult Type
+    TypeResult Type
       = Actions.ActOnTemplateIdType(Template, TemplateNameLoc,
                                     LAngleLoc, TemplateArgsPtr,
                                     RAngleLoc);
@@ -850,7 +850,7 @@
                                      TemplateId->getTemplateArgs(),
                                      TemplateId->NumArgs);
 
-  Action::TypeResult Type
+  TypeResult Type
     = Actions.ActOnTemplateIdType(TemplateId->Template,
                                   TemplateId->TemplateNameLoc,
                                   TemplateId->LAngleLoc,
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 23c13eb..a5002b0 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -21,7 +21,7 @@
 #include "ParsePragma.h"
 using namespace clang;
 
-Parser::Parser(Preprocessor &pp, Action &actions)
+Parser::Parser(Preprocessor &pp, Sema &actions)
   : CrashInfo(*this), PP(pp), Actions(actions), Diags(PP.getDiagnostics()),
     GreaterThanIsOperator(true), ColonIsSacred(false),
     TemplateParameterDepth(0) {
@@ -467,8 +467,8 @@
     break;
   case tok::code_completion:
       Actions.CodeCompleteOrdinaryName(getCurScope(), 
-                                   ObjCImpDecl? Action::PCC_ObjCImplementation
-                                              : Action::PCC_Namespace);
+                                   ObjCImpDecl? Sema::PCC_ObjCImplementation
+                                              : Sema::PCC_Namespace);
     ConsumeCodeCompletionToken();
     return ParseExternalDeclaration(Attr);
   case tok::kw_using:
@@ -680,7 +680,7 @@
   // specified Declarator for the function.
   Decl *Res = TemplateInfo.TemplateParams?
       Actions.ActOnStartOfFunctionTemplateDef(getCurScope(),
-                              Action::MultiTemplateParamsArg(Actions,
+                              MultiTemplateParamsArg(Actions,
                                           TemplateInfo.TemplateParams->data(),
                                          TemplateInfo.TemplateParams->size()),
                                               D)
@@ -1110,17 +1110,17 @@
 void Parser::CodeCompletionRecovery() {
   for (Scope *S = getCurScope(); S; S = S->getParent()) {
     if (S->getFlags() & Scope::FnScope) {
-      Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_RecoveryInFunction);
+      Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_RecoveryInFunction);
       return;
     }
     
     if (S->getFlags() & Scope::ClassScope) {
-      Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Class);
+      Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Class);
       return;
     }
   }
   
-  Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Namespace);
+  Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Namespace);
 }
 
 // Anchor the Parser::FieldCallback vtable to this translation unit.