[clang] 3696941 - [clang][Interp][NFC] Add an assertion

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 11 04:05:26 PST 2023


Author: Timm Bäder
Date: 2023-01-11T13:05:14+01:00
New Revision: 3696941dae5cc5bb379c50eae6190e29f7edbbb1

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

LOG: [clang][Interp][NFC] Add an assertion

This is unnecessary in the current state of the interpreter, but will ne
important later.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h
index f817fb4aedef..4e4f2eecd172 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.h
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -359,6 +359,7 @@ template <class Emitter> class ExprScope final : public LocalScope<Emitter> {
   ExprScope(ByteCodeExprGen<Emitter> *Ctx) : LocalScope<Emitter>(Ctx) {}
 
   void addExtended(const Scope::Local &Local) override {
+    assert(this->Parent);
     this->Parent->addLocal(Local);
   }
 };


        


More information about the cfe-commits mailing list