[clang] 40c9a01 - [clang][Interp][NFC] Add an assertion to classify(Expr*)

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 00:48:19 PST 2024


Author: Timm Bäder
Date: 2024-03-01T09:47:54+01:00
New Revision: 40c9a01773507e485f35aa76d3e31cf3ea8c3011

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

LOG: [clang][Interp][NFC] Add an assertion to classify(Expr*)

NFC but makes the backtrace easier to read in case the expression
somehow ends up being null.

Added: 
    

Modified: 
    clang/lib/AST/Interp/Context.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Context.h b/clang/lib/AST/Interp/Context.h
index c7620921e467e7..dbb63e36918161 100644
--- a/clang/lib/AST/Interp/Context.h
+++ b/clang/lib/AST/Interp/Context.h
@@ -75,6 +75,7 @@ class Context final {
 
   /// Classifies an expression.
   std::optional<PrimType> classify(const Expr *E) const {
+    assert(E);
     if (E->isGLValue()) {
       if (E->getType()->isFunctionType())
         return PT_FnPtr;


        


More information about the cfe-commits mailing list