summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-05 21:21:32 +0000
committerChris Lattner <sabre@nondot.org>2009-11-05 21:21:32 +0000
commite4a8c64731a22a505a28ba9410146588c98ef21b (patch)
treed440f2fb7063afc5dc71822156ce16a02a066196 /clang/lib/Basic
parent1ef784db677802b24bfcf9a0c00fa69e69853468 (diff)
downloadbcm5719-llvm-e4a8c64731a22a505a28ba9410146588c98ef21b.tar.gz
bcm5719-llvm-e4a8c64731a22a505a28ba9410146588c98ef21b.zip
clean up integer preprocessor type definitions, patch by Ken Dyck!
llvm-svn: 86177
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/TargetInfo.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index e965b9aec36..9ebacb240ee 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -96,17 +96,33 @@ const char *TargetInfo::getTypeConstantSuffix(IntType T) {
unsigned TargetInfo::getTypeWidth(IntType T) const {
switch (T) {
default: assert(0 && "not an integer!");
- case SignedShort: return getShortWidth();
+ case SignedShort:
case UnsignedShort: return getShortWidth();
- case SignedInt: return getIntWidth();
+ case SignedInt:
case UnsignedInt: return getIntWidth();
- case SignedLong: return getLongWidth();
+ case SignedLong:
case UnsignedLong: return getLongWidth();
- case SignedLongLong: return getLongLongWidth();
+ case SignedLongLong:
case UnsignedLongLong: return getLongLongWidth();
};
}
+/// getTypeAlign - Return the alignment (in bits) of the specified integer type
+/// enum. For example, SignedInt -> getIntAlign().
+unsigned TargetInfo::getTypeAlign(IntType T) const {
+ switch (T) {
+ default: assert(0 && "not an integer!");
+ case SignedShort:
+ case UnsignedShort: return getShortAlign();
+ case SignedInt:
+ case UnsignedInt: return getIntAlign();
+ case SignedLong:
+ case UnsignedLong: return getLongAlign();
+ case SignedLongLong:
+ case UnsignedLongLong: return getLongLongAlign();
+ };
+}
+
/// isTypeSigned - Return whether an integer types is signed. Returns true if
/// the type is signed; false otherwise.
bool TargetInfo::isTypeSigned(IntType T) const {
OpenPOWER on IntegriCloud