[cfe-commits] r47004 - in /cfe/trunk: AST/ASTContext.cpp include/clang/AST/ASTContext.h

Eli Friedman eli.friedman at gmail.com
Tue Feb 12 00:29:21 PST 2008


Author: efriedma
Date: Tue Feb 12 02:29:21 2008
New Revision: 47004

URL: http://llvm.org/viewvc/llvm-project?rev=47004&view=rev
Log:
Add wchar_t type to ASTContext.  Will be needed for wide strings, since 
they are of type wchar_t[].


Modified:
    cfe/trunk/AST/ASTContext.cpp
    cfe/trunk/include/clang/AST/ASTContext.h

Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=47004&r1=47003&r2=47004&view=diff

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Tue Feb 12 02:29:21 2008
@@ -839,6 +839,15 @@
   return UnsignedLongTy; 
 }
 
+/// getWcharType - Return the unique type for "wchar_t" (C99 7.17), the
+/// width of characters in wide strings, The value is target dependent and 
+/// needs to agree with the definition in <stddef.h>.
+QualType ASTContext::getWcharType() const {
+  // On Darwin, wchar_t is defined as a "int". 
+  // FIXME: should derive from "Target".
+  return IntTy; 
+}
+
 /// getPointerDiffType - Return the unique type for "ptrdiff_t" (ref?)
 /// defined in <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).
 QualType ASTContext::getPointerDiffType() const {

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=47004&r1=47003&r2=47004&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Tue Feb 12 02:29:21 2008
@@ -195,6 +195,10 @@
   /// getSizeType - Return the unique type for "size_t" (C99 7.17), defined
   /// in <stddef.h>. The sizeof operator requires this (C99 6.5.3.4p4).
   QualType getSizeType() const;
+
+  /// getWcharType - Return the unique type for "wchar_t" (C99 7.17), defined
+  /// in <stddef.h>. Wide strings require this (C99 6.4.5p5).
+  QualType getWcharType() const;
   
   /// getPointerDiffType - Return the unique type for "ptrdiff_t" (ref?)
   /// defined in <stddef.h>. Pointer - pointer requires this (C99 6.5.6p9).





More information about the cfe-commits mailing list