bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20629: 25.0.50; Regression: TAGS broken, can't find anything in C++


From: Eli Zaretskii
Subject: bug#20629: 25.0.50; Regression: TAGS broken, can't find anything in C++ files.
Date: Sat, 23 May 2015 17:46:18 +0300

> Date: Sat, 23 May 2015 16:50:11 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
> 
> We should try to fix bugs without re-introducing previously solved
> ones.

Does the patch below give good results in real-life C++ usage?

Please also consider whether this change could cause trouble in other
C++ use cases.  (I've ran the modified version on the etags test
suite, and didn't spot any problems in the differences with the
previous results, but I don't consider myself an expert on C++
syntax.)

Thanks.

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 28729da..cb96f06 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -3681,7 +3681,29 @@ enum,            0,                      st_C_enum
          switch (fvdef)
            {
            case flistseen:
-             make_C_tag (true);    /* a function */
+             if ((c_ext & C_PLPL) != 0)
+               {
+                 /* Tag C++ member function names, excluding the class and
+                    namespace instances, if any.  */
+                 char *colon_colon = strstr (token_name.buffer, "::");
+                 char *colon_colon2 =
+                   colon_colon
+                   ? strstr (colon_colon + 2, "::")
+                   : NULL;
+
+                 if (colon_colon2 != NULL)
+                   colon_colon = colon_colon2;
+
+                 if (colon_colon != NULL)
+                   {
+                     memmove (token_name.buffer, colon_colon + 2,
+                              strlen (colon_colon + 2) + 1);
+                     token_name.len = strlen (token_name.buffer);
+                   }
+                 make_C_tag (true); /* a member function */
+               }
+             else
+               make_C_tag (true);    /* a function */
              /* FALLTHRU */
            case fignore:
              fvdef = fvnone;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]