[llvm-branch-commits] [clang] 7e84aa1 - Fix MSVC "not all control paths return a value" warnings. NFCI.

Simon Pilgrim via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Dec 20 03:37:20 PST 2020


Author: Simon Pilgrim
Date: 2020-12-20T11:32:40Z
New Revision: 7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0

URL: https://github.com/llvm/llvm-project/commit/7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0
DIFF: https://github.com/llvm/llvm-project/commit/7e84aa1b81e72d44bcc58ffe1731bfc7abb73ce0.diff

LOG: Fix MSVC "not all control paths return a value" warnings. NFCI.

Add missing llvm_unreachable()'s after each all-enums switch statement.

Added: 
    

Modified: 
    clang/lib/Sema/SemaTemplate.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 74a31c0a1b65..9d31a8701241 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -7637,6 +7637,7 @@ static Expr *BuildExpressionFromNonTypeTemplateArgumentValue(
     auto *OVE = new (S.Context) OpaqueValueExpr(Loc, T, VK);
     return ConstantExpr::Create(S.Context, OVE, Val);
   }
+  llvm_unreachable("Unhandled APValue::ValueKind enum");
 }
 
 ExprResult
@@ -7666,6 +7667,7 @@ Sema::BuildExpressionFromNonTypeTemplateArgument(const TemplateArgument &Arg,
     return BuildExpressionFromNonTypeTemplateArgumentValue(
         *this, Arg.getUncommonValueType(), Arg.getAsUncommonValue(), Loc);
   }
+  llvm_unreachable("Unhandled TemplateArgument::ArgKind enum");
 }
 
 /// Match two template parameters within template parameter lists.


        


More information about the llvm-branch-commits mailing list