зеркало из https://github.com/microsoft/clang-1.git
capture whether a CharacterLiteral was wide or not in the AST.
Patch by Mike Stump! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52081 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
da8249e57f
Коммит
c250aae4f6
|
@ -234,12 +234,14 @@ public:
|
|||
class CharacterLiteral : public Expr {
|
||||
unsigned Value;
|
||||
SourceLocation Loc;
|
||||
bool IsWide;
|
||||
public:
|
||||
// type should be IntTy
|
||||
CharacterLiteral(unsigned value, QualType type, SourceLocation l)
|
||||
: Expr(CharacterLiteralClass, type), Value(value), Loc(l) {
|
||||
CharacterLiteral(unsigned value, bool iswide, QualType type, SourceLocation l)
|
||||
: Expr(CharacterLiteralClass, type), Value(value), Loc(l), IsWide(iswide) {
|
||||
}
|
||||
SourceLocation getLoc() const { return Loc; }
|
||||
bool isWide() const { return IsWide; }
|
||||
|
||||
virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
|
||||
|
||||
|
|
|
@ -513,8 +513,9 @@ void StmtPrinter::VisitPreDefinedExpr(PreDefinedExpr *Node) {
|
|||
}
|
||||
|
||||
void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) {
|
||||
// FIXME should print an L for wchar_t constants
|
||||
unsigned value = Node->getValue();
|
||||
if (Node->isWide())
|
||||
OS << "L";
|
||||
switch (value) {
|
||||
case '\\':
|
||||
OS << "'\\\\'";
|
||||
|
|
|
@ -375,14 +375,16 @@ CastExpr* CastExpr::CreateImpl(Deserializer& D, ASTContext& C) {
|
|||
void CharacterLiteral::EmitImpl(Serializer& S) const {
|
||||
S.Emit(Value);
|
||||
S.Emit(Loc);
|
||||
S.EmitBool(IsWide);
|
||||
S.Emit(getType());
|
||||
}
|
||||
|
||||
CharacterLiteral* CharacterLiteral::CreateImpl(Deserializer& D, ASTContext& C) {
|
||||
unsigned value = D.ReadInt();
|
||||
SourceLocation Loc = SourceLocation::ReadVal(D);
|
||||
bool iswide = D.ReadBool();
|
||||
QualType T = QualType::ReadVal(D);
|
||||
return new CharacterLiteral(value,T,Loc);
|
||||
return new CharacterLiteral(value,iswide,T,Loc);
|
||||
}
|
||||
|
||||
void CompoundAssignOperator::EmitImpl(Serializer& S) const {
|
||||
|
|
|
@ -183,7 +183,8 @@ Sema::ExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
|
|||
|
||||
QualType type = getLangOptions().CPlusPlus ? Context.CharTy : Context.IntTy;
|
||||
|
||||
return new CharacterLiteral(Literal.getValue(), type, Tok.getLocation());
|
||||
return new CharacterLiteral(Literal.getValue(), Literal.isWide(), type,
|
||||
Tok.getLocation());
|
||||
}
|
||||
|
||||
Action::ExprResult Sema::ActOnNumericConstant(const Token &Tok) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче