[cfe-commits] r138533 - in /cfe/trunk: include/clang/Basic/TokenKinds.def lib/Parse/ParseDecl.cpp lib/Parse/ParseTentative.cpp test/Parser/MicrosoftExtensions.c
Francois Pichet
pichet2000 at gmail.com
Wed Aug 24 17:36:46 PDT 2011
Author: fpichet
Date: Wed Aug 24 19:36:46 2011
New Revision: 138533
URL: http://llvm.org/viewvc/llvm-project?rev=138533&view=rev
Log:
Add support for Microsoft __ptr32 keyword.
Patch by Chris Cudmore!
Modified:
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.c
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=138533&r1=138532&r2=138533&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Wed Aug 24 19:36:46 2011
@@ -466,6 +466,7 @@
// Microsoft extensions which should be disabled in strict conformance mode
KEYWORD(__ptr64 , KEYMS)
+KEYWORD(__ptr32 , KEYMS)
KEYWORD(__w64 , KEYMS)
KEYWORD(__uuidof , KEYMS | KEYBORLAND)
KEYWORD(__try , KEYMS | KEYBORLAND)
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=138533&r1=138532&r2=138533&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Aug 24 19:36:46 2011
@@ -303,10 +303,12 @@
while (Tok.is(tok::kw___fastcall) || Tok.is(tok::kw___stdcall) ||
Tok.is(tok::kw___thiscall) || Tok.is(tok::kw___cdecl) ||
Tok.is(tok::kw___ptr64) || Tok.is(tok::kw___w64) ||
+ Tok.is(tok::kw___ptr32) ||
Tok.is(tok::kw___unaligned)) {
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
- if (Tok.is(tok::kw___ptr64) || Tok.is(tok::kw___w64))
+ if (Tok.is(tok::kw___ptr64) || Tok.is(tok::kw___w64) ||
+ Tok.is(tok::kw___ptr32))
// FIXME: Support these properly!
continue;
attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
@@ -1722,6 +1724,7 @@
break;
case tok::kw___ptr64:
+ case tok::kw___ptr32:
case tok::kw___w64:
case tok::kw___cdecl:
case tok::kw___stdcall:
@@ -2271,6 +2274,7 @@
break;
case tok::kw___ptr64:
+ case tok::kw___ptr32:
case tok::kw___w64:
case tok::kw___cdecl:
case tok::kw___stdcall:
@@ -2985,6 +2989,7 @@
case tok::kw___thiscall:
case tok::kw___w64:
case tok::kw___ptr64:
+ case tok::kw___ptr32:
case tok::kw___pascal:
case tok::kw___unaligned:
@@ -3132,6 +3137,7 @@
case tok::kw___thiscall:
case tok::kw___w64:
case tok::kw___ptr64:
+ case tok::kw___ptr32:
case tok::kw___forceinline:
case tok::kw___pascal:
case tok::kw___unaligned:
@@ -3266,6 +3272,7 @@
case tok::kw___w64:
case tok::kw___ptr64:
+ case tok::kw___ptr32:
case tok::kw___cdecl:
case tok::kw___stdcall:
case tok::kw___fastcall:
@@ -3684,7 +3691,7 @@
if (Tok.is(tok::kw___cdecl) || Tok.is(tok::kw___stdcall) ||
Tok.is(tok::kw___thiscall) || Tok.is(tok::kw___fastcall) ||
Tok.is(tok::kw___w64) || Tok.is(tok::kw___ptr64) ||
- Tok.is(tok::kw___unaligned)) {
+ Tok.is(tok::kw___ptr32) || Tok.is(tok::kw___unaligned)) {
ParseMicrosoftTypeAttributes(attrs);
}
// Eat any Borland extensions.
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=138533&r1=138532&r2=138533&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Wed Aug 24 19:36:46 2011
@@ -904,6 +904,7 @@
case tok::kw___thiscall:
case tok::kw___w64:
case tok::kw___ptr64:
+ case tok::kw___ptr32:
case tok::kw___forceinline:
case tok::kw___unaligned:
return TPResult::True();
Modified: cfe/trunk/test/Parser/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.c?rev=138533&r1=138532&r2=138533&view=diff
==============================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.c (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.c Wed Aug 24 19:36:46 2011
@@ -8,10 +8,16 @@
__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory );
typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
+
void * __ptr64 PtrToPtr64(const void *p)
{
return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p );
}
+void * __ptr32 PtrToPtr32(const void *p)
+{
+ return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p );
+}
+
void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
{
__asm {
More information about the cfe-commits
mailing list