diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -326,7 +326,8 @@ CL_ClassTemporary, // A temporary of class type, or subobject thereof. CL_ArrayTemporary, // A temporary of array type. CL_ObjCMessageRValue, // ObjC message is an rvalue - CL_PRValue // A prvalue for any other reason, of any other type + CL_PRValue, // A prvalue for any other reason, of any other type + CL_Unknown // Null enumeration }; /// The results of modification testing. enum ModifiableType { @@ -340,14 +341,15 @@ CM_ConstQualifiedField, CM_ConstAddrSpace, CM_ArrayType, - CM_IncompleteType + CM_IncompleteType, + CM_Unknown // Null enumeration }; private: friend class Expr; - unsigned short Kind; - unsigned short Modifiable; + unsigned short Kind = CL_Unknown; + unsigned short Modifiable = CM_Unknown; explicit Classification(Kinds k, ModifiableType m) : Kind(k), Modifiable(m) diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp --- a/clang/lib/AST/ExprClassification.cpp +++ b/clang/lib/AST/ExprClassification.cpp @@ -65,6 +65,8 @@ case Cl::CL_ArrayTemporary: case Cl::CL_ObjCMessageRValue: case Cl::CL_PRValue: assert(getValueKind() == VK_RValue); break; + case Cl::CL_Unknown: + llvm_unreachable("Tried to classify unknown class!"); } Cl::ModifiableType modifiable = Cl::CM_Untested; @@ -678,6 +680,7 @@ case Cl::CL_ArrayTemporary: return LV_ArrayTemporary; case Cl::CL_ObjCMessageRValue: return LV_InvalidMessageExpression; case Cl::CL_PRValue: return LV_InvalidExpression; + case Cl::CL_Unknown: break; } llvm_unreachable("Unhandled kind"); } @@ -701,6 +704,7 @@ case Cl::CL_PRValue: return VC.getModifiable() == Cl::CM_LValueCast ? MLV_LValueCast : MLV_InvalidExpression; + case Cl::CL_Unknown: break; } assert(VC.getKind() == Cl::CL_LValue && "Unhandled kind"); switch (VC.getModifiable()) { @@ -716,6 +720,7 @@ case Cl::CM_ConstAddrSpace: return MLV_ConstAddrSpace; case Cl::CM_ArrayType: return MLV_ArrayType; case Cl::CM_IncompleteType: return MLV_IncompleteType; + case Cl::CM_Unknown: break; } llvm_unreachable("Unhandled modifiable type"); }