add an assertion for unreachable code.
authorChris Lattner <sabre@nondot.org>
Sat, 21 Mar 2009 06:40:50 +0000 (06:40 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 21 Mar 2009 06:40:50 +0000 (06:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67432 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclarationName.h
lib/AST/DeclarationName.cpp

index 77e5024e370481c06cfde5f9023fe9b3c5d94ca9..d1cd4ebc958b4176725893098e89c14316185852 100644 (file)
@@ -104,16 +104,14 @@ private:
     if (getNameKind() >= CXXConstructorName && 
         getNameKind() <= CXXConversionFunctionName)
       return reinterpret_cast<CXXSpecialName *>(Ptr & ~PtrMask);
-    else
-      return 0;
+    return 0;
   }
 
   /// getAsCXXOperatorIdName
   CXXOperatorIdName *getAsCXXOperatorIdName() const {
     if (getNameKind() == CXXOperatorName)
       return reinterpret_cast<CXXOperatorIdName *>(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<IdentifierInfo *>(Ptr);
-    else
-      return 0;
+    return 0;
   }
 
   /// getAsOpaqueInteger - Get the representation of this declaration
index 3815a08a6522084f8323026dc390ece553c0bad2..e2ed8925951da647501fd72b5171dd7ace79406d 100644 (file)
@@ -113,6 +113,7 @@ DeclarationName::NameKind DeclarationName::getNameKind() const {
   }
 
   // Can't actually get here.
+  assert(0 && "This should be unreachable!");
   return Identifier;
 }