From 225cf469caa8340a4f4de5515d095216924f7a11 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Wed, 18 Jan 2023 20:36:37 -0500 Subject: [PATCH] Document an internal method to make it easier for the next editor While working on #251 I had to understand what this code did, I include the method javadoc in the hope it saves the next person who touches this code some time. --- .../ui/editors/AbstractDebugTextHover.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/editors/AbstractDebugTextHover.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/editors/AbstractDebugTextHover.java index bcf2e526168..8f13ce25b8f 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/editors/AbstractDebugTextHover.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/editors/AbstractDebugTextHover.java @@ -294,6 +294,30 @@ public abstract class AbstractDebugTextHover implements ICEditorTextHover, IText return Status.OK_STATUS; } + /** + * Attempt to locate extent of the expression that name is part of. + * + * If name is a field or array reference, then try to find the + * parent expression that contains the field. + * + * For example, if name is f and f is a field of a structure, try + * to get the location of the variable containing the field. + * + * Given: + *
+			 * struct s { int f1234; };
+			 * #define macro(a) a
+			 * struct s myvar;
+			 * macro(myvar.f1234);
+			 * 
+ * + * if the name is f1234 from the last line, try to get the location + * corresponding to myvar.f1234 + * + * @param name the name to find extent for + * @param pos out parameter for the the found position, or untouched + * if no new information is available. + */ private void computeMacroArgumentExtent(IASTName name, Position pos) { IASTImageLocation imageLoc = name.getImageLocation(); if (imageLoc == null) {