[cfe-commits] r39162 - in /cfe/cfe/trunk: AST/ASTContext.cpp AST/SemaExpr.cpp Sema/SemaExpr.cpp include/clang/AST/ASTContext.h

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


Author: sabre
Date: Wed Jul 11 11:40:16 2007
New Revision: 39162

URL: http://llvm.org/viewvc/llvm-project?rev=39162&view=rev
Log:
Let ASTContext hold target info, since it's useful

Added:
    cfe/cfe/trunk/AST/ASTContext.cpp   (with props)
Modified:
    cfe/cfe/trunk/AST/SemaExpr.cpp
    cfe/cfe/trunk/Sema/SemaExpr.cpp
    cfe/cfe/trunk/include/clang/AST/ASTContext.h

Added: cfe/cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/ASTContext.cpp?rev=39162&view=auto

==============================================================================
--- cfe/cfe/trunk/AST/ASTContext.cpp (added)
+++ cfe/cfe/trunk/AST/ASTContext.cpp Wed Jul 11 11:40:16 2007
@@ -0,0 +1,22 @@
+//===--- ASTContext.cpp - Context to hold long-lived AST nodes ------------===//
+//
+//                     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 implements the ASTContext interface.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/Lex/Preprocessor.h"
+using namespace llvm;
+using namespace clang;
+
+ASTContext::ASTContext(Preprocessor &pp)
+  : PP(pp), Target(pp.getTargetInfo()) {
+}
+

Propchange: cfe/cfe/trunk/AST/ASTContext.cpp

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

Propchange: cfe/cfe/trunk/AST/ASTContext.cpp

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

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

==============================================================================
--- cfe/cfe/trunk/AST/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/AST/SemaExpr.cpp Wed Jul 11 11:40:16 2007
@@ -75,8 +75,7 @@
   // query the target.  As such, wchar_tByteWidth is only valid if AnyWide=true.
   unsigned wchar_tByteWidth = ~0U;
   if (AnyWide)
-    wchar_tByteWidth =
-      Context.PP.getTargetInfo().getWCharWidth(StringToks[0].getLocation());
+    wchar_tByteWidth =Context.Target.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".

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

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:40:16 2007
@@ -75,8 +75,7 @@
   // query the target.  As such, wchar_tByteWidth is only valid if AnyWide=true.
   unsigned wchar_tByteWidth = ~0U;
   if (AnyWide)
-    wchar_tByteWidth =
-      Context.PP.getTargetInfo().getWCharWidth(StringToks[0].getLocation());
+    wchar_tByteWidth =Context.Target.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".

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

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/cfe/trunk/include/clang/AST/ASTContext.h Wed Jul 11 11:40:16 2007
@@ -17,14 +17,16 @@
 namespace llvm {
 namespace clang {
   class Preprocessor;
+  class TargetInfo;
   
 /// 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;
+  TargetInfo &Target;
   
-  ASTContext(Preprocessor &pp) : PP(pp) {}
+  ASTContext(Preprocessor &pp);
   
   
   





More information about the cfe-commits mailing list