From 0f75575aa5b0b15204b1edce2084b6f0dcc1d7c8 Mon Sep 17 00:00:00 2001 From: "petro.zarytskyi" Date: Tue, 31 Oct 2023 18:54:54 +0200 Subject: [PATCH] Update comments in TBRAnalyzer.h. --- include/clad/Differentiator/TBRAnalyzer.h | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/include/clad/Differentiator/TBRAnalyzer.h b/include/clad/Differentiator/TBRAnalyzer.h index 45e2a65d6..481782856 100644 --- a/include/clad/Differentiator/TBRAnalyzer.h +++ b/include/clad/Differentiator/TBRAnalyzer.h @@ -83,25 +83,14 @@ class TBRAnalyzer : public clang::ConstStmtVisitor { /// Stores all the necessary information about one variable. Fundamental type /// variables need only one bool. An object/array needs a separate VarData for - /// every its field/element. Reference type variables have their own type for - /// convenience reasons and just point to the corresponding VarData. - /// UNDEFINED is used whenever the type of a node cannot be determined. + /// each field/element. Reference type variables store the clang::Expr* they + /// refer to. UNDEFINED is used whenever the type of a node cannot be determined. /// FIXME: Pointers to objects are considered OBJ_TYPE for simplicity. This /// approach might cause problems when the support for pointers is added. - /// FIXME: Only References to concrete variables are supported. Using - /// 'double& x = (cond ? a : b);' or 'double& x = arr[n*k]' (non-const index) - /// will lead to unpredictable behavior. - - /// FIXME: Different array elements are considered different variables - /// which makes the analysis way more complicated (both in terms of - /// readability and performance) when non-constant indices are used. Moreover, - /// in such cases we start assuming 'arr[k]' could be any element of arr. - /// The only scenario where analysing elements separately would make sense is - /// when an element with the same constant index is changed multiple times in - /// a row, which seems uncommon. It's worth considering analysing arrays as - /// whole structures instead (just one VarData for the whole array). + /// FIXME: Add support for references to call expression results. + /// 'double& x = f(b);' is not supported. struct VarData; using ObjMap = std::unordered_map;