[clang] d8982f7 - [AST] assert(false) -> llvm_unreachable

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 31 09:57:57 PST 2023


Author: Benjamin Kramer
Date: 2023-01-31T18:57:01+01:00
New Revision: d8982f72282bb88da6a3793f9d55fccd5621c825

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

LOG: [AST] assert(false) -> llvm_unreachable

Has the advantage of not triggering missing return warnings even in
NDEBUG builds.

Added: 
    

Modified: 
    clang/lib/AST/ASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 438c224f0a2c..a6dfbd48d0d4 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -4093,7 +4093,8 @@ QualType ASTContext::getWebAssemblyExternrefType() const {
     return SingletonId;
 #include "clang/Basic/WebAssemblyReferenceTypes.def"
   }
-  assert(false && "shouldn't try to generate type externref outside WebAssembly target");
+  llvm_unreachable(
+      "shouldn't try to generate type externref outside WebAssembly target");
 }
 
 /// getScalableVectorType - Return the unique reference to a scalable vector


        


More information about the cfe-commits mailing list