Skip to content

Commit

Permalink
Update comments in TBRAnalyzer.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
PetroZarytskyi committed Oct 31, 2023
1 parent 28b8532 commit 4ac4d48
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions include/clad/Differentiator/TBRAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,14 @@ class TBRAnalyzer : public clang::ConstStmtVisitor<TBRAnalyzer> {

/// 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<const clang::FieldDecl*, VarData>;
Expand Down

0 comments on commit 4ac4d48

Please sign in to comment.