mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Let ASTContext hold target info, since it's useful
llvm-svn: 39162
This commit is contained in:
22
clang/AST/ASTContext.cpp
Normal file
22
clang/AST/ASTContext.cpp
Normal file
@@ -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()) {
|
||||
}
|
||||
|
||||
@@ -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".
|
||||
|
||||
@@ -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".
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user