[cfe-dev] wchar printer

Bill Wendling isanbard at gmail.com
Thu Jun 5 00:50:55 PDT 2008

On Jun 4, 2008, at 6:40 PM, Mike Stump wrote:

> This removes one FIXME by arranging for wide characters to be  
> printed correctly.
+  CharacterLiteral(unsigned value, bool iswide, QualType type,  
SourceLocation l)
+    : Expr(CharacterLiteralClass, type), Value(value),  
IsWide(iswide), Loc(l) {

You need to have "IsWide" the last in the initialization list.  
Otherwise, the compiler will complain with -Wall.

void CharacterLiteral::EmitImpl(Serializer& S) const {
+  S.EmitBool(IsWide);

Why not emit in the same order that the variables are defined in the  

  class CharacterLiteral : public Expr {
    unsigned Value;
    SourceLocation Loc;
+  bool IsWide;

Same below:

CharacterLiteral* CharacterLiteral::CreateImpl(Deserializer& D,  
ASTContext& C) {
    unsigned value = D.ReadInt();
+  bool iswide = D.ReadBool();
    SourceLocation Loc = SourceLocation::ReadVal(D);
    QualType T = QualType::ReadVal(D);
-  return new CharacterLiteral(value,T,Loc);
+  return new CharacterLiteral(value,iswide,T,Loc);


More information about the cfe-dev mailing list