From dae7f8ddf47533040025dbf643e67514bb724ee9 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 20 May 2007 23:50:03 +0000 Subject: [PATCH] add interfaces to get sizes of target integer types. llvm-svn: 39470 --- clang/include/clang/Basic/TargetInfo.h | 30 ++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index ed512eca5946..97b5b2f83500 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -104,18 +104,40 @@ public: return true; } + /// getBoolWidth - Return the size of '_Bool' and C++ 'bool' for this target, + /// in bits. + unsigned getBoolWidth(SourceLocation Loc) { + return 8; // FIXME: implement correctly: wrong for ppc32. + } + /// getCharWidth - Return the size of 'char', 'signed char' and /// 'unsigned char' for this target, in bits. unsigned getCharWidth(SourceLocation Loc) { - // FIXME: implement correctly. - return 8; + return 8; // FIXME: implement correctly. + } + + /// getShortWidth - Return the size of 'signed short' and 'unsigned short' for + /// this target, in bits. + unsigned getShortWidth(SourceLocation Loc) { + return 16; // FIXME: implement correctly. } /// getIntWidth - Return the size of 'signed int' and 'unsigned int' for this /// target, in bits. unsigned getIntWidth(SourceLocation Loc) { - // FIXME: implement correctly. - return 32; + return 32; // FIXME: implement correctly. + } + + /// getLongWidth - Return the size of 'signed long' and 'unsigned long' for + /// this target, in bits. + unsigned getLongWidth(SourceLocation Loc) { + return 32; // FIXME: implement correctly: wrong for ppc64/x86-64 + } + + /// getLongLongWidth - Return the size of 'signed long long' and + /// 'unsigned long long' for this target, in bits. + unsigned getLongLongWidth(SourceLocation Loc) { + return 64; // FIXME: implement correctly. } /// getWCharWidth - Return the size of wchar_t in bits.