[cfe-commits] r151357 - /cfe/trunk/lib/AST/Expr.cpp
Nick Lewycky
nicholas at mxc.ca
Fri Feb 24 00:58:14 PST 2012
Author: nicholas
Date: Fri Feb 24 02:58:14 2012
New Revision: 151357
URL: http://llvm.org/viewvc/llvm-project?rev=151357&view=rev
Log:
Silence gcc warnings pointing out that CharByteWidth could be used
uninitialized. While there, restyle this function! No functionality change.
Modified:
cfe/trunk/lib/AST/Expr.cpp
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=151357&r1=151356&r2=151357&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Fri Feb 24 02:58:14 2012
@@ -499,25 +499,28 @@
return V.convertToDouble();
}
-int StringLiteral::mapCharByteWidth(TargetInfo const &target,StringKind k) {
+int StringLiteral::mapCharByteWidth(TargetInfo const &Target,
+ StringKind Kind) {
int CharByteWidth;
- switch(k) {
+ switch(Kind) {
case Ascii:
case UTF8:
- CharByteWidth = target.getCharWidth();
+ CharByteWidth = Target.getCharWidth();
break;
case Wide:
- CharByteWidth = target.getWCharWidth();
+ CharByteWidth = Target.getWCharWidth();
break;
case UTF16:
- CharByteWidth = target.getChar16Width();
+ CharByteWidth = Target.getChar16Width();
break;
case UTF32:
- CharByteWidth = target.getChar32Width();
+ CharByteWidth = Target.getChar32Width();
+ default:
+ llvm_unreachable("Don't know byte width of this string kind!");
}
assert((CharByteWidth & 7) == 0 && "Assumes character size is byte multiple");
CharByteWidth /= 8;
- assert((CharByteWidth==1 || CharByteWidth==2 || CharByteWidth==4)
+ assert((CharByteWidth == 1 || CharByteWidth == 2 || CharByteWidth == 4)
&& "character byte widths supported are 1, 2, and 4 only");
return CharByteWidth;
}
@@ -562,7 +565,7 @@
this->Kind = Kind;
this->IsPascal = IsPascal;
- CharByteWidth = mapCharByteWidth(C.getTargetInfo(),Kind);
+ CharByteWidth = mapCharByteWidth(C.getTargetInfo(), Kind);
assert((Str.size()%CharByteWidth == 0)
&& "size of data must be multiple of CharByteWidth");
Length = Str.size()/CharByteWidth;
More information about the cfe-commits
mailing list