[llvm] r271793 - [AsmPrinter, CodeView] There are some more ways of getting wchar_t

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 4 08:40:34 PDT 2016


Author: majnemer
Date: Sat Jun  4 10:40:33 2016
New Revision: 271793

URL: http://llvm.org/viewvc/llvm-project?rev=271793&view=rev
Log:
[AsmPrinter, CodeView] There are some more ways of getting wchar_t

C++ has a builtin type called wchar_t.  Clang also provides a type
called __wchar_t in C mode.

In C mode, wchar_t can be a typedef to unsigned short.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=271793&r1=271792&r2=271793&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Sat Jun  4 10:40:33 2016
@@ -769,6 +769,9 @@ TypeIndex CodeViewDebug::lowerTypeAlias(
   if (UnderlyingTypeIndex == TypeIndex(SimpleTypeKind::Int32Long) &&
       Ty->getName() == "HRESULT")
     return TypeIndex(SimpleTypeKind::HResult);
+  if (UnderlyingTypeIndex == TypeIndex(SimpleTypeKind::UInt16Short) &&
+      Ty->getName() == "wchar_t")
+    return TypeIndex(SimpleTypeKind::WideCharacter);
   return UnderlyingTypeIndex;
 }
 
@@ -854,9 +857,8 @@ TypeIndex CodeViewDebug::lowerTypeBasic(
     STK = SimpleTypeKind::Int32Long;
   if (STK == SimpleTypeKind::UInt32 && Ty->getName() == "long unsigned int")
     STK = SimpleTypeKind::UInt32Long;
-  if ((STK == SimpleTypeKind::Int16Short ||
-       STK == SimpleTypeKind::UInt16Short) &&
-      Ty->getName() == "wchar_t")
+  if (STK == SimpleTypeKind::UInt16Short &&
+      (Ty->getName() == "wchar_t" || Ty->getName() == "__wchar_t"))
     STK = SimpleTypeKind::WideCharacter;
   if ((STK == SimpleTypeKind::SignedCharacter ||
        STK == SimpleTypeKind::UnsignedCharacter) &&




More information about the llvm-commits mailing list