]> granicus.if.org Git - clang/commitdiff
Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 10 May 2014 16:31:55 +0000 (16:31 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 10 May 2014 16:31:55 +0000 (16:31 +0000)
Required pulling LambdaExpr::Capture into its own header.
No functionality change.

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

36 files changed:
include/clang/AST/DataRecursiveASTVisitor.h
include/clang/AST/Decl.h
include/clang/AST/DeclBase.h
include/clang/AST/DeclCXX.h
include/clang/AST/DeclFriend.h
include/clang/AST/DeclarationName.h
include/clang/AST/ExprCXX.h
include/clang/AST/LambdaCapture.h [new file with mode: 0644]
include/clang/AST/RecursiveASTVisitor.h
include/clang/AST/TemplateName.h
include/clang/AST/Type.h
include/clang/Basic/Diagnostic.h
include/clang/Basic/DiagnosticOptions.h
include/clang/Basic/IdentifierTable.h
include/clang/Basic/Linkage.h
include/clang/Basic/OperatorKinds.h
include/clang/Sema/DeclSpec.h
include/clang/Serialization/ASTDeserializationListener.h
lib/AST/DeclCXX.cpp
lib/AST/ExprCXX.cpp
lib/Basic/IdentifierTable.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/Format/Format.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaCodeComplete.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaLambda.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaPseudoObject.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriter.cpp
lib/StaticAnalyzer/Core/PathDiagnostic.cpp
lib/Tooling/CompilationDatabase.cpp
tools/libclang/IndexBody.cpp
unittests/Lex/PPCallbacksTest.cpp

index b515b6e04ab184cca4faf34c6be5142ee2451799..57d1e2acd0c4702117b274120fbd08c017b9b1cb 100644 (file)
@@ -244,7 +244,7 @@ public:
   /// \brief Recursively visit a lambda capture.
   ///
   /// \returns false if the visitation was terminated early, true otherwise.
-  bool TraverseLambdaCapture(LambdaExpr::Capture C);
+  bool TraverseLambdaCapture(LambdaCapture C);
 
   // ---- Methods on Attrs ----
 
@@ -783,8 +783,8 @@ bool DataRecursiveASTVisitor<Derived>::TraverseConstructorInitializer(
   return true;
 }
 
-template<typename Derived>
-bool DataRecursiveASTVisitor<Derived>::TraverseLambdaCapture(LambdaExpr::Capture C){
+template <typename Derived>
+bool DataRecursiveASTVisitor<Derived>::TraverseLambdaCapture(LambdaCapture C) {
   return true;
 }
 
index d18653ef9a4a884f8bcd6a48b05a3dd26520bd6e..91b1b23e222408d3e33a64be276b24a0d16ca5b0 100644 (file)
 #include "clang/AST/Redeclarable.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/Linkage.h"
+#include "clang/Basic/OperatorKinds.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/raw_ostream.h"
 
 namespace clang {
 struct ASTTemplateArgumentListInfo;
index eb11d8bbeca79361aa6b278e613cd8ce2b5ecc14..b832123719d0d4b919072169c974540918ddb050 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "clang/AST/AttrIterator.h"
 #include "clang/AST/DeclarationName.h"
-#include "clang/Basic/Linkage.h"
 #include "clang/Basic/Specifiers.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/iterator_range.h"
@@ -34,6 +33,7 @@ class DependentDiagnostic;
 class EnumDecl;
 class FunctionDecl;
 class FunctionType;
+enum Linkage : unsigned char;
 class LinkageComputer;
 class LinkageSpecDecl;
 class Module;
index 57c3b6fcb4f8bb9b63228339506dfd48b0d6c7fa..8f0b36cb6b088edf0c5269b107a073388a8221a8 100644 (file)
 #include "clang/AST/Attr.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Expr.h"
-#include "clang/AST/ExprCXX.h"
-#include "clang/AST/TypeLoc.h"
+#include "clang/AST/LambdaCapture.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
-#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/Support/Compiler.h"
 
 namespace clang {
@@ -500,7 +498,7 @@ class CXXRecordDecl : public RecordDecl {
 
   /// \brief Describes a C++ closure type (generated by a lambda expression).
   struct LambdaDefinitionData : public DefinitionData {
-    typedef LambdaExpr::Capture Capture;
+    typedef LambdaCapture Capture;
 
     LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info, 
                          bool Dependent, bool IsGeneric, 
@@ -1019,7 +1017,7 @@ public:
   void getCaptureFields(llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
                         FieldDecl *&ThisCapture) const;
 
-  typedef const LambdaExpr::Capture* capture_const_iterator;
+  typedef const LambdaCapture *capture_const_iterator;
   typedef llvm::iterator_range<capture_const_iterator> capture_const_range;
 
   capture_const_range captures() const {
@@ -1943,7 +1941,7 @@ public:
   /// In-class member initializers (also known as "non-static data member
   /// initializations", NSDMIs) were introduced in C++11.
   bool isInClassMemberInitializer() const {
-    return isa<CXXDefaultInitExpr>(Init);
+    return Init->getStmtClass() == Stmt::CXXDefaultInitExprClass;
   }
 
   /// \brief Determine whether this initializer is creating a delegating
index cd1aa717b4fe15db19dae6232cac7a9dd91750a3..97741c1c37f6d4b07000c89dd4d9114f1e15f165 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/TypeLoc.h"
 #include "llvm/Support/Compiler.h"
 
 namespace clang {
index ab1575c2201819d96a4bb6f60fdc244d0d4eebfe..08f45fcdcfe8af3c5e6b36c0bad9a291221777c1 100644 (file)
@@ -29,6 +29,7 @@ namespace clang {
   class DeclarationNameExtra;
   class IdentifierInfo;
   class MultiKeywordSelector;
+  enum OverloadedOperatorKind : unsigned char;
   class QualType;
   class Type;
   class TypeSourceInfo;
index 3cc00480b9e06ffb93f35809d4aeb9aa8ea40ac8..d641442f0a158650a80d4e7b1d3cf404a45a5efa 100644 (file)
@@ -20,7 +20,7 @@
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/UnresolvedSet.h"
 #include "clang/Basic/ExpressionTraits.h"
-#include "clang/Basic/Lambda.h"
+#include "clang/AST/LambdaCapture.h"
 #include "clang/Basic/TypeTraits.h"
 #include "llvm/Support/Compiler.h"
 
@@ -1310,18 +1310,6 @@ public:
 /// includes an initializing expression (rather than capturing a variable),
 /// and which can never occur implicitly.
 class LambdaExpr : public Expr {
-  enum {
-    /// \brief Flag used by the Capture class to indicate that the given
-    /// capture was implicit.
-    Capture_Implicit = 0x01,
-
-    /// \brief Flag used by the Capture class to indicate that the
-    /// given capture was by-copy.
-    ///
-    /// This includes the case of a non-reference init-capture.
-    Capture_ByCopy = 0x02
-  };
-
   /// \brief The source range that covers the lambda introducer ([...]).
   SourceRange IntroducerRange;
 
@@ -1360,93 +1348,8 @@ class LambdaExpr : public Expr {
   // expression, along with the index variables used to initialize by-copy
   // array captures.
 
-public:
-  /// \brief Describes the capture of a variable or of \c this, or of a
-  /// C++1y init-capture.
-  class Capture {
-    llvm::PointerIntPair<Decl *, 2> DeclAndBits;
-    SourceLocation Loc;
-    SourceLocation EllipsisLoc;
-    
-    friend class ASTStmtReader;
-    friend class ASTStmtWriter;
-    
-  public:
-    /// \brief Create a new capture of a variable or of \c this.
-    ///
-    /// \param Loc The source location associated with this capture.
-    ///
-    /// \param Kind The kind of capture (this, byref, bycopy), which must
-    /// not be init-capture.
-    ///
-    /// \param Implicit Whether the capture was implicit or explicit.
-    ///
-    /// \param Var The local variable being captured, or null if capturing
-    /// \c this.
-    ///
-    /// \param EllipsisLoc The location of the ellipsis (...) for a
-    /// capture that is a pack expansion, or an invalid source
-    /// location to indicate that this is not a pack expansion.
-    Capture(SourceLocation Loc, bool Implicit,
-            LambdaCaptureKind Kind, VarDecl *Var = nullptr,
-            SourceLocation EllipsisLoc = SourceLocation());
-
-    /// \brief Determine the kind of capture.
-    LambdaCaptureKind getCaptureKind() const;
-
-    /// \brief Determine whether this capture handles the C++ \c this
-    /// pointer.
-    bool capturesThis() const { return DeclAndBits.getPointer() == nullptr; }
-
-    /// \brief Determine whether this capture handles a variable.
-    bool capturesVariable() const {
-      return dyn_cast_or_null<VarDecl>(DeclAndBits.getPointer());
-    }
-
-    /// \brief Determine whether this is an init-capture.
-    bool isInitCapture() const {
-      return capturesVariable() && getCapturedVar()->isInitCapture();
-    }
-
-    /// \brief Retrieve the declaration of the local variable being
-    /// captured.
-    ///
-    /// This operation is only valid if this capture is a variable capture
-    /// (other than a capture of \c this).
-    VarDecl *getCapturedVar() const {
-      assert(capturesVariable() && "No variable available for 'this' capture");
-      return cast<VarDecl>(DeclAndBits.getPointer());
-    }
+  typedef LambdaCapture Capture;
 
-    /// \brief Determine whether this was an implicit capture (not
-    /// written between the square brackets introducing the lambda).
-    bool isImplicit() const { return DeclAndBits.getInt() & Capture_Implicit; }
-
-    /// \brief Determine whether this was an explicit capture (written
-    /// between the square brackets introducing the lambda).
-    bool isExplicit() const { return !isImplicit(); }
-
-    /// \brief Retrieve the source location of the capture.
-    ///
-    /// For an explicit capture, this returns the location of the
-    /// explicit capture in the source. For an implicit capture, this
-    /// returns the location at which the variable or \c this was first
-    /// used.
-    SourceLocation getLocation() const { return Loc; }
-
-    /// \brief Determine whether this capture is a pack expansion,
-    /// which captures a function parameter pack.
-    bool isPackExpansion() const { return EllipsisLoc.isValid(); }
-
-    /// \brief Retrieve the location of the ellipsis for a capture
-    /// that is a pack expansion.
-    SourceLocation getEllipsisLoc() const {
-      assert(isPackExpansion() && "No ellipsis location for a non-expansion");
-      return EllipsisLoc;
-    }
-  };
-
-private:
   /// \brief Construct a lambda expression.
   LambdaExpr(QualType T, SourceRange IntroducerRange,
              LambdaCaptureDefault CaptureDefault,
diff --git a/include/clang/AST/LambdaCapture.h b/include/clang/AST/LambdaCapture.h
new file mode 100644 (file)
index 0000000..8633c97
--- /dev/null
@@ -0,0 +1,123 @@
+//===--- LambdaCapture.h - Types for C++ Lambda Captures --------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief Defines the LambdaCapture class.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_LAMBDACAPTURE_H
+#define LLVM_CLANG_AST_LAMBDACAPTURE_H
+
+#include "clang/AST/Decl.h"
+#include "clang/Basic/Lambda.h"
+#include "llvm/ADT/PointerIntPair.h"
+
+namespace clang {
+
+/// \brief Describes the capture of a variable or of \c this, or of a
+/// C++1y init-capture.
+class LambdaCapture {
+  enum {
+    /// \brief Flag used by the Capture class to indicate that the given
+    /// capture was implicit.
+    Capture_Implicit = 0x01,
+
+    /// \brief Flag used by the Capture class to indicate that the
+    /// given capture was by-copy.
+    ///
+    /// This includes the case of a non-reference init-capture.
+    Capture_ByCopy = 0x02
+  };
+
+  llvm::PointerIntPair<Decl *, 2> DeclAndBits;
+  SourceLocation Loc;
+  SourceLocation EllipsisLoc;
+
+  friend class ASTStmtReader;
+  friend class ASTStmtWriter;
+
+public:
+  /// \brief Create a new capture of a variable or of \c this.
+  ///
+  /// \param Loc The source location associated with this capture.
+  ///
+  /// \param Kind The kind of capture (this, byref, bycopy), which must
+  /// not be init-capture.
+  ///
+  /// \param Implicit Whether the capture was implicit or explicit.
+  ///
+  /// \param Var The local variable being captured, or null if capturing
+  /// \c this.
+  ///
+  /// \param EllipsisLoc The location of the ellipsis (...) for a
+  /// capture that is a pack expansion, or an invalid source
+  /// location to indicate that this is not a pack expansion.
+  LambdaCapture(SourceLocation Loc, bool Implicit, LambdaCaptureKind Kind,
+                VarDecl *Var = nullptr,
+                SourceLocation EllipsisLoc = SourceLocation());
+
+  /// \brief Determine the kind of capture.
+  LambdaCaptureKind getCaptureKind() const;
+
+  /// \brief Determine whether this capture handles the C++ \c this
+  /// pointer.
+  bool capturesThis() const { return DeclAndBits.getPointer() == nullptr; }
+
+  /// \brief Determine whether this capture handles a variable.
+  bool capturesVariable() const {
+    return dyn_cast_or_null<VarDecl>(DeclAndBits.getPointer());
+  }
+
+  /// \brief Determine whether this is an init-capture.
+  bool isInitCapture() const {
+    return capturesVariable() && getCapturedVar()->isInitCapture();
+  }
+
+  /// \brief Retrieve the declaration of the local variable being
+  /// captured.
+  ///
+  /// This operation is only valid if this capture is a variable capture
+  /// (other than a capture of \c this).
+  VarDecl *getCapturedVar() const {
+    assert(capturesVariable() && "No variable available for 'this' capture");
+    return cast<VarDecl>(DeclAndBits.getPointer());
+  }
+
+  /// \brief Determine whether this was an implicit capture (not
+  /// written between the square brackets introducing the lambda).
+  bool isImplicit() const { return DeclAndBits.getInt() & Capture_Implicit; }
+
+  /// \brief Determine whether this was an explicit capture (written
+  /// between the square brackets introducing the lambda).
+  bool isExplicit() const { return !isImplicit(); }
+
+  /// \brief Retrieve the source location of the capture.
+  ///
+  /// For an explicit capture, this returns the location of the
+  /// explicit capture in the source. For an implicit capture, this
+  /// returns the location at which the variable or \c this was first
+  /// used.
+  SourceLocation getLocation() const { return Loc; }
+
+  /// \brief Determine whether this capture is a pack expansion,
+  /// which captures a function parameter pack.
+  bool isPackExpansion() const { return EllipsisLoc.isValid(); }
+
+  /// \brief Retrieve the location of the ellipsis for a capture
+  /// that is a pack expansion.
+  SourceLocation getEllipsisLoc() const {
+    assert(isPackExpansion() && "No ellipsis location for a non-expansion");
+    return EllipsisLoc;
+  }
+};
+
+} // end namespace clang
+
+#endif // LLVM_CLANG_AST_LAMBDACAPTURE_H
index 31afa138d34e93c6152db76e3e753747192db38f..874853276bc23b7f09edf2c55b4c4abf04dc1c3c 100644 (file)
@@ -252,7 +252,7 @@ public:
   /// \brief Recursively visit a lambda capture.
   ///
   /// \returns false if the visitation was terminated early, true otherwise.
-  bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaExpr::Capture *C);
+  bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C);
 
   /// \brief Recursively visit the body of a lambda expression.
   ///
@@ -856,7 +856,7 @@ bool RecursiveASTVisitor<Derived>::TraverseConstructorInitializer(
 
 template<typename Derived>
 bool RecursiveASTVisitor<Derived>::TraverseLambdaCapture(
-    LambdaExpr *LE, const LambdaExpr::Capture *C) {
+    LambdaExpr *LE, const LambdaCapture *C) {
   if (C->isInitCapture())
     TRY_TO(TraverseDecl(C->getCapturedVar()));
   return true;
index f2eab057e237546654a23dd889a59d7f77e839e7..8350ccd5483556a90dde85e533a0df5662db9457 100644 (file)
@@ -15,7 +15,6 @@
 #define LLVM_CLANG_AST_TEMPLATENAME_H
 
 #include "clang/Basic/LLVM.h"
-#include "clang/Basic/OperatorKinds.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerUnion.h"
 
@@ -25,13 +24,14 @@ class ASTContext;
 class DependentTemplateName;
 class DiagnosticBuilder;
 class IdentifierInfo;
+class NamedDecl;
 class NestedNameSpecifier;
+enum OverloadedOperatorKind : unsigned char;
 class OverloadedTemplateStorage;
 struct PrintingPolicy;
 class QualifiedTemplateName;
-class NamedDecl;
-class SubstTemplateTemplateParmStorage;
 class SubstTemplateTemplateParmPackStorage;
+class SubstTemplateTemplateParmStorage;
 class TemplateArgument;
 class TemplateDecl;
 class TemplateTemplateParmDecl;
index c51fc15c4a3e12d5cf70059450d20f9add9a4176..36866e72cb0140220ac8c536851de112df049da6 100644 (file)
 #include "clang/AST/TemplateName.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/ExceptionSpecificationType.h"
-#include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/Linkage.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/Visibility.h"
-#include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/APInt.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/ADT/Optional.h"
index 7739631f6379465aee58389bcb867e13b538c19c..ebc044ce880c93864b085c149b514b3193c72b7c 100644 (file)
@@ -16,7 +16,6 @@
 #define LLVM_CLANG_DIAGNOSTIC_H
 
 #include "clang/Basic/DiagnosticIDs.h"
-#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include <vector>
 
 namespace clang {
-  class DiagnosticConsumer;
+  class DeclContext;
   class DiagnosticBuilder;
+  class DiagnosticConsumer;
+  class DiagnosticErrorTrap;
   class DiagnosticOptions;
   class IdentifierInfo;
-  class DeclContext;
   class LangOptions;
+  enum OverloadsShown : unsigned;
   class Preprocessor;
-  class DiagnosticErrorTrap;
   class StoredDiagnostic;
   namespace tok {
   enum TokenKind : unsigned short;
index 2fba3844a09ca78a34c26d9ea3ec7e0f1b70d8b8..a9c8cf5fc2890306ab48b0c04f5bbd03fdb527a2 100644 (file)
@@ -19,7 +19,7 @@ namespace clang {
 
 /// \brief Specifies which overload candidates to display when overload
 /// resolution fails.
-enum OverloadsShown {
+enum OverloadsShown : unsigned {
   Ovl_All,  ///< Show all overloads.
   Ovl_Best  ///< Show just the "best" overload candidates.
 };
index f65ba863542ec6e2943389e0ca0a672f638857d1..0c278a17a32deb5e11e9497817cba8b7dddb6a22 100644 (file)
 #define LLVM_CLANG_BASIC_IDENTIFIERTABLE_H
 
 #include "clang/Basic/LLVM.h"
-#include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/TokenKinds.h"
-#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/PointerLikeTypeTraits.h"
 #include <cassert>
 #include <string>
 
@@ -814,6 +811,8 @@ struct DenseMapInfo<clang::Selector> {
 template <>
 struct isPodLike<clang::Selector> { static const bool value = true; };
 
+template <typename T> class PointerLikeTypeTraits;
+
 template<>
 class PointerLikeTypeTraits<clang::Selector> {
 public:
index e19a9f8a1fcd3a5f66653bc8bf146e5924b627ce..f3b47699cf624d7908066a260be387b454d79e55 100644 (file)
@@ -18,7 +18,7 @@ namespace clang {
 
 /// \brief Describes the different kinds of linkage 
 /// (C++ [basic.link], C99 6.2.2) that an entity may have.
-enum Linkage {
+enum Linkage : unsigned char {
   /// \brief No linkage, which means that the entity is unique and
   /// can only be referred to from within its scope.
   NoLinkage = 0,
index 2ceab9cbab9dafeb370f3ba29186dc3ae27b8879..8064fe0519e4ddd622af12384df52c7979296caf 100644 (file)
@@ -19,7 +19,7 @@ namespace clang {
 
 /// \brief Enumeration specifying the different kinds of C++ overloaded
 /// operators.
-enum OverloadedOperatorKind {
+enum OverloadedOperatorKind : unsigned char {
   OO_None,                ///< Not an overloaded operator
 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
   OO_##Name,
index e57754d7702ee5e27117f150242efdc3755d0917..845e7513518e341bb27cb59d121f848a8bdf47c8 100644 (file)
@@ -2153,25 +2153,23 @@ private:
   SourceLocation LastLocation;
 };
 
-/// \brief An individual capture in a lambda introducer.
-struct LambdaCapture {
-  LambdaCaptureKind Kind;
-  SourceLocation Loc;
-  IdentifierInfo *Id;
-  SourceLocation EllipsisLoc;
-  ExprResult Init;
-  ParsedType InitCaptureType;
-  LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc,
-                IdentifierInfo* Id,
-                SourceLocation EllipsisLoc,
-                ExprResult Init, ParsedType InitCaptureType)
-    : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc), Init(Init),
-        InitCaptureType(InitCaptureType)
-  {}
-};
-
 /// \brief Represents a complete lambda introducer.
 struct LambdaIntroducer {
+  /// \brief An individual capture in a lambda introducer.
+  struct LambdaCapture {
+    LambdaCaptureKind Kind;
+    SourceLocation Loc;
+    IdentifierInfo *Id;
+    SourceLocation EllipsisLoc;
+    ExprResult Init;
+    ParsedType InitCaptureType;
+    LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc,
+                  IdentifierInfo *Id, SourceLocation EllipsisLoc,
+                  ExprResult Init, ParsedType InitCaptureType)
+        : Kind(Kind), Loc(Loc), Id(Id), EllipsisLoc(EllipsisLoc), Init(Init),
+          InitCaptureType(InitCaptureType) {}
+  };
+
   SourceRange Range;
   SourceLocation DefaultLoc;
   LambdaCaptureDefault Default;
index 1f61c8454b82a0f678bbb6fc2ab6ed2fe91337f9..180f554dafea4ea055ddb15cc3a551d71752d6f0 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef LLVM_CLANG_FRONTEND_AST_DESERIALIZATION_LISTENER_H
 #define LLVM_CLANG_FRONTEND_AST_DESERIALIZATION_LISTENER_H
 
+#include "clang/Basic/IdentifierTable.h"
 #include "clang/Serialization/ASTBitCodes.h"
 
 namespace clang {
index 20d240b9e650d54845893c5915529af03f967d71..8d183b2534a30f64a22f60a003a3f22eb4fbaa4b 100644 (file)
@@ -1011,7 +1011,7 @@ void CXXRecordDecl::getCaptureFields(
 
   LambdaDefinitionData &Lambda = getLambdaData();
   RecordDecl::field_iterator Field = field_begin();
-  for (LambdaExpr::Capture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
+  for (const LambdaCapture *C = Lambda.Captures, *CEnd = C + Lambda.NumCaptures;
        C != CEnd; ++C, ++Field) {
     if (C->capturesThis())
       ThisCapture = *Field;
index 0181235bff5da2ef527809e44313b2c1dcc28eda..04f4d40c77b41352af3da3b4dfd8134e768163b6 100644 (file)
@@ -884,7 +884,7 @@ CXXConstructExpr::CXXConstructExpr(const ASTContext &C, StmtClass SC,
   }
 }
 
-LambdaExpr::Capture::Capture(SourceLocation Loc, bool Implicit,
+LambdaCapture::LambdaCapture(SourceLocation Loc, bool Implicit,
                              LambdaCaptureKind Kind, VarDecl *Var,
                              SourceLocation EllipsisLoc)
   : DeclAndBits(Var, 0), Loc(Loc), EllipsisLoc(EllipsisLoc)
@@ -908,7 +908,7 @@ LambdaExpr::Capture::Capture(SourceLocation Loc, bool Implicit,
   DeclAndBits.setInt(Bits);
 }
 
-LambdaCaptureKind LambdaExpr::Capture::getCaptureKind() const {
+LambdaCaptureKind LambdaCapture::getCaptureKind() const {
   Decl *D = DeclAndBits.getPointer();
   if (!D)
     return LCK_This;
index 943d2060b216d319f5edada3917a414e0f4a2624..219845996323c652787ac9d3735e87cc225a7603 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/CharInfo.h"
+#include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Basic/OperatorKinds.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cstdio>
index c4c2644386e6df0f29346fe9a51b8ec06e992945..4279e4985e85a7bbf468a8fdb1eb299bffa11937 100644 (file)
@@ -830,7 +830,7 @@ CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl,
   unsigned fieldno = 0;
   for (CXXRecordDecl::capture_const_iterator I = CXXDecl->captures_begin(),
          E = CXXDecl->captures_end(); I != E; ++I, ++Field, ++fieldno) {
-    const LambdaExpr::Capture C = *I;
+    const LambdaCapture &C = *I;
     if (C.capturesVariable()) {
       VarDecl *V = C.getCapturedVar();
       llvm::DIFile VUnit = getOrCreateFile(C.getLocation());
index dcbc9502652dd6e32387448b5cb4456935785211..30dc88994e2f93e7cd72759b22c5603c08f8a8a1 100644 (file)
@@ -18,6 +18,7 @@
 #include "UnwrappedLineParser.h"
 #include "WhitespaceManager.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Format/Format.h"
 #include "clang/Lex/Lexer.h"
index 77f8a87ca954ddd87d211ea8721de9487eeb3008..7533b39ce619076d61dcd0264c4b1d44cdba62f9 100644 (file)
@@ -21,6 +21,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/StmtCXX.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/TargetInfo.h"
index 4b23c37a63babfb66d128ecd04b698d4621e5ba1..7e34b642ad6af5f0be28e03182656360de519f37 100644 (file)
@@ -4327,15 +4327,13 @@ void Sema::CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro,
   // Note what has already been captured.
   llvm::SmallPtrSet<IdentifierInfo *, 4> Known;
   bool IncludedThis = false;
-  for (SmallVectorImpl<LambdaCapture>::iterator C = Intro.Captures.begin(),
-                                             CEnd = Intro.Captures.end();
-       C != CEnd; ++C) {
-    if (C->Kind == LCK_This) {
+  for (const auto &C : Intro.Captures) {
+    if (C.Kind == LCK_This) {
       IncludedThis = true;
       continue;
     }
     
-    Known.insert(C->Id);
+    Known.insert(C.Id);
   }
   
   // Look for other capturable variables.
index c33408f193a002c9c7a5877716375af3ddd73ad6..5ca5a8fc26abfae186ad843a57cb33089f159233 100644 (file)
@@ -18,6 +18,7 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
 #include "clang/AST/Mangle.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/SourceManager.h"
index d75cf4b2bb74be52cf9aeab1987db419e14dda81..7c4f60e51171ef438d34d7e1abc6f8e5d2a8376a 100644 (file)
@@ -957,10 +957,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
   // Handle explicit captures.
   SourceLocation PrevCaptureLoc
     = Intro.Default == LCD_None? Intro.Range.getBegin() : Intro.DefaultLoc;
-  for (SmallVectorImpl<LambdaCapture>::const_iterator
-         C = Intro.Captures.begin(),
-         E = Intro.Captures.end();
-       C != E;
+  for (auto C = Intro.Captures.begin(), E = Intro.Captures.end(); C != E;
        PrevCaptureLoc = C->Loc, ++C) {
     if (C->Kind == LCK_This) {
       // C++11 [expr.prim.lambda]p8:
@@ -1379,7 +1376,7 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
                                  Scope *CurScope, 
                                  bool IsInstantiation) {
   // Collect information from the lambda scope.
-  SmallVector<LambdaExpr::Capture, 4> Captures;
+  SmallVector<LambdaCapture, 4> Captures;
   SmallVector<Expr *, 4> CaptureInits;
   LambdaCaptureDefault CaptureDefault;
   SourceLocation CaptureDefaultLoc;
@@ -1412,9 +1409,8 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
 
       // Handle 'this' capture.
       if (From.isThisCapture()) {
-        Captures.push_back(LambdaExpr::Capture(From.getLocation(),
-                                               IsImplicit,
-                                               LCK_This));
+        Captures.push_back(
+            LambdaCapture(From.getLocation(), IsImplicit, LCK_This));
         CaptureInits.push_back(new (Context) CXXThisExpr(From.getLocation(),
                                                          getCurrentThisType(),
                                                          /*isImplicit=*/true));
@@ -1423,8 +1419,8 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
 
       VarDecl *Var = From.getVariable();
       LambdaCaptureKind Kind = From.isCopyCapture()? LCK_ByCopy : LCK_ByRef;
-      Captures.push_back(LambdaExpr::Capture(From.getLocation(), IsImplicit, 
-                                             Kind, Var, From.getEllipsisLoc()));
+      Captures.push_back(LambdaCapture(From.getLocation(), IsImplicit, Kind,
+                                       Var, From.getEllipsisLoc()));
       CaptureInits.push_back(From.getInitExpr());
     }
 
index 51d130c685ed7de7fde58a496890caf55e40d8da..df4970ec8e0e5c9125db163ca465043ae87491cb 100644 (file)
@@ -20,6 +20,7 @@
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/TypeOrdering.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Sema/Initialization.h"
index a8463cdbd4ef662d4928c7e6afec91baf78aaa17..a28ad5eb0701d9fa6c3cbbc607a83da1aefb753e 100644 (file)
@@ -31,6 +31,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Sema/SemaInternal.h"
+#include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Lex/Preprocessor.h"
index 10a9282c98070269eb1fa8a47aaa0aa2f3c79a6f..bd2174046b22daf3e6f348564077fca079e2302f 100644 (file)
@@ -22,6 +22,7 @@
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLocVisitor.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceManagerInternals.h"
index 50d03a32a8f4b6e171e4e300b957159795757941..a525f2f089bd225939665d3201ad2f47c900c25b 100644 (file)
@@ -1247,7 +1247,7 @@ void ASTDeclReader::ReadCXXDefinitionData(
   Data.FirstFriend = ReadDeclID(Record, Idx);
 
   if (Data.IsLambda) {
-    typedef LambdaExpr::Capture Capture;
+    typedef LambdaCapture Capture;
     CXXRecordDecl::LambdaDefinitionData &Lambda
       = static_cast<CXXRecordDecl::LambdaDefinitionData &>(Data);
     Lambda.Dependent = Record[Idx++];
index 11b70e39253302c47ed4ef935a63cfeeb7becd20..d9bef82130ad6d3ee0045d171f6c193f1386bdc3 100644 (file)
@@ -23,6 +23,7 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLocVisitor.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemStatCache.h"
 #include "clang/Basic/SourceManager.h"
@@ -5370,7 +5371,7 @@ void ASTWriter::AddCXXDefinitionData(const CXXRecordDecl *D, RecordDataImpl &Rec
     AddDeclRef(Lambda.ContextDecl, Record);
     AddTypeSourceInfo(Lambda.MethodTyInfo, Record);
     for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
-      LambdaExpr::Capture &Capture = Lambda.Captures[I];
+      const LambdaCapture &Capture = Lambda.Captures[I];
       AddSourceLocation(Capture.getLocation(), Record);
       Record.push_back(Capture.isImplicit());
       Record.push_back(Capture.getCaptureKind());
index 5b2aa353651121b740b4f68acb488b3aeed68d5d..fd93620d0bf0b0ff19100f71c9d9cf52c0977d57 100644 (file)
@@ -16,6 +16,7 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
 #include "clang/AST/ParentMap.h"
 #include "clang/AST/StmtCXX.h"
 #include "clang/Basic/SourceManager.h"
index ec4d604825c80c49b8a38e374e8bfb3fb9a45a2f..a70e066d296bc83f50e9bd9bf26c814317670027 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "clang/Tooling/CompilationDatabase.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
index 6cc8062382291b23b6f42e379882bd964d7e421d..1cb9e078f5c37dc76e804ca2cf98df703c5a77a6 100644 (file)
@@ -149,7 +149,7 @@ public:
     return true;
   }
 
-  bool TraverseLambdaCapture(LambdaExpr::Capture C) {
+  bool TraverseLambdaCapture(LambdaCapture C) {
     if (C.capturesThis())
       return true;
 
index d3138c0500509714ec58d781cfe4e08806da4aca..25dc7db53e5dddca004ccae312a6e2a445335918 100644 (file)
@@ -11,6 +11,7 @@
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceManager.h"