r199190 - Sema: Predefine size_t in MSVC Compatibility mode

David Majnemer david.majnemer at gmail.com
Mon Jan 13 22:19:36 PST 2014


Author: majnemer
Date: Tue Jan 14 00:19:35 2014
New Revision: 199190

URL: http://llvm.org/viewvc/llvm-project?rev=199190&view=rev
Log:
Sema: Predefine size_t in MSVC Compatibility mode

MSVC defines size_t without any explicit declarations.  This change
allows us to be compatible with TUs that depend on this declaration
appearing from nowhere.

Modified:
    cfe/trunk/lib/Sema/Sema.cpp
    cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=199190&r1=199189&r2=199190&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Tue Jan 14 00:19:35 2014
@@ -182,6 +182,8 @@ void Sema::Initialize() {
     if (IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end())
       PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class),
                         TUScope);
+
+    addImplicitTypedef("size_t", Context.getSizeType());
   }
 
   // Initialize predefined OpenCL types.

Modified: cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp?rev=199190&r1=199189&r2=199190&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp Tue Jan 14 00:19:35 2014
@@ -24,6 +24,7 @@ void test()
 namespace ms_predefined_types {
   // ::type_info is a built-in forward class declaration.
   void f(const type_info &a);
+  void f(size_t);
 }
 
 





More information about the cfe-commits mailing list