[llvm-commits] [llvm] r155298 - /llvm/trunk/lib/Support/StringRef.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 21 15:03:05 PDT 2012
Author: lattner
Date: Sat Apr 21 17:03:05 2012
New Revision: 155298
URL: http://llvm.org/viewvc/llvm-project?rev=155298&view=rev
Log:
No need for "else if" after a return. Autosense "0o123" as octal in
StringRef::getAsInteger
Modified:
llvm/trunk/lib/Support/StringRef.cpp
Modified: llvm/trunk/lib/Support/StringRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/StringRef.cpp?rev=155298&r1=155297&r2=155298&view=diff
==============================================================================
--- llvm/trunk/lib/Support/StringRef.cpp (original)
+++ llvm/trunk/lib/Support/StringRef.cpp Sat Apr 21 17:03:05 2012
@@ -272,14 +272,22 @@
if (Str.startswith("0x")) {
Str = Str.substr(2);
return 16;
- } else if (Str.startswith("0b")) {
+ }
+
+ if (Str.startswith("0b")) {
Str = Str.substr(2);
return 2;
- } else if (Str.startswith("0")) {
+ }
+
+ if (Str.startswith("0o")) {
+ Str = Str.substr(2);
return 8;
- } else {
- return 10;
}
+
+ if (Str.startswith("0"))
+ return 8;
+
+ return 10;
}
More information about the llvm-commits
mailing list