File tree Expand file tree Collapse file tree 3 files changed +40
-2
lines changed
cpp/ql/src/semmle/code/cpp Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * Provides classes for working with name qualifiers such as the `N::` in
3+ * `N::f()`.
4+ */
5+
16import cpp
27
38/**
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides classes for modelling namespaces, `using` directives and `using` declarations.
3+ */
4+
15import semmle.code.cpp.Element
26import semmle.code.cpp.Type
37import semmle.code.cpp.metrics.MetricNamespace
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides a class for reasoning about nested field accesses, for example
3+ * the access `myLine.start.x`.
4+ */
5+
16import cpp
27
38/**
@@ -25,7 +30,7 @@ private Expr getUltimateQualifier(FieldAccess fa) {
2530}
2631
2732/**
28- * Accesses to nested fields .
33+ * A nested field access, for example the access `myLine.start.x` .
2934 */
3035class NestedFieldAccess extends FieldAccess {
3136 Expr ultimateQualifier ;
@@ -35,6 +40,30 @@ class NestedFieldAccess extends FieldAccess {
3540 getTarget ( ) = getANestedField ( ultimateQualifier .getType ( ) .stripType ( ) )
3641 }
3742
38- /** Gets the ultimate qualifier of this nested field access. */
43+ /**
44+ * Gets the outermost qualifier of this nested field access. In the
45+ * following example, the access to `myLine.start.x` has outermost qualifier
46+ * `myLine`:
47+ * ```
48+ * struct Point
49+ * {
50+ * float x, y;
51+ * };
52+ *
53+ * struct Line
54+ * {
55+ * Point start, end;
56+ * };
57+ *
58+ * void init()
59+ * {
60+ * Line myLine;
61+ *
62+ * myLine.start.x = 0.0f;
63+ *
64+ * // ...
65+ * }
66+ * ```
67+ */
3968 Expr getUltimateQualifier ( ) { result = ultimateQualifier }
4069}
You can’t perform that action at this time.
0 commit comments