]> granicus.if.org Git - clang/commitdiff
More header elimination. The goal of all this is to allow Parser to
authorJohn McCall <rjmccall@apple.com>
Tue, 24 Aug 2010 08:50:51 +0000 (08:50 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 24 Aug 2010 08:50:51 +0000 (08:50 +0000)
#include Sema.h while keeping all the AST declarations opaque.  That may
not be reasonably attainable, though.

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

12 files changed:
include/clang/Sema/Sema.h
lib/Sema/Sema.cpp
lib/Sema/SemaCodeComplete.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaExprObjC.cpp
lib/Sema/SemaLookup.cpp
lib/Sema/SemaStmt.cpp
lib/Sema/SemaTemplate.cpp
lib/Serialization/ASTReader.cpp

index d147d604316f6f95eab53a66874a08eabb030c02..6624ad8475e1c939737f2b8dc2ce515567423027 100644 (file)
 #include "clang/Sema/Action.h"
 #include "clang/Sema/IdentifierResolver.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
-#include "clang/Sema/CXXFieldCollector.h"
 #include "clang/Sema/ObjCMethodList.h"
 #include "clang/Sema/Overload.h"
 #include "clang/Sema/AnalysisBasedWarnings.h"
-#include "clang/Sema/Scope.h"
 #include "clang/Sema/SemaDiagnostic.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/DenseSet.h"
@@ -106,6 +104,7 @@ namespace clang {
   class VisibleDeclConsumer;
   class TargetAttributesSema;
   class ADLResult;
+  class CXXFieldCollector;
 
 /// \brief Retains information about a function, method, or block that is
 /// currently being parsed.
@@ -1105,16 +1104,7 @@ public:
 
   /// Finds the scope corresponding to the given decl context, if it
   /// happens to be an enclosing scope.  Otherwise return NULL.
-  Scope *getScopeForDeclContext(Scope *S, DeclContext *DC) {
-    DeclContext *TargetDC = DC->getPrimaryContext();
-    do {
-      if (DeclContext *ScopeDC = (DeclContext*) S->getEntity())
-        if (ScopeDC->getPrimaryContext() == TargetDC)
-          return S;
-    } while ((S = S->getParent()));
-
-    return NULL;
-  }
+  static Scope *getScopeForDeclContext(Scope *S, DeclContext *DC);
 
   /// Subroutines of ActOnDeclarator().
   TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
index ec118e991612b4910739e85294d8cd318926f388..7c0006b7b3b8e207e59cd71c7ba0e16e6c294b38 100644 (file)
@@ -17,7 +17,9 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/APFloat.h"
+#include "clang/Sema/CXXFieldCollector.h"
 #include "clang/Sema/ExternalSemaSource.h"
+#include "clang/Sema/Scope.h"
 #include "clang/Sema/SemaConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTDiagnostic.h"
index 9d5bc0be0f20dc3a5f2bcce3a4086958fa1d2c26..ee100e496b274fd6c83dc22f7d7c941c17262b86 100644 (file)
@@ -14,6 +14,7 @@
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "clang/Sema/ExternalSemaSource.h"
+#include "clang/Sema/Scope.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/ExprObjC.h"
index 48f5b0d24683bf083b9cc2e9fdd23f1c9e7b695f..2f7f54a080cb9da9c00eeaceaf6b34c0ba879482 100644 (file)
@@ -14,6 +14,8 @@
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/Initialization.h"
 #include "clang/Sema/Lookup.h"
+#include "clang/Sema/CXXFieldCollector.h"
+#include "clang/Sema/Scope.h"
 #include "clang/AST/APValue.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
@@ -479,6 +481,17 @@ bool Sema::isDeclInScope(NamedDecl *&D, DeclContext *Ctx, Scope *S) {
   return IdResolver.isDeclInScope(D, Ctx, Context, S);
 }
 
+Scope *Sema::getScopeForDeclContext(Scope *S, DeclContext *DC) {
+  DeclContext *TargetDC = DC->getPrimaryContext();
+  do {
+    if (DeclContext *ScopeDC = (DeclContext*) S->getEntity())
+      if (ScopeDC->getPrimaryContext() == TargetDC)
+        return S;
+  } while ((S = S->getParent()));
+
+  return 0;
+}
+
 static bool isOutOfScopePreviousDeclaration(NamedDecl *,
                                             DeclContext*,
                                             ASTContext&);
index eb49b4bd7b05357ae7f0ef9e4b3f1e02a972e8cc..9537ea0032402382e0ccdd50d27005edbd01295a 100644 (file)
@@ -12,6 +12,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Sema/Sema.h"
+#include "clang/Sema/CXXFieldCollector.h"
+#include "clang/Sema/Scope.h"
 #include "clang/Sema/Initialization.h"
 #include "clang/Sema/Lookup.h"
 #include "clang/AST/ASTConsumer.h"
index 283d5401241e7467caa6f2a0003437cefec72c3a..e51ce1352c3cd57044bb3638d9946fa0d15fa399 100644 (file)
@@ -14,6 +14,7 @@
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/ExternalSemaSource.h"
+#include "clang/Sema/Scope.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclObjC.h"
index 4f7e669c8da4a2e4bc9ce6f34e87894ee90555c4..0e53a47b18574a1f64df0746c452613df0159693 100644 (file)
@@ -1295,7 +1295,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
   // FIXME: Also add this declaration to the IdentifierResolver, but
   // make sure it is at the end of the chain to coincide with the
   // global scope.
-  ((DeclContext *)TUScope->getEntity())->addDecl(Alloc);
+  Context.getTranslationUnitDecl()->addDecl(Alloc);
 }
 
 bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
index 018dcefe885e4f57a29e8414a765a0e1402dbd26..55ae6bfecf95ae544d36117a391c396c12baefb9 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/Lookup.h"
+#include "clang/Sema/Scope.h"
 #include "clang/Sema/Initialization.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclObjC.h"
index 2572cf01deda2ae047d9d12e2ac09dfc272c7f95..8307d2f5f106a7a41ad88925b07bcfc13162980e 100644 (file)
@@ -14,6 +14,7 @@
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/DeclSpec.h"
+#include "clang/Sema/Scope.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/CXXInheritance.h"
 #include "clang/AST/Decl.h"
index 5f0ea16f40d237b4bc6802d3a9219bf22797cdb5..7f88e2ff52fe2247050383b601822c2a8989541a 100644 (file)
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Sema/Sema.h"
+#include "clang/Sema/Scope.h"
 #include "clang/Sema/Initialization.h"
 #include "clang/AST/APValue.h"
 #include "clang/AST/ASTContext.h"
index c05f5d3818ead5d7fa97d3bf9ad8e454d8652c2a..f54b8b02e1d0980b43ce415f0fd530c9de21f69b 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/Lookup.h"
+#include "clang/Sema/Scope.h"
 #include "clang/Sema/Template.h"
 #include "TreeTransform.h"
 #include "clang/AST/ASTContext.h"
index 80bc9189520aaee38e24bffa3c66f13375129800..46448fff0c9d56c6dc3b2fbdf190ed5f6e7b626b 100644 (file)
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendDiagnostic.h"
 #include "clang/Frontend/Utils.h"
 #include "clang/Sema/Sema.h"
+#include "clang/Sema/Scope.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"