From edf5cf10d6f23b8efe8eb9cfcba773deffc4684d 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 ++++++ test/Arrays/ArrayInputsVectorForwardMode.C | 2 -- test/ForwardMode/VectorMode.C | 2 -- test/ForwardMode/VectorModeInterface.C | 2 -- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Differentiator/VisitorBase.cpp b/lib/Differentiator/VisitorBase.cpp index 19eeaabc5..20e18795b 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(); } diff --git a/test/Arrays/ArrayInputsVectorForwardMode.C b/test/Arrays/ArrayInputsVectorForwardMode.C index af913241a..4068d91e6 100644 --- a/test/Arrays/ArrayInputsVectorForwardMode.C +++ b/test/Arrays/ArrayInputsVectorForwardMode.C @@ -1,8 +1,6 @@ // RUN: %cladclang %s -I%S/../../include -oArrayInputsVectorForwardMode.out 2>&1 | %filecheck %s // RUN: ./ArrayInputsVectorForwardMode.out | %filecheck_exec %s -// XFAIL: asserts - #include "clad/Differentiator/Differentiator.h" double multiply(const double *arr) { diff --git a/test/ForwardMode/VectorMode.C b/test/ForwardMode/VectorMode.C index 544b98fad..4978eff71 100644 --- a/test/ForwardMode/VectorMode.C +++ b/test/ForwardMode/VectorMode.C @@ -1,8 +1,6 @@ // RUN: %cladclang %s -I%S/../../include -oVectorMode.out 2>&1 | %filecheck %s // RUN: ./VectorMode.out | %filecheck_exec %s -// XFAIL: asserts - #include "clad/Differentiator/Differentiator.h" double f1(double x, double y) { diff --git a/test/ForwardMode/VectorModeInterface.C b/test/ForwardMode/VectorModeInterface.C index 923756db7..7163073ab 100644 --- a/test/ForwardMode/VectorModeInterface.C +++ b/test/ForwardMode/VectorModeInterface.C @@ -1,7 +1,5 @@ // RUN: %cladclang %s -I%S/../../include -fsyntax-only -Xclang -verify 2>&1 | %filecheck %s -// XFAIL: asserts - #include "clad/Differentiator/Differentiator.h" double f1(double x, double y) {