[cfe-commits] r39161 - in /cfe/cfe/trunk: AST/ASTStreamer.cpp AST/Sema.cpp AST/Sema.h AST/SemaDecl.cpp AST/SemaExpr.cpp Driver/clang.cpp Sema/ASTStreamer.cpp Sema/Sema.cpp Sema/Sema.h Sema/SemaDecl.cpp Sema/SemaExpr.cpp clang.xcodeproj/project.pbxproj include/clang/AST/AST.h include/clang/AST/ASTContext.h include/clang/AST/ASTStreamer.h include/clang/Sema/ASTStreamer.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:40:14 PDT 2007


Author: sabre
Date: Wed Jul 11 11:40:13 2007
New Revision: 39161

URL: http://llvm.org/viewvc/llvm-project?rev=39161&view=rev
Log:
introduce a new ASTContext class to hold long-lived ast nodes.

Added:
    cfe/cfe/trunk/include/clang/AST/ASTContext.h   (with props)
Modified:
    cfe/cfe/trunk/AST/ASTStreamer.cpp
    cfe/cfe/trunk/AST/Sema.cpp
    cfe/cfe/trunk/AST/Sema.h
    cfe/cfe/trunk/AST/SemaDecl.cpp
    cfe/cfe/trunk/AST/SemaExpr.cpp
    cfe/cfe/trunk/Driver/clang.cpp
    cfe/cfe/trunk/Sema/ASTStreamer.cpp
    cfe/cfe/trunk/Sema/Sema.cpp
    cfe/cfe/trunk/Sema/Sema.h
    cfe/cfe/trunk/Sema/SemaDecl.cpp
    cfe/cfe/trunk/Sema/SemaExpr.cpp
    cfe/cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/cfe/trunk/include/clang/AST/AST.h
    cfe/cfe/trunk/include/clang/AST/ASTStreamer.h
    cfe/cfe/trunk/include/clang/Sema/ASTStreamer.h

Modified: cfe/cfe/trunk/AST/ASTStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/ASTStreamer.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/ASTStreamer.cpp (original)
+++ cfe/cfe/trunk/AST/ASTStreamer.cpp Wed Jul 11 11:40:13 2007
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/ASTStreamer.h"
+#include "clang/AST/ASTContext.h"
 #include "Sema.h"
 #include "clang/Parse/Action.h"
 #include "clang/Parse/Parser.h"
@@ -23,9 +24,9 @@
     Parser P;
     std::vector<Decl*> LastInGroupList;
   public:
-    ASTStreamer(Preprocessor &PP, unsigned MainFileID)
-      : P(PP, *new Sema(PP, LastInGroupList)) {
-      PP.EnterSourceFile(MainFileID, 0, true);
+    ASTStreamer(ASTContext &Ctx, unsigned MainFileID)
+      : P(Ctx.PP, *new Sema(Ctx, LastInGroupList)) {
+      Ctx.PP.EnterSourceFile(MainFileID, 0, true);
       
       // Initialize the parser.
       P.Initialize();
@@ -79,9 +80,9 @@
 
 /// ASTStreamer_Init - Create an ASTStreamer with the specified preprocessor
 /// and FileID.
-ASTStreamerTy *llvm::clang::ASTStreamer_Init(Preprocessor &PP, 
+ASTStreamerTy *llvm::clang::ASTStreamer_Init(ASTContext &Ctx, 
                                              unsigned MainFileID) {
-  return new ASTStreamer(PP, MainFileID);
+  return new ASTStreamer(Ctx, MainFileID);
 }
 
 /// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration. This

Modified: cfe/cfe/trunk/AST/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.cpp (original)
+++ cfe/cfe/trunk/AST/Sema.cpp Wed Jul 11 11:40:13 2007
@@ -13,21 +13,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "Sema.h"
-#include "clang/AST/Decl.h"
-#include "clang/AST/Expr.h"
-#include "clang/Parse/Action.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Lex/IdentifierTable.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Lex/Preprocessor.h"
 using namespace llvm;
 using namespace clang;
 
+
 //===----------------------------------------------------------------------===//
 // Helper functions.
 //===----------------------------------------------------------------------===//
 
 void Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) {
-  PP.Diag(Loc, DiagID, Msg);
+  Context.PP.Diag(Loc, DiagID, Msg);
 }
 
 

Modified: cfe/cfe/trunk/AST/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.h?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.h (original)
+++ cfe/cfe/trunk/AST/Sema.h Wed Jul 11 11:40:13 2007
@@ -21,12 +21,13 @@
 
 namespace llvm {
 namespace clang {
+  class ASTContext;
   class Preprocessor;
   class Decl;
   
 /// Sema - This implements semantic analysis and AST building for C.
 class Sema : public Action {
-  Preprocessor &PP;
+  ASTContext &Context;
   
   /// LastInGroupList - This vector is populated when there are multiple
   /// declarators in a single decl group (e.g. "int A, B, C").  In this case,
@@ -34,8 +35,8 @@
   /// ASTStreamer.
   std::vector<Decl*> &LastInGroupList;
 public:
-  Sema(Preprocessor &pp, std::vector<Decl*> &prevInGroup)
-    : PP(pp), LastInGroupList(prevInGroup) {}
+  Sema(ASTContext &ctx, std::vector<Decl*> &prevInGroup)
+    : Context(ctx), LastInGroupList(prevInGroup) {}
   
   void Diag(SourceLocation Loc, unsigned DiagID,
             const std::string &Msg = std::string());

Modified: cfe/cfe/trunk/AST/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaDecl.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/AST/SemaDecl.cpp Wed Jul 11 11:40:13 2007
@@ -19,7 +19,6 @@
 using namespace clang;
 
 
-
 bool Sema::isTypeName(const IdentifierInfo &II, Scope *S) const {
   Decl *D = II.getFETokenInfo<Decl>();
   return D != 0 && D->getDeclSpec().StorageClassSpec == DeclSpec::SCS_typedef;

Modified: cfe/cfe/trunk/AST/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaExpr.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/AST/SemaExpr.cpp Wed Jul 11 11:40:13 2007
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Sema.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Basic/Diagnostic.h"
@@ -75,7 +76,7 @@
   unsigned wchar_tByteWidth = ~0U;
   if (AnyWide)
     wchar_tByteWidth =
-      PP.getTargetInfo().getWCharWidth(StringToks[0].getLocation());
+      Context.PP.getTargetInfo().getWCharWidth(StringToks[0].getLocation());
   
   // The output buffer size needs to be large enough to hold wide characters.
   // This is a worst-case assumption which basically corresponds to L"" "long".
@@ -99,7 +100,7 @@
     // Get the spelling of the token, which eliminates trigraphs, etc.  We know
     // that ThisTokBuf points to a buffer that is big enough for the whole token
     // and 'spelled' tokens can only shrink.
-    unsigned ThisTokLen = PP.getSpelling(StringToks[i], ThisTokBuf);
+    unsigned ThisTokLen = Context.PP.getSpelling(StringToks[i], ThisTokBuf);
     const char *ThisTokEnd = ThisTokBuf+ThisTokLen-1;  // Skip end quote.
     
     // TODO: Input character set mapping support.
@@ -154,7 +155,7 @@
         ResultChar = 8;
         break;
       case 'e':
-        PP.Diag(StringToks[i], diag::ext_nonstandard_escape, "e");
+        Diag(StringToks[i].getLocation(), diag::ext_nonstandard_escape, "e");
         ResultChar = 27;
         break;
       case 'f':
@@ -177,7 +178,7 @@
       case 'x': // Hex escape.
         if (ThisTokBuf == ThisTokEnd ||
             (ResultChar = HexDigitValue(*ThisTokBuf)) == ~0U) {
-          PP.Diag(StringToks[i], diag::err_hex_escape_no_digits);
+          Diag(StringToks[i].getLocation(), diag::err_hex_escape_no_digits);
           ResultChar = 0;
           break;
         }
@@ -194,19 +195,19 @@
       // Otherwise, these are not valid escapes.
       case '(': case '{': case '[': case '%':
         // GCC accepts these as extensions.  We warn about them as such though.
-        if (!PP.getLangOptions().NoExtensions) {
-          PP.Diag(StringToks[i], diag::ext_nonstandard_escape,
-                  std::string()+(char)ResultChar);
+        if (!Context.PP.getLangOptions().NoExtensions) {
+          Diag(StringToks[i].getLocation(), diag::ext_nonstandard_escape,
+               std::string()+(char)ResultChar);
           break;
         }
         // FALL THROUGH.
       default:
         if (isgraph(ThisTokBuf[0])) {
-          PP.Diag(StringToks[i], diag::ext_unknown_escape,
-                  std::string()+(char)ResultChar);
+          Diag(StringToks[i].getLocation(), diag::ext_unknown_escape,
+               std::string()+(char)ResultChar);
         } else {
-          PP.Diag(StringToks[i], diag::ext_unknown_escape,
-                  "x"+utohexstr(ResultChar));
+          Diag(StringToks[i].getLocation(), diag::ext_unknown_escape,
+               "x"+utohexstr(ResultChar));
         }
       }
 

Modified: cfe/cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/clang.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/clang.cpp (original)
+++ cfe/cfe/trunk/Driver/clang.cpp Wed Jul 11 11:40:13 2007
@@ -788,8 +788,9 @@
 //===----------------------------------------------------------------------===//
 
 static void BuildASTs(Preprocessor &PP, unsigned MainFileID) {
-  ASTStreamerTy *Streamer = ASTStreamer_Init(PP, MainFileID);
+  ASTContext Context(PP);
   
+  ASTStreamerTy *Streamer = ASTStreamer_Init(Context, MainFileID);
   while (ASTStreamer_ReadTopLevelDecl(Streamer))
     /* keep reading */;
   
@@ -798,7 +799,8 @@
 
 
 static void PrintASTs(Preprocessor &PP, unsigned MainFileID) {
-  ASTStreamerTy *Streamer = ASTStreamer_Init(PP, MainFileID);
+  ASTContext Context(PP);
+  ASTStreamerTy *Streamer = ASTStreamer_Init(Context, MainFileID);
   
   while (Decl *D = ASTStreamer_ReadTopLevelDecl(Streamer)) {
     std::cerr << "Read top-level decl: '";

Modified: cfe/cfe/trunk/Sema/ASTStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/ASTStreamer.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/ASTStreamer.cpp (original)
+++ cfe/cfe/trunk/Sema/ASTStreamer.cpp Wed Jul 11 11:40:13 2007
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/AST/ASTStreamer.h"
+#include "clang/AST/ASTContext.h"
 #include "Sema.h"
 #include "clang/Parse/Action.h"
 #include "clang/Parse/Parser.h"
@@ -23,9 +24,9 @@
     Parser P;
     std::vector<Decl*> LastInGroupList;
   public:
-    ASTStreamer(Preprocessor &PP, unsigned MainFileID)
-      : P(PP, *new Sema(PP, LastInGroupList)) {
-      PP.EnterSourceFile(MainFileID, 0, true);
+    ASTStreamer(ASTContext &Ctx, unsigned MainFileID)
+      : P(Ctx.PP, *new Sema(Ctx, LastInGroupList)) {
+      Ctx.PP.EnterSourceFile(MainFileID, 0, true);
       
       // Initialize the parser.
       P.Initialize();
@@ -79,9 +80,9 @@
 
 /// ASTStreamer_Init - Create an ASTStreamer with the specified preprocessor
 /// and FileID.
-ASTStreamerTy *llvm::clang::ASTStreamer_Init(Preprocessor &PP, 
+ASTStreamerTy *llvm::clang::ASTStreamer_Init(ASTContext &Ctx, 
                                              unsigned MainFileID) {
-  return new ASTStreamer(PP, MainFileID);
+  return new ASTStreamer(Ctx, MainFileID);
 }
 
 /// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration. This

Modified: cfe/cfe/trunk/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.cpp (original)
+++ cfe/cfe/trunk/Sema/Sema.cpp Wed Jul 11 11:40:13 2007
@@ -13,21 +13,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "Sema.h"
-#include "clang/AST/Decl.h"
-#include "clang/AST/Expr.h"
-#include "clang/Parse/Action.h"
-#include "clang/Parse/Scope.h"
-#include "clang/Lex/IdentifierTable.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/Lex/Preprocessor.h"
 using namespace llvm;
 using namespace clang;
 
+
 //===----------------------------------------------------------------------===//
 // Helper functions.
 //===----------------------------------------------------------------------===//
 
 void Sema::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg) {
-  PP.Diag(Loc, DiagID, Msg);
+  Context.PP.Diag(Loc, DiagID, Msg);
 }
 
 

Modified: cfe/cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.h?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:40:13 2007
@@ -21,12 +21,13 @@
 
 namespace llvm {
 namespace clang {
+  class ASTContext;
   class Preprocessor;
   class Decl;
   
 /// Sema - This implements semantic analysis and AST building for C.
 class Sema : public Action {
-  Preprocessor &PP;
+  ASTContext &Context;
   
   /// LastInGroupList - This vector is populated when there are multiple
   /// declarators in a single decl group (e.g. "int A, B, C").  In this case,
@@ -34,8 +35,8 @@
   /// ASTStreamer.
   std::vector<Decl*> &LastInGroupList;
 public:
-  Sema(Preprocessor &pp, std::vector<Decl*> &prevInGroup)
-    : PP(pp), LastInGroupList(prevInGroup) {}
+  Sema(ASTContext &ctx, std::vector<Decl*> &prevInGroup)
+    : Context(ctx), LastInGroupList(prevInGroup) {}
   
   void Diag(SourceLocation Loc, unsigned DiagID,
             const std::string &Msg = std::string());

Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:40:13 2007
@@ -19,7 +19,6 @@
 using namespace clang;
 
 
-
 bool Sema::isTypeName(const IdentifierInfo &II, Scope *S) const {
   Decl *D = II.getFETokenInfo<Decl>();
   return D != 0 && D->getDeclSpec().StorageClassSpec == DeclSpec::SCS_typedef;

Modified: cfe/cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaExpr.cpp?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:40:13 2007
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "Sema.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Expr.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Basic/Diagnostic.h"
@@ -75,7 +76,7 @@
   unsigned wchar_tByteWidth = ~0U;
   if (AnyWide)
     wchar_tByteWidth =
-      PP.getTargetInfo().getWCharWidth(StringToks[0].getLocation());
+      Context.PP.getTargetInfo().getWCharWidth(StringToks[0].getLocation());
   
   // The output buffer size needs to be large enough to hold wide characters.
   // This is a worst-case assumption which basically corresponds to L"" "long".
@@ -99,7 +100,7 @@
     // Get the spelling of the token, which eliminates trigraphs, etc.  We know
     // that ThisTokBuf points to a buffer that is big enough for the whole token
     // and 'spelled' tokens can only shrink.
-    unsigned ThisTokLen = PP.getSpelling(StringToks[i], ThisTokBuf);
+    unsigned ThisTokLen = Context.PP.getSpelling(StringToks[i], ThisTokBuf);
     const char *ThisTokEnd = ThisTokBuf+ThisTokLen-1;  // Skip end quote.
     
     // TODO: Input character set mapping support.
@@ -154,7 +155,7 @@
         ResultChar = 8;
         break;
       case 'e':
-        PP.Diag(StringToks[i], diag::ext_nonstandard_escape, "e");
+        Diag(StringToks[i].getLocation(), diag::ext_nonstandard_escape, "e");
         ResultChar = 27;
         break;
       case 'f':
@@ -177,7 +178,7 @@
       case 'x': // Hex escape.
         if (ThisTokBuf == ThisTokEnd ||
             (ResultChar = HexDigitValue(*ThisTokBuf)) == ~0U) {
-          PP.Diag(StringToks[i], diag::err_hex_escape_no_digits);
+          Diag(StringToks[i].getLocation(), diag::err_hex_escape_no_digits);
           ResultChar = 0;
           break;
         }
@@ -194,19 +195,19 @@
       // Otherwise, these are not valid escapes.
       case '(': case '{': case '[': case '%':
         // GCC accepts these as extensions.  We warn about them as such though.
-        if (!PP.getLangOptions().NoExtensions) {
-          PP.Diag(StringToks[i], diag::ext_nonstandard_escape,
-                  std::string()+(char)ResultChar);
+        if (!Context.PP.getLangOptions().NoExtensions) {
+          Diag(StringToks[i].getLocation(), diag::ext_nonstandard_escape,
+               std::string()+(char)ResultChar);
           break;
         }
         // FALL THROUGH.
       default:
         if (isgraph(ThisTokBuf[0])) {
-          PP.Diag(StringToks[i], diag::ext_unknown_escape,
-                  std::string()+(char)ResultChar);
+          Diag(StringToks[i].getLocation(), diag::ext_unknown_escape,
+               std::string()+(char)ResultChar);
         } else {
-          PP.Diag(StringToks[i], diag::ext_unknown_escape,
-                  "x"+utohexstr(ResultChar));
+          Diag(StringToks[i].getLocation(), diag::ext_unknown_escape,
+               "x"+utohexstr(ResultChar));
         }
       }
 

Modified: cfe/cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/cfe/trunk/clang.xcodeproj/project.pbxproj Wed Jul 11 11:40:13 2007
@@ -42,6 +42,7 @@
 		DE5932D30AD60FF400BC794C /* PrintParserCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5932CF0AD60FF400BC794C /* PrintParserCallbacks.cpp */; };
 		DE5932D40AD60FF400BC794C /* PrintPreprocessedOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE5932D00AD60FF400BC794C /* PrintPreprocessedOutput.cpp */; };
 		DE75ED190B0446470020CF81 /* SemaStmt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE75ED180B0446470020CF81 /* SemaStmt.cpp */; };
+		DE75ED290B044DC90020CF81 /* ASTContext.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE75ED280B044DC90020CF81 /* ASTContext.h */; };
 		DEAEE98B0A5A2B970045101B /* MultipleIncludeOpt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */; };
 		DEAEED4B0A5AF89A0045101B /* NOTES.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEED4A0A5AF89A0045101B /* NOTES.txt */; };
 		DEC8D9910A9433CD00353FCA /* Decl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEC8D9900A9433CD00353FCA /* Decl.h */; };
@@ -125,6 +126,7 @@
 				DE345F220AFD347900DBC861 /* StmtNodes.def in CopyFiles */,
 				DE3464220B03040900DBC861 /* Type.h in CopyFiles */,
 				DE34646E0B043E5B00DBC861 /* Sema.h in CopyFiles */,
+				DE75ED290B044DC90020CF81 /* ASTContext.h in CopyFiles */,
 			);
 			runOnlyForDeploymentPostprocessing = 1;
 		};
@@ -167,6 +169,7 @@
 		DE5932CF0AD60FF400BC794C /* PrintParserCallbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PrintParserCallbacks.cpp; path = Driver/PrintParserCallbacks.cpp; sourceTree = "<group>"; };
 		DE5932D00AD60FF400BC794C /* PrintPreprocessedOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PrintPreprocessedOutput.cpp; path = Driver/PrintPreprocessedOutput.cpp; sourceTree = "<group>"; };
 		DE75ED180B0446470020CF81 /* SemaStmt.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SemaStmt.cpp; path = AST/SemaStmt.cpp; sourceTree = "<group>"; };
+		DE75ED280B044DC90020CF81 /* ASTContext.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ASTContext.h; path = clang/AST/ASTContext.h; sourceTree = "<group>"; };
 		DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MultipleIncludeOpt.h; sourceTree = "<group>"; };
 		DEAEED4A0A5AF89A0045101B /* NOTES.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = NOTES.txt; sourceTree = "<group>"; };
 		DEC8D9900A9433CD00353FCA /* Decl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Decl.h; path = clang/AST/Decl.h; sourceTree = "<group>"; };
@@ -299,6 +302,7 @@
 			isa = PBXGroup;
 			children = (
 				DEC8D9A30A94346E00353FCA /* AST.h */,
+				DE75ED280B044DC90020CF81 /* ASTContext.h */,
 				DEC8DABF0A94402500353FCA /* ASTStreamer.h */,
 				DEC8D9900A9433CD00353FCA /* Decl.h */,
 				DE0FCA620A95859D00248FD5 /* Expr.h */,

Modified: cfe/cfe/trunk/include/clang/AST/AST.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/AST.h?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/AST.h (original)
+++ cfe/cfe/trunk/include/clang/AST/AST.h Wed Jul 11 11:40:13 2007
@@ -15,9 +15,10 @@
 #define LLVM_CLANG_AST_AST_H
 
 // This header exports all AST interfaces.
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTStreamer.h"
 #include "clang/AST/Decl.h"
-#include "clang/AST/Stmt.h"
 #include "clang/AST/Expr.h"
+#include "clang/AST/StmtVisitor.h"
 
 #endif

Added: cfe/cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/ASTContext.h?rev=39161&view=auto

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/ASTContext.h (added)
+++ cfe/cfe/trunk/include/clang/AST/ASTContext.h Wed Jul 11 11:40:13 2007
@@ -0,0 +1,36 @@
+//===--- ASTContext.h - Context to hold long-lived AST nodes ----*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file defines the ASTContext interface.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_ASTCONTEXT_H
+#define LLVM_CLANG_AST_ASTCONTEXT_H
+
+namespace llvm {
+namespace clang {
+  class Preprocessor;
+  
+/// ASTContext - This class holds long-lived AST nodes (such as types and
+/// decls) that can be referred to throughout the semantic analysis of a file.
+class ASTContext {
+public:
+  Preprocessor &PP;
+  
+  ASTContext(Preprocessor &pp) : PP(pp) {}
+  
+  
+  
+};
+  
+}  // end namespace clang
+}  // end namespace llvm
+
+#endif

Propchange: cfe/cfe/trunk/include/clang/AST/ASTContext.h

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/include/clang/AST/ASTContext.h

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: cfe/cfe/trunk/include/clang/AST/ASTStreamer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/ASTStreamer.h?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/ASTStreamer.h (original)
+++ cfe/cfe/trunk/include/clang/AST/ASTStreamer.h Wed Jul 11 11:40:13 2007
@@ -16,18 +16,16 @@
 
 namespace llvm {
 namespace clang {
-  class Preprocessor;
+  class ASTContext;
   class Decl;
   
   /// ASTStreamerTy - This is an opaque type used to reference ASTStreamer
   /// objects.
   typedef void ASTStreamerTy;
   
-  /// ASTStreamer_Init - Create an ASTStreamer with the specified preprocessor
-  /// and FileID.  If FullLocInfo is true, full location information is captured
-  /// in the AST nodes.  This takes more space, but allows for very accurate
-  /// position reporting.
-  ASTStreamerTy *ASTStreamer_Init(Preprocessor &PP, unsigned MainFileID);
+  /// ASTStreamer_Init - Create an ASTStreamer with the specified ASTContext
+  /// and FileID.
+  ASTStreamerTy *ASTStreamer_Init(ASTContext &Context, unsigned MainFileID);
   
   /// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration.
   /// This returns null at end of file.

Modified: cfe/cfe/trunk/include/clang/Sema/ASTStreamer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Sema/ASTStreamer.h?rev=39161&r1=39160&r2=39161&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Sema/ASTStreamer.h (original)
+++ cfe/cfe/trunk/include/clang/Sema/ASTStreamer.h Wed Jul 11 11:40:13 2007
@@ -16,18 +16,16 @@
 
 namespace llvm {
 namespace clang {
-  class Preprocessor;
+  class ASTContext;
   class Decl;
   
   /// ASTStreamerTy - This is an opaque type used to reference ASTStreamer
   /// objects.
   typedef void ASTStreamerTy;
   
-  /// ASTStreamer_Init - Create an ASTStreamer with the specified preprocessor
-  /// and FileID.  If FullLocInfo is true, full location information is captured
-  /// in the AST nodes.  This takes more space, but allows for very accurate
-  /// position reporting.
-  ASTStreamerTy *ASTStreamer_Init(Preprocessor &PP, unsigned MainFileID);
+  /// ASTStreamer_Init - Create an ASTStreamer with the specified ASTContext
+  /// and FileID.
+  ASTStreamerTy *ASTStreamer_Init(ASTContext &Context, unsigned MainFileID);
   
   /// ASTStreamer_ReadTopLevelDecl - Parse and return one top-level declaration.
   /// This returns null at end of file.





More information about the cfe-commits mailing list