r198548 - Pre-declare '::type_info' in MicrosoftMode only, not MicrosoftExt

Alp Toker alp at nuanti.com
Sat Jan 4 22:38:18 PST 2014


Author: alp
Date: Sun Jan  5 00:38:18 2014
New Revision: 198548

URL: http://llvm.org/viewvc/llvm-project?rev=198548&view=rev
Log:
Pre-declare '::type_info' in MicrosoftMode only, not MicrosoftExt

It was previously enabled in both but should only have been part of the drop-in
quirks mode that is 'MicrosoftMode' given that it's only useful for
compatibility with the Microsoft headers/runtime.

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

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=198548&r1=198547&r2=198548&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sun Jan  5 00:38:18 2014
@@ -179,7 +179,7 @@ void Sema::Initialize() {
   }
 
   // Initialize Microsoft "predefined C++ types".
-  if (PP.getLangOpts().MicrosoftExt && PP.getLangOpts().CPlusPlus) {
+  if (PP.getLangOpts().MicrosoftMode && PP.getLangOpts().CPlusPlus) {
     if (IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end())
       PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class),
                         TUScope);

Modified: cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp?rev=198548&r1=198547&r2=198548&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp Sun Jan  5 00:38:18 2014
@@ -21,6 +21,11 @@ void test()
 }
 
 
+namespace ms_predefined_types {
+  // ::type_info is predeclared with forward class declartion
+  void f(const type_info &a);
+}
+
 
 namespace ms_protected_scope {
   struct C { C(); };

Modified: cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp?rev=198548&r1=198547&r2=198548&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp Sun Jan  5 00:38:18 2014
@@ -1,10 +1,6 @@
 // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions
 
 
-// ::type_info is predeclared with forward class declartion
-void f(const type_info &a);
-
-
 // Microsoft doesn't validate exception specification.
 namespace microsoft_exception_spec {
 





More information about the cfe-commits mailing list