r211139 - Replace some assert(0)'s with llvm_unreachable.
David Blaikie
dblaikie at gmail.com
Tue Jun 17 21:16:38 PDT 2014
On Tue, Jun 17, 2014 at 8:57 PM, Craig Topper <craig.topper at gmail.com> wrote:
> Author: ctopper
> Date: Tue Jun 17 22:57:25 2014
> New Revision: 211139
>
> URL: http://llvm.org/viewvc/llvm-project?rev=211139&view=rev
> Log:
> Replace some assert(0)'s with llvm_unreachable.
>
> Modified:
> cfe/trunk/lib/Sema/SemaChecking.cpp
> cfe/trunk/utils/TableGen/NeonEmitter.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=211139&r1=211138&r2=211139&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Jun 17 22:57:25 2014
> @@ -5385,7 +5385,7 @@ static void DiagnoseOutOfRangeComparison
> // comparisons will be tautological.
> EqualityOnly = true;
> } else { // OtherSigned && ConstantSigned
> - assert(0 && "Two signed types converted to unsigned types.");
> + llvm_unreachable("Two signed types converted to unsigned types.");
The if/else could be removed entirely and the if condition replaced
with an assert.
> }
> }
>
>
> Modified: cfe/trunk/utils/TableGen/NeonEmitter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/NeonEmitter.cpp?rev=211139&r1=211138&r2=211139&view=diff
> ==============================================================================
> --- cfe/trunk/utils/TableGen/NeonEmitter.cpp (original)
> +++ cfe/trunk/utils/TableGen/NeonEmitter.cpp Tue Jun 17 22:57:25 2014
> @@ -562,14 +562,14 @@ std::string Type::builtin_str() const {
> case 32: S += "i"; break;
> case 64: S += "Wi"; break;
> case 128: S += "LLLi"; break;
> - default: assert(0 && "Unhandled case!");
> + default: llvm_unreachable("Unhandled case!");
> }
> else
> switch (ElementBitwidth) {
> case 16: S += "h"; break;
> case 32: S += "f"; break;
> case 64: S += "d"; break;
> - default: assert(0 && "Unhandled case!");
> + default: llvm_unreachable("Unhandled case!");
> }
>
> if (isChar() && !Pointer)
> @@ -742,7 +742,7 @@ void Type::applyTypespec(bool &Quad) {
> NumVectors = 0;
> break;
> default:
> - assert(0 && "Unhandled type code!");
> + llvm_unreachable("Unhandled type code!");
> }
> }
> assert(ElementBitwidth != ~0U && "Bad element bitwidth!");
> @@ -907,7 +907,7 @@ void Type::applyModifier(char Mod) {
> Bitwidth *= 2;
> break;
> default:
> - assert(0 && "Unhandled character!");
> + llvm_unreachable("Unhandled character!");
> }
> }
>
> @@ -1061,7 +1061,7 @@ std::string Intrinsic::mangleName(std::s
> case 16: Suffix = 'h'; break;
> case 32: Suffix = 's'; break;
> case 64: Suffix = 'd'; break;
> - default: assert(0 && "Bad suffix!");
> + default: llvm_unreachable("Bad suffix!");
> }
> }
> if (Suffix != '\0') {
> @@ -2282,6 +2282,6 @@ void EmitNeonSema(RecordKeeper &Records,
> NeonEmitter(Records).runHeader(OS);
> }
> void EmitNeonTest(RecordKeeper &Records, raw_ostream &OS) {
> - assert(0 && "Neon test generation no longer implemented!");
> + llvm_unreachable("Neon test generation no longer implemented!");
> }
> } // End namespace clang
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list