[cfe-commits] r130369 - in /cfe/trunk: include/clang/Basic/TokenKinds.def lib/Frontend/InitPreprocessor.cpp lib/Parse/ParseDecl.cpp lib/Parse/ParseExpr.cpp lib/Parse/ParseExprCXX.cpp lib/Parse/ParseTentative.cpp test/Parser/MicrosoftExtensions.cpp test/Preprocessor/init.c

John McCall rjmccall at apple.com
Wed Apr 27 21:33:38 PDT 2011


On Apr 27, 2011, at 9:28 PM, Charles Davis wrote:

> On 4/27/11 10:21 PM, John McCall wrote:
>> On Apr 27, 2011, at 8:29 PM, Charles Davis wrote:
>>> On 4/27/11 7:59 PM, Francois Pichet wrote:
>>>> Author: fpichet
>>>> Date: Wed Apr 27 20:59:37 2011
>>>> New Revision: 130369
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=130369&view=rev
>>>> Log:
>>>> Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin defines to real types.
>>> These actually need to be distinct types, if only so we can mangle them
>>> properly in the Microsoft Visual C++ ABI. (There's a TODO in
>>> lib/AST/MicrosoftMangle.cpp to that effect.) Right now, they're just
>>> aliases to the standard C types.
>> 
>> Are these really distinct types, or are they just typedefs that happen to get mangled distinctly?
> On second thought, it does seem redundant to have separate types for
> __int8 and char, etc. Semantically, there's really no difference. I just
> don't know how to detect if something was declared __int8 vs. char (or
> __int16 vs. short or __int32 vs int or __int64 vs long long), short of
> actually reading the source from the mangler.

Well, I think we already figured out that the MS mangler has to work with non-canonical types sometimes;  this would just involve looking for particular TypedefTypes.

But the first thing to figure out is whether they're different types.  Judging from these changes they're built into the compiler somehow, so we need to check this programmatically, e.g., by whether this compiles or not:

template <class A, class B> struct is_same {
  enum { value = -1 };
};
template <class A> struct is_same<A,B> {
  enum { value = 1 };
};
char myarray[is_same<__int16, short>::value];

John.



More information about the cfe-commits mailing list