summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2013-09-05 11:23:21 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2013-09-05 11:23:21 +0000
commit5a63792239fd323ef8dc485ccb93f09576c203a7 (patch)
treea696fe3f8fd35a8c4021d103681dfb9206b762dc /clang/lib/Frontend/InitPreprocessor.cpp
parenta1787a58350d45c61e4586cbe1cb8271572f0496 (diff)
downloadbcm5719-llvm-5a63792239fd323ef8dc485ccb93f09576c203a7.tar.gz
bcm5719-llvm-5a63792239fd323ef8dc485ccb93f09576c203a7.zip
Add new methods for TargetInfo:
getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth. As first commit for PR16752 fix: 'mode' attribute for unusual targets doesn't work properly Description: Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp). For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only. Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct. Please consider the next solution: 1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth virtual methods. By default current behaviour could be implemented here. 2. Fix handleModeAttr according to new methods in TargetInfo. This approach is implemented in the patch attached to this post. Fixes: 1st Commit (Current): Add new methods for TargetInfo: getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth 2nd Commit (Next): Fix SemaDeclAttr, handleModeAttr function. llvm-svn: 190044
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 2eb74e0825f..0d76069a843 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -497,7 +497,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
assert(TI.getCharWidth() == 8 && "Only support 8-bit char so far");
Builder.defineMacro("__CHAR_BIT__", "8");
- DefineTypeSize("__SCHAR_MAX__", TI.getCharWidth(), "", true, Builder);
+ DefineTypeSize("__SCHAR_MAX__", TargetInfo::SignedChar, TI, Builder);
DefineTypeSize("__SHRT_MAX__", TargetInfo::SignedShort, TI, Builder);
DefineTypeSize("__INT_MAX__", TargetInfo::SignedInt, TI, Builder);
DefineTypeSize("__LONG_MAX__", TargetInfo::SignedLong, TI, Builder);
OpenPOWER on IntegriCloud