[clang] 7ac658a - [WebAssembly] assert(false) -> llvm_unreachable

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 18 00:41:28 PST 2023


Author: Benjamin Kramer
Date: 2023-02-18T09:38:18+01:00
New Revision: 7ac658a07b9a2937f1a9319a47a9cec6afae2370

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

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

Avoids warnings in -asserts builds.

ASTContext.cpp:4098:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
}
^

Added: 
    

Modified: 
    clang/lib/AST/ASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index a22c21779e1c..9b0d7b2b4b5a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -4093,8 +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