From: Chris Lattner Date: Sat, 21 Mar 2009 06:40:50 +0000 (+0000) Subject: add an assertion for unreachable code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac8d75fe94f2aefde5179d53e230b99a1fe1201a;p=clang add an assertion for unreachable code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67432 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclarationName.h b/include/clang/AST/DeclarationName.h index 77e5024e37..d1cd4ebc95 100644 --- a/include/clang/AST/DeclarationName.h +++ b/include/clang/AST/DeclarationName.h @@ -104,16 +104,14 @@ private: if (getNameKind() >= CXXConstructorName && getNameKind() <= CXXConversionFunctionName) return reinterpret_cast(Ptr & ~PtrMask); - else - return 0; + return 0; } /// getAsCXXOperatorIdName CXXOperatorIdName *getAsCXXOperatorIdName() const { if (getNameKind() == CXXOperatorName) return reinterpret_cast(Ptr & ~PtrMask); - else - return 0; + return 0; } // Construct a declaration name from the name of a C++ constructor, @@ -177,8 +175,7 @@ public: IdentifierInfo *getAsIdentifierInfo() const { if (getNameKind() == Identifier) return reinterpret_cast(Ptr); - else - return 0; + return 0; } /// getAsOpaqueInteger - Get the representation of this declaration diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp index 3815a08a65..e2ed892595 100644 --- a/lib/AST/DeclarationName.cpp +++ b/lib/AST/DeclarationName.cpp @@ -113,6 +113,7 @@ DeclarationName::NameKind DeclarationName::getNameKind() const { } // Can't actually get here. + assert(0 && "This should be unreachable!"); return Identifier; }