diff --git a/clang/AST/ASTContext.cpp b/clang/AST/ASTContext.cpp new file mode 100644 index 000000000000..db5dd44e2cef --- /dev/null +++ b/clang/AST/ASTContext.cpp @@ -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()) { +} + diff --git a/clang/AST/SemaExpr.cpp b/clang/AST/SemaExpr.cpp index c660e190f69f..dc98575f2c73 100644 --- a/clang/AST/SemaExpr.cpp +++ b/clang/AST/SemaExpr.cpp @@ -75,8 +75,7 @@ Sema::ParseStringExpr(const LexerToken *StringToks, unsigned NumStringToks) { // 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". diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index c660e190f69f..dc98575f2c73 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -75,8 +75,7 @@ Sema::ParseStringExpr(const LexerToken *StringToks, unsigned NumStringToks) { // 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". diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 52a3c5f6ded2..dc16fffd8acf 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -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);