From 42cbdd37c611813ba25a214d71284d48c505f32d Mon Sep 17 00:00:00 2001 From: "petro.zarytskyi" Date: Wed, 23 Oct 2024 09:18:10 +0200 Subject: [PATCH] Always use valid location when generating operators --- lib/Differentiator/VisitorBase.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Differentiator/VisitorBase.cpp b/lib/Differentiator/VisitorBase.cpp index 63ae3c369..db191134d 100644 --- a/lib/Differentiator/VisitorBase.cpp +++ b/lib/Differentiator/VisitorBase.cpp @@ -392,6 +392,9 @@ namespace clad { SourceLocation OpLoc) { if (!E) return nullptr; + // Debug clang requires the location to be valid + if (!OpLoc.isValid()) + OpLoc = utils::GetValidSLoc(m_Sema); return m_Sema.BuildUnaryOp(nullptr, OpLoc, OpCode, E).get(); } @@ -399,6 +402,9 @@ namespace clad { SourceLocation OpLoc) { if (!L || !R) return nullptr; + // Debug clang requires the location to be valid + if (!OpLoc.isValid()) + OpLoc = utils::GetValidSLoc(m_Sema); return m_Sema.BuildBinOp(nullptr, OpLoc, OpCode, L, R).get(); }