[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.
llvm-svn: 271793
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 98f69c5..57fa54a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -769,6 +769,9 @@
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 @@
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) &&