]> granicus.if.org Git - clang/commitdiff
Cast a pointer to 'long long' to satisfy all compilation models.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 2 Mar 2010 01:19:04 +0000 (01:19 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 2 Mar 2010 01:19:04 +0000 (01:19 +0000)
Satisfies radar 7703202.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97532 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/RewriteObjC.cpp

index 98dee264e901541785f4cad3ee1e1cc99ac9b7d9..a13bccbb91ecf2b002ce3eb4b4cc5fe1e6bcace4 100644 (file)
@@ -640,7 +640,9 @@ void RewriteObjC::Initialize(ASTContext &context) {
     Preamble += "#define __block\n";
     Preamble += "#define __weak\n";
   }
-  Preamble += "\n#define __OFFSETOFIVAR__(TYPE, MEMBER) ((long) &((TYPE *)0)->MEMBER)\n";
+  // NOTE! Windows uses LLP64 for 64bit mode. So, cast pointer to long long
+  // as this avoids warning in any 64bit/32bit compilation model.
+  Preamble += "\n#define __OFFSETOFIVAR__(TYPE, MEMBER) ((long long) &((TYPE *)0)->MEMBER)\n";
 }