Hi,

A small patch for adding:
- a missing include <string> in a header
- a missing file ASTConsumer.cpp in clangAST projet for VS

This allow to compile on VS2005 but there is still the old problem that enum
are signed by default on VS2005. This cause clang to assert on code like

Struct A { int I; }; struct A a;

More specifically, the problem is in DeclSpec.h at the line 64 and 111 and
174:

=========

  enum TST {
    TST_unspecified,
    TST_void,
[... 14 other enumerated type ...]
  };

TST TypeSpecType : 4;

TST getTypeSpecType() const { return TypeSpecType; }

=========

And VS2005 as the good idea to return -4 instead of 12 for struct type (same
problem for all the type >=8).

I don't know what would be the best patch. (It is not the first time I see
this problem and probably not the last time, so I would like to know how
best correct it)

I see three solutions:

1) =======================

- TST TypeSpecType : 4;
+ TST TypeSpecType : 5;

2) =======================
- enum TST {
+ enum TST UNSIGNED_ENUM {

Where UNSIGNED_ENUN is:
#ifdef VS
#define UNSIGNED_ENUN : unsigned
#else
#define UNSIGNED_ENUN
#endif

3) =======================

Something like this (this doesn't work)

- TST getTypeSpecType() const { return TypeSpecType; }
+ TST getTypeSpecType() const { return (TST)(unsigned)TypeSpecType; }

Regards,

-- 
Cédric Venet


Attachment: miniclang.patch
Description: Binary data

_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to