diff options
| author | David Engster | 2013-12-12 23:09:15 +0100 |
|---|---|---|
| committer | David Engster | 2013-12-12 23:09:15 +0100 |
| commit | 2cc82b9fbc6e67878e89d7006cc69ffb5227daa1 (patch) | |
| tree | 89215b4bb7a781a62c99a49f0eb1a8a093ce1ed3 | |
| parent | 163e99358a71463d72c9339b4ae7b2795dd7290b (diff) | |
| parent | b0fe992f3657cf3c852c00d662783354fdab343d (diff) | |
| download | emacs-2cc82b9fbc6e67878e89d7006cc69ffb5227daa1.tar.gz emacs-2cc82b9fbc6e67878e89d7006cc69ffb5227daa1.zip | |
Merge from CEDET upstream.
| -rw-r--r-- | admin/ChangeLog | 15 | ||||
| -rw-r--r-- | admin/grammars/c.by | 23 | ||||
| -rw-r--r-- | lisp/cedet/ChangeLog | 125 | ||||
| -rw-r--r-- | lisp/cedet/ede/generic.el | 1 | ||||
| -rw-r--r-- | lisp/cedet/ede/linux.el | 159 | ||||
| -rw-r--r-- | lisp/cedet/semantic/analyze.el | 15 | ||||
| -rw-r--r-- | lisp/cedet/semantic/analyze/refs.el | 6 | ||||
| -rw-r--r-- | lisp/cedet/semantic/bovine/c.el | 230 | ||||
| -rw-r--r-- | lisp/cedet/semantic/bovine/gcc.el | 3 | ||||
| -rw-r--r-- | lisp/cedet/semantic/ctxt.el | 3 | ||||
| -rw-r--r-- | lisp/cedet/semantic/db-mode.el | 4 | ||||
| -rw-r--r-- | lisp/cedet/semantic/db.el | 5 | ||||
| -rw-r--r-- | lisp/cedet/semantic/decorate/include.el | 7 | ||||
| -rw-r--r-- | lisp/cedet/semantic/decorate/mode.el | 8 | ||||
| -rw-r--r-- | lisp/cedet/semantic/format.el | 10 | ||||
| -rw-r--r-- | lisp/cedet/semantic/lex-spp.el | 154 | ||||
| -rw-r--r-- | lisp/cedet/semantic/scope.el | 50 |
17 files changed, 650 insertions, 168 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index e31c7251ffb..f49061e35df 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2013-12-12 David Engster <deng@randomsample.de> | ||
| 2 | |||
| 3 | * grammars/c.by (expr-binop): Add MOD. | ||
| 4 | (variablearg): Add 'opt-assign'. | ||
| 5 | (variablearg, varnamelist): Add default values so that it can be | ||
| 6 | later expanded into the tag. | ||
| 7 | (opt-stuff-after-symbol): Rename to 'brackets-after-symbol' and | ||
| 8 | remove empty match. | ||
| 9 | (multi-stage-dereference): Adapt to above rename. | ||
| 10 | (unaryexpression): Use 'symbol' instead of 'namespace-symbol', | ||
| 11 | since the latter also leads to an empty match at the end which | ||
| 12 | would make this too greedy. | ||
| 13 | (variablearg-opt-name): Support parsing of function pointers | ||
| 14 | inside an argument list. | ||
| 15 | |||
| 1 | 2013-12-12 Glenn Morris <rgm@gnu.org> | 16 | 2013-12-12 Glenn Morris <rgm@gnu.org> |
| 2 | 17 | ||
| 3 | * update_autogen (info_dir): | 18 | * update_autogen (info_dir): |
diff --git a/admin/grammars/c.by b/admin/grammars/c.by index 55ec0fbaf01..7aafe7b90f3 100644 --- a/admin/grammars/c.by +++ b/admin/grammars/c.by | |||
| @@ -901,8 +901,8 @@ varname | |||
| 901 | ;; I should store more in this def, but leave it simple for now. | 901 | ;; I should store more in this def, but leave it simple for now. |
| 902 | ;; Klaus Berndl: const and volatile can be written after the type! | 902 | ;; Klaus Berndl: const and volatile can be written after the type! |
| 903 | variablearg | 903 | variablearg |
| 904 | : declmods typeformbase cv-declmods opt-ref variablearg-opt-name | 904 | : declmods typeformbase cv-declmods opt-ref variablearg-opt-name opt-assign |
| 905 | ( VARIABLE-TAG (list $5) $2 nil | 905 | ( VARIABLE-TAG (list (append $5 ,$6)) $2 nil |
| 906 | :constant-flag (if (member "const" (append $1 $3)) t nil) | 906 | :constant-flag (if (member "const" (append $1 $3)) t nil) |
| 907 | :typemodifiers (delete "const" (append $1 $3)) | 907 | :typemodifiers (delete "const" (append $1 $3)) |
| 908 | :reference (car ,$4) | 908 | :reference (car ,$4) |
| @@ -912,6 +912,8 @@ variablearg | |||
| 912 | variablearg-opt-name | 912 | variablearg-opt-name |
| 913 | : varname | 913 | : varname |
| 914 | ( ,$1 ) | 914 | ( ,$1 ) |
| 915 | | semantic-list arg-list | ||
| 916 | ( (car ( EXPAND $1 function-pointer )) $2) | ||
| 915 | ;; Klaus Berndl: This allows variableargs without a arg-name being | 917 | ;; Klaus Berndl: This allows variableargs without a arg-name being |
| 916 | ;; parsed correct even if there several pointers (*) | 918 | ;; parsed correct even if there several pointers (*) |
| 917 | | opt-stars | 919 | | opt-stars |
| @@ -926,9 +928,9 @@ varname-opt-initializer | |||
| 926 | 928 | ||
| 927 | varnamelist | 929 | varnamelist |
| 928 | : opt-ref varname varname-opt-initializer COMA varnamelist | 930 | : opt-ref varname varname-opt-initializer COMA varnamelist |
| 929 | ( ,(cons $2 $5) ) | 931 | ( ,(cons (append $2 $3) $5) ) |
| 930 | | opt-ref varname varname-opt-initializer | 932 | | opt-ref varname varname-opt-initializer |
| 931 | ( $2 ) | 933 | ( (append $2 $3) ) |
| 932 | ; | 934 | ; |
| 933 | 935 | ||
| 934 | ;; Klaus Berndl: Is necessary to parse stuff like | 936 | ;; Klaus Berndl: Is necessary to parse stuff like |
| @@ -1152,16 +1154,15 @@ type-cast-list | |||
| 1152 | : open-paren typeformbase close-paren | 1154 | : open-paren typeformbase close-paren |
| 1153 | ; | 1155 | ; |
| 1154 | 1156 | ||
| 1155 | opt-stuff-after-symbol | 1157 | brackets-after-symbol |
| 1156 | : PAREN_BLCK | 1158 | : PAREN_BLCK |
| 1157 | | BRACK_BLCK | 1159 | | BRACK_BLCK |
| 1158 | | ;; EMPTY | ||
| 1159 | ; | 1160 | ; |
| 1160 | 1161 | ||
| 1161 | multi-stage-dereference | 1162 | multi-stage-dereference |
| 1162 | : namespace-symbol opt-stuff-after-symbol PERIOD multi-stage-dereference ;; method call | 1163 | : namespace-symbol brackets-after-symbol PERIOD multi-stage-dereference ;; method call |
| 1163 | | namespace-symbol opt-stuff-after-symbol MINUS GREATER multi-stage-dereference ;;method call | 1164 | | namespace-symbol brackets-after-symbol MINUS GREATER multi-stage-dereference ;;method call |
| 1164 | | namespace-symbol opt-stuff-after-symbol | 1165 | | namespace-symbol brackets-after-symbol |
| 1165 | ; | 1166 | ; |
| 1166 | 1167 | ||
| 1167 | string-seq | 1168 | string-seq |
| @@ -1187,6 +1188,7 @@ expr-binop | |||
| 1187 | | AMPERSAND | 1188 | | AMPERSAND |
| 1188 | | OR OR | 1189 | | OR OR |
| 1189 | | OR | 1190 | | OR |
| 1191 | | MOD | ||
| 1190 | ;; There are more. | 1192 | ;; There are more. |
| 1191 | ; | 1193 | ; |
| 1192 | 1194 | ||
| @@ -1204,8 +1206,7 @@ unaryexpression | |||
| 1204 | | multi-stage-dereference | 1206 | | multi-stage-dereference |
| 1205 | | NEW multi-stage-dereference | 1207 | | NEW multi-stage-dereference |
| 1206 | | NEW builtintype-types semantic-list | 1208 | | NEW builtintype-types semantic-list |
| 1207 | ;; Klaus Berndl: symbol -> namespace-symbol! | 1209 | | symbol |
| 1208 | | namespace-symbol | ||
| 1209 | ;; Klaus Berndl: C/C++ allows sequences of strings which are | 1210 | ;; Klaus Berndl: C/C++ allows sequences of strings which are |
| 1210 | ;; concatenated by the precompiler to one string | 1211 | ;; concatenated by the precompiler to one string |
| 1211 | | string-seq | 1212 | | string-seq |
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index 1a4a6580007..5b80e79a03e 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog | |||
| @@ -1,3 +1,128 @@ | |||
| 1 | 2013-12-12 David Engster <deng@randomsample.de> | ||
| 2 | |||
| 3 | * semantic/analyze.el | ||
| 4 | (semantic-analyze-find-tag-sequence-default): Always add scope to | ||
| 5 | the local miniscope for each type. Otherwise, structure tags are | ||
| 6 | not analyzed correctly. Also, always search the extended | ||
| 7 | miniscope even when not dealing with types. | ||
| 8 | |||
| 9 | * semantic/ctxt.el (semantic-get-local-variables-default): Also | ||
| 10 | try to parse local variables for buffers which are currently | ||
| 11 | marked as unparseable. Otherwise, it is often impossible to | ||
| 12 | complete local variables. | ||
| 13 | |||
| 14 | * semantic/scope.el (semantic-analyze-scoped-types-default): If we | ||
| 15 | cannot find a type in the typecache, also look into the the types | ||
| 16 | we already found. This is necessary since in C++, a 'using | ||
| 17 | namespace' can be dependend on a previous one. | ||
| 18 | (semantic-completable-tags-from-type): When creating the list of | ||
| 19 | completable types, pull in types which are referenced through | ||
| 20 | 'using' statements, and also preserve their filenames. | ||
| 21 | |||
| 22 | * semanitc/bovine/c.el (semantic/analyze/refs): Require. | ||
| 23 | (semantic-analyze-tag-references): New override. Mainly copied | ||
| 24 | from the default implementation, but if nothing could be found (or | ||
| 25 | just the tag itself), drop all namespaces from the scope and | ||
| 26 | search again. This is necessary for implementations which are | ||
| 27 | defined outside of the namespace and only pull those in through | ||
| 28 | 'using' statements. | ||
| 29 | (semantic-ctxt-scoped-types): Go through all tags around point and | ||
| 30 | search them for using statements. In the case for using | ||
| 31 | statements outside of function scope, append them in the correct | ||
| 32 | order instead of using 'cons'. This is important since using | ||
| 33 | statements may depend on previous ones. | ||
| 34 | (semantic-expand-c-tag-namelist): Do not try to parse struct | ||
| 35 | definitions as default values. The grammar parser seems to return | ||
| 36 | the point positions slightly differently (as a cons instead of a | ||
| 37 | list). Also, set parent for typedefs to 'nil'. It does not | ||
| 38 | really make sense to set a parent class for typedefs, and it can | ||
| 39 | also lead to endless loops when calculating scope. | ||
| 40 | (semantic-c-reconstitute-token): Change handling of function | ||
| 41 | pointers; instead of seeing them as variables, handle them as | ||
| 42 | functions with a 'function-pointer' attribute. Also, correctly | ||
| 43 | deal with function pointers as function arguments. | ||
| 44 | (semantic-c-reconstitute-function-arglist): New function to parse | ||
| 45 | function pointers inside an argument list. | ||
| 46 | (semantic-format-tag-name): Use 'function-pointer' attribute | ||
| 47 | instead of the old 'functionpointer-flag'. | ||
| 48 | (semantic-cpp-lexer): Use new `semantic-lex-spp-paren-or-list'. | ||
| 49 | |||
| 50 | * semantic/bovine/gcc.el (semantic-gcc-setup): Add 'features.h' to | ||
| 51 | the list of files whose preprocessor symbols are included. This | ||
| 52 | pulls in things like __USE_POSIX and similar. | ||
| 53 | |||
| 54 | * semantic/format.el (semantic-format-tag-prototype-default): | ||
| 55 | Display default values if available. | ||
| 56 | |||
| 57 | * semantic/analyze/refs.el (semantic-analyze-refs-impl) | ||
| 58 | (semantic-analyze-refs-proto): Add 'default-value' as ignorable in | ||
| 59 | call to `semantic-tag-similar-p'. | ||
| 60 | |||
| 61 | * semantic/db-mode.el (semanticdb-semantic-init-hook-fcn): Always | ||
| 62 | set buffer for `semanticdb-current-table'. | ||
| 63 | |||
| 64 | * semantic/db.el (semanticdb-table::semanticdb-refresh-table): The | ||
| 65 | previous change turned up a bug in this method. Since the current | ||
| 66 | table now correctly has a buffer set, the first clause in the | ||
| 67 | `cond' would be taken, but there was a `save-excursion' missing. | ||
| 68 | |||
| 69 | * semantic/lex-spp.el (semantic-c-end-of-macro): Declare. | ||
| 70 | (semantic-lex-spp-token-macro-to-macro-stream): Deal with macros | ||
| 71 | which open/close a scope. For this, leave an overlay if we | ||
| 72 | encounter a single open paren and return a semantic-list in the | ||
| 73 | lexer. When this list gets expanded, retrieve the old position | ||
| 74 | from the overlay. See the comments in the function for further | ||
| 75 | details. | ||
| 76 | (semantic-lex-spp-find-closing-macro): New function to find the | ||
| 77 | next macro which closes scope (i.e., has a closing paren). | ||
| 78 | (semantic-lex-spp-replace-or-symbol-or-keyword): Go to end of | ||
| 79 | closing macro if necessary. | ||
| 80 | (semantic-lex-spp-paren-or-list): New lexer to specially deal with | ||
| 81 | parens in macro definitions. | ||
| 82 | |||
| 83 | * semantic/decorate/mode.el (semantic-decoration-mode): Do not | ||
| 84 | decorate available tags immediately but in an idle timer, since | ||
| 85 | EDE will usually not be activated yet, which will make it | ||
| 86 | impossible to find project includes. | ||
| 87 | |||
| 88 | * semantic/decorate/include.el | ||
| 89 | (semantic-decoration-on-includes-highlight-default): Remove | ||
| 90 | 'unloaded' from throttle when decorating includes, otherwise all | ||
| 91 | would be loaded. Rename 'table' to 'currenttable' to make things | ||
| 92 | clearer. | ||
| 93 | |||
| 94 | * ede/linux.el (cl): Require during compile. | ||
| 95 | |||
| 96 | 2013-12-12 LluÃs Vilanova <xscript@gmx.net> | ||
| 97 | |||
| 98 | * ede/linux.el (project-linux-build-directory-default) | ||
| 99 | (project-linux-architecture-default): Add customizable variables. | ||
| 100 | (ede-linux-project): Add additional slots to track Linux-specific | ||
| 101 | information (out-of-tree build directory and selected | ||
| 102 | architecture). | ||
| 103 | (ede-linux--get-build-directory, ede-linux--get-archs) | ||
| 104 | (ede-linux--detect-architecture, ede-linux--get-architecture) | ||
| 105 | (ede-linux--include-path): Added function to detect Linux-specific | ||
| 106 | information. | ||
| 107 | (ede-linux-load): Set new Linux-specific information when creating | ||
| 108 | a project. | ||
| 109 | (ede-expand-filename-impl): Use new and more accurate include | ||
| 110 | information. | ||
| 111 | |||
| 112 | 2013-12-12 Eric Ludlam <zappo@gnu.org> | ||
| 113 | |||
| 114 | * semantic/scope.el (semantic-calculate-scope): Return a clone of | ||
| 115 | the scopecache, so that everyone is working with its own (shallow) | ||
| 116 | copy. Otherwise, if one caller is resetting the scope, it would | ||
| 117 | be reset for all others working with the scope cache as well. | ||
| 118 | |||
| 119 | 2013-12-12 Alex Ott <alexott@gmail.com> | ||
| 120 | |||
| 121 | * ede/generic.el (project-run-target): Remove incorrect require. | ||
| 122 | |||
| 123 | * semantic/format.el (semantic-format-tag-prototype-default): Use | ||
| 124 | concat only for strings. | ||
| 125 | |||
| 1 | 2013-11-30 Glenn Morris <rgm@gnu.org> | 126 | 2013-11-30 Glenn Morris <rgm@gnu.org> |
| 2 | 127 | ||
| 3 | Stop keeping (most) generated cedet grammar files in the repository. | 128 | Stop keeping (most) generated cedet grammar files in the repository. |
diff --git a/lisp/cedet/ede/generic.el b/lisp/cedet/ede/generic.el index fedf0ffc7c6..1804107bb79 100644 --- a/lisp/cedet/ede/generic.el +++ b/lisp/cedet/ede/generic.el | |||
| @@ -360,7 +360,6 @@ Argument COMMAND is the command to use for compiling the target." | |||
| 360 | 360 | ||
| 361 | (defmethod project-run-target ((target ede-generic-target)) | 361 | (defmethod project-run-target ((target ede-generic-target)) |
| 362 | "Run the current project derived from TARGET." | 362 | "Run the current project derived from TARGET." |
| 363 | (require 'ede-shell) | ||
| 364 | (let* ((proj (ede-target-parent target)) | 363 | (let* ((proj (ede-target-parent target)) |
| 365 | (config (ede-generic-get-configuration proj)) | 364 | (config (ede-generic-get-configuration proj)) |
| 366 | (run (concat "./" (oref config :run-command))) | 365 | (run (concat "./" (oref config :run-command))) |
diff --git a/lisp/cedet/ede/linux.el b/lisp/cedet/ede/linux.el index 728d27e4460..8a2b7c6686d 100644 --- a/lisp/cedet/ede/linux.el +++ b/lisp/cedet/ede/linux.el | |||
| @@ -32,6 +32,8 @@ | |||
| 32 | ;; * Add texinfo lookup options. | 32 | ;; * Add texinfo lookup options. |
| 33 | ;; * Add website | 33 | ;; * Add website |
| 34 | 34 | ||
| 35 | (eval-when-compile (require 'cl)) | ||
| 36 | |||
| 35 | (require 'ede) | 37 | (require 'ede) |
| 36 | (require 'ede/make) | 38 | (require 'ede/make) |
| 37 | 39 | ||
| @@ -46,6 +48,19 @@ | |||
| 46 | :group 'ede | 48 | :group 'ede |
| 47 | :version "24.3") | 49 | :version "24.3") |
| 48 | 50 | ||
| 51 | (defcustom project-linux-build-directory-default 'ask | ||
| 52 | "Build directory." | ||
| 53 | :group 'project-linux | ||
| 54 | :type '(choice (const :tag "Same as source directory" 'same) | ||
| 55 | (const :tag "Ask the user" 'ask))) | ||
| 56 | |||
| 57 | (defcustom project-linux-architecture-default 'ask | ||
| 58 | "Target architecture to assume when not auto-detected." | ||
| 59 | :group 'project-linux | ||
| 60 | :type '(choice (string :tag "Architecture name") | ||
| 61 | (const :tag "Ask the user" 'ask))) | ||
| 62 | |||
| 63 | |||
| 49 | (defcustom project-linux-compile-target-command (concat ede-make-command " -k -C %s SUBDIRS=%s") | 64 | (defcustom project-linux-compile-target-command (concat ede-make-command " -k -C %s SUBDIRS=%s") |
| 50 | "*Default command used to compile a target." | 65 | "*Default command used to compile a target." |
| 51 | :group 'project-linux | 66 | :group 'project-linux |
| @@ -109,10 +124,100 @@ DIR is the directory to search from." | |||
| 109 | 124 | ||
| 110 | (defclass ede-linux-project (ede-project eieio-instance-tracker) | 125 | (defclass ede-linux-project (ede-project eieio-instance-tracker) |
| 111 | ((tracking-symbol :initform 'ede-linux-project-list) | 126 | ((tracking-symbol :initform 'ede-linux-project-list) |
| 112 | ) | 127 | (build-directory :initarg :build-directory |
| 128 | :type string | ||
| 129 | :documentation "Build directory.") | ||
| 130 | (architecture :initarg :architecture | ||
| 131 | :type string | ||
| 132 | :documentation "Target architecture.") | ||
| 133 | (include-path :initarg :include-path | ||
| 134 | :type list | ||
| 135 | :documentation "Include directories. | ||
| 136 | Contains both common and target architecture-specific directories.")) | ||
| 113 | "Project Type for the Linux source code." | 137 | "Project Type for the Linux source code." |
| 114 | :method-invocation-order :depth-first) | 138 | :method-invocation-order :depth-first) |
| 115 | 139 | ||
| 140 | |||
| 141 | (defun ede-linux--get-build-directory (dir) | ||
| 142 | "Detect build directory for sources in DIR. | ||
| 143 | If DIR has not been used as a build directory, fall back to | ||
| 144 | `project-linux-build-directory-default'." | ||
| 145 | (or | ||
| 146 | ;; detected build on source directory | ||
| 147 | (and (file-exists-p (expand-file-name ".config" dir)) dir) | ||
| 148 | ;; use configuration | ||
| 149 | (case project-linux-build-directory-default | ||
| 150 | (same dir) | ||
| 151 | (ask (read-directory-name "Select Linux' build directory: " dir))))) | ||
| 152 | |||
| 153 | |||
| 154 | (defun ede-linux--get-archs (dir) | ||
| 155 | "Returns a list of architecture names found in DIR." | ||
| 156 | (let ((archs-dir (expand-file-name "arch" dir)) | ||
| 157 | archs) | ||
| 158 | (when (file-directory-p archs-dir) | ||
| 159 | (mapc (lambda (elem) | ||
| 160 | (when (and | ||
| 161 | (not (string= elem ".")) | ||
| 162 | (not (string= elem "..")) | ||
| 163 | (not (string= elem "x86_64")) ; has no separate sources | ||
| 164 | (file-directory-p | ||
| 165 | (expand-file-name elem archs-dir))) | ||
| 166 | (add-to-list 'archs elem t))) | ||
| 167 | (directory-files archs-dir))) | ||
| 168 | archs)) | ||
| 169 | |||
| 170 | |||
| 171 | (defun ede-linux--detect-architecture (dir) | ||
| 172 | "Try to auto-detect the architecture as configured in DIR. | ||
| 173 | DIR is Linux' build directory. If it cannot be auto-detected, | ||
| 174 | returns `project-linux-architecture-default'." | ||
| 175 | (let ((archs-dir (expand-file-name "arch" dir)) | ||
| 176 | (archs (ede-linux--get-archs dir)) | ||
| 177 | arch found) | ||
| 178 | (or (and | ||
| 179 | archs | ||
| 180 | ;; Look for /arch/<arch>/include/generated | ||
| 181 | (progn | ||
| 182 | (while (and archs (not found)) | ||
| 183 | (setq arch (car archs)) | ||
| 184 | (when (file-directory-p | ||
| 185 | (expand-file-name (concat arch "/include/generated") | ||
| 186 | archs-dir)) | ||
| 187 | (setq found arch)) | ||
| 188 | (setq archs (cdr archs))) | ||
| 189 | found)) | ||
| 190 | project-linux-architecture-default))) | ||
| 191 | |||
| 192 | (defun ede-linux--get-architecture (dir bdir) | ||
| 193 | "Try to auto-detect the architecture as configured in BDIR. | ||
| 194 | Uses `ede-linux--detect-architecture' for the auto-detection. If | ||
| 195 | the result is `ask', let the user choose from architectures found | ||
| 196 | in DIR." | ||
| 197 | (let ((arch (ede-linux--detect-architecture bdir))) | ||
| 198 | (case arch | ||
| 199 | (ask | ||
| 200 | (completing-read "Select target architecture: " | ||
| 201 | (ede-linux--get-archs dir))) | ||
| 202 | (t arch)))) | ||
| 203 | |||
| 204 | |||
| 205 | (defun ede-linux--include-path (dir bdir arch) | ||
| 206 | "Returns a list with include directories. | ||
| 207 | Returned directories might not exist, since they are not created | ||
| 208 | until Linux is built for the first time." | ||
| 209 | (map 'list | ||
| 210 | (lambda (elem) (format (concat (car elem) "/" (cdr elem)) arch)) | ||
| 211 | ;; XXX: taken from the output of "make V=1" | ||
| 212 | (list (cons dir "arch/%s/include") | ||
| 213 | (cons bdir "arch/%s/include/generated") | ||
| 214 | (cons dir "include") | ||
| 215 | (cons bdir "include") | ||
| 216 | (cons dir "arch/%s/include/uapi") | ||
| 217 | (cons bdir "arch/%s/include/generated/uapi") | ||
| 218 | (cons dir "include/uapi") | ||
| 219 | (cons bdir "include/generated/uapi")))) | ||
| 220 | |||
| 116 | ;;;###autoload | 221 | ;;;###autoload |
| 117 | (defun ede-linux-load (dir &optional rootproj) | 222 | (defun ede-linux-load (dir &optional rootproj) |
| 118 | "Return an Linux Project object if there is a match. | 223 | "Return an Linux Project object if there is a match. |
| @@ -121,15 +226,20 @@ Argument DIR is the directory it is created for. | |||
| 121 | ROOTPROJ is nil, since there is only one project." | 226 | ROOTPROJ is nil, since there is only one project." |
| 122 | (or (ede-linux-file-existing dir) | 227 | (or (ede-linux-file-existing dir) |
| 123 | ;; Doesn't already exist, so let's make one. | 228 | ;; Doesn't already exist, so let's make one. |
| 124 | (let ((proj (ede-linux-project | 229 | (let* ((bdir (ede-linux--get-build-directory dir)) |
| 125 | "Linux" | 230 | (arch (ede-linux--get-architecture dir bdir)) |
| 126 | :name "Linux" | 231 | (include-path (ede-linux--include-path dir bdir arch)) |
| 127 | :version (ede-linux-version dir) | 232 | (proj (ede-linux-project |
| 128 | :directory (file-name-as-directory dir) | 233 | "Linux" |
| 129 | :file (expand-file-name "scripts/ver_linux" | 234 | :name "Linux" |
| 130 | dir)))) | 235 | :version (ede-linux-version dir) |
| 131 | (ede-add-project-to-global-list proj)) | 236 | :directory (file-name-as-directory dir) |
| 132 | )) | 237 | :file (expand-file-name "scripts/ver_linux" |
| 238 | dir) | ||
| 239 | :build-directory bdir | ||
| 240 | :architecture arch | ||
| 241 | :include-path include-path))) | ||
| 242 | (ede-add-project-to-global-list proj)))) | ||
| 133 | 243 | ||
| 134 | ;;;###autoload | 244 | ;;;###autoload |
| 135 | (ede-add-project-autoload | 245 | (ede-add-project-autoload |
| @@ -245,18 +355,23 @@ All files need the macros from lisp.h!" | |||
| 245 | "Within this project PROJ, find the file NAME. | 355 | "Within this project PROJ, find the file NAME. |
| 246 | Knows about how the Linux source tree is organized." | 356 | Knows about how the Linux source tree is organized." |
| 247 | (let* ((ext (file-name-extension name)) | 357 | (let* ((ext (file-name-extension name)) |
| 248 | (root (ede-project-root proj)) | 358 | (root (ede-project-root proj)) |
| 249 | (dir (ede-project-root-directory root)) | 359 | (dir (ede-project-root-directory root)) |
| 250 | (F (cond | 360 | (bdir (oref proj build-directory)) |
| 251 | ((not ext) nil) | 361 | (F (cond |
| 252 | ((string-match "h" ext) | 362 | ((not ext) nil) |
| 253 | (or (ede-linux-file-exists-name name dir "") | 363 | ((string-match "h" ext) |
| 254 | (ede-linux-file-exists-name name dir "include")) | 364 | (let ((dirs (oref proj include-path)) |
| 255 | ) | 365 | found) |
| 256 | ((string-match "txt" ext) | 366 | (while (and dirs (not found)) |
| 257 | (ede-linux-file-exists-name name dir "Documentation")) | 367 | (setq found |
| 258 | (t nil))) | 368 | (or (ede-linux-file-exists-name name bdir (car dirs)) |
| 259 | ) | 369 | (ede-linux-file-exists-name name dir (car dirs)))) |
| 370 | (setq dirs (cdr dirs))) | ||
| 371 | found)) | ||
| 372 | ((string-match "txt" ext) | ||
| 373 | (ede-linux-file-exists-name name dir "Documentation")) | ||
| 374 | (t nil)))) | ||
| 260 | (or F (call-next-method)))) | 375 | (or F (call-next-method)))) |
| 261 | 376 | ||
| 262 | (defmethod project-compile-project ((proj ede-linux-project) | 377 | (defmethod project-compile-project ((proj ede-linux-project) |
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el index 000193d4a55..07bf1c7f621 100644 --- a/lisp/cedet/semantic/analyze.el +++ b/lisp/cedet/semantic/analyze.el | |||
| @@ -295,18 +295,10 @@ Optional argument THROWSYM specifies a symbol the throw on non-recoverable error | |||
| 295 | ;; In some cases the found TMP is a type, | 295 | ;; In some cases the found TMP is a type, |
| 296 | ;; and we can use it directly. | 296 | ;; and we can use it directly. |
| 297 | (cond ((semantic-tag-of-class-p tmp 'type) | 297 | (cond ((semantic-tag-of-class-p tmp 'type) |
| 298 | ;; update the miniscope when we need to analyze types directly. | ||
| 299 | (when miniscope | ||
| 300 | (let ((rawscope | ||
| 301 | (apply 'append | ||
| 302 | (mapcar 'semantic-tag-type-members | ||
| 303 | tagtype)))) | ||
| 304 | (oset miniscope fullscope rawscope))) | ||
| 305 | ;; Now analyze the type to remove metatypes. | ||
| 306 | (or (semantic-analyze-type tmp miniscope) | 298 | (or (semantic-analyze-type tmp miniscope) |
| 307 | tmp)) | 299 | tmp)) |
| 308 | (t | 300 | (t |
| 309 | (semantic-analyze-tag-type tmp scope)))) | 301 | (semantic-analyze-tag-type tmp miniscope)))) |
| 310 | (typefile | 302 | (typefile |
| 311 | (when tmptype | 303 | (when tmptype |
| 312 | (semantic-tag-file-name tmptype))) | 304 | (semantic-tag-file-name tmptype))) |
| @@ -336,6 +328,11 @@ Optional argument THROWSYM specifies a symbol the throw on non-recoverable error | |||
| 336 | (semantic--tag-put-property tmp :filename fname)) | 328 | (semantic--tag-put-property tmp :filename fname)) |
| 337 | (setq tag (cons tmp tag)) | 329 | (setq tag (cons tmp tag)) |
| 338 | (setq tagtype (cons tmptype tagtype)) | 330 | (setq tagtype (cons tmptype tagtype)) |
| 331 | (when miniscope | ||
| 332 | (let ((rawscope | ||
| 333 | (apply 'append | ||
| 334 | (mapcar 'semantic-tag-type-members tagtype)))) | ||
| 335 | (oset miniscope fullscope rawscope))) | ||
| 339 | ) | 336 | ) |
| 340 | (setq s (cdr s))) | 337 | (setq s (cdr s))) |
| 341 | 338 | ||
diff --git a/lisp/cedet/semantic/analyze/refs.el b/lisp/cedet/semantic/analyze/refs.el index 93dd710a67d..b06a8a2c5aa 100644 --- a/lisp/cedet/semantic/analyze/refs.el +++ b/lisp/cedet/semantic/analyze/refs.el | |||
| @@ -118,7 +118,8 @@ Optional argument IN-BUFFER indicates that the returned tag should be in an acti | |||
| 118 | (semantic-tag-similar-p tag aT | 118 | (semantic-tag-similar-p tag aT |
| 119 | :prototype-flag | 119 | :prototype-flag |
| 120 | :parent | 120 | :parent |
| 121 | :typemodifiers)) | 121 | :typemodifiers |
| 122 | :default-value)) | ||
| 122 | (when in-buffer (save-excursion (semantic-go-to-tag aT aDB))) | 123 | (when in-buffer (save-excursion (semantic-go-to-tag aT aDB))) |
| 123 | (push aT impl)))) | 124 | (push aT impl)))) |
| 124 | allhits) | 125 | allhits) |
| @@ -141,7 +142,8 @@ Optional argument IN-BUFFER indicates that the returned tag should be in an acti | |||
| 141 | (semantic-tag-similar-p tag aT | 142 | (semantic-tag-similar-p tag aT |
| 142 | :prototype-flag | 143 | :prototype-flag |
| 143 | :parent | 144 | :parent |
| 144 | :typemodifiers)) | 145 | :typemodifiers |
| 146 | :default-value)) | ||
| 145 | (when in-buffer (save-excursion (semantic-go-to-tag aT aDB))) | 147 | (when in-buffer (save-excursion (semantic-go-to-tag aT aDB))) |
| 146 | (push aT proto)))) | 148 | (push aT proto)))) |
| 147 | allhits) | 149 | allhits) |
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el index 3c991ea8555..f7c6a43b37e 100644 --- a/lisp/cedet/semantic/bovine/c.el +++ b/lisp/cedet/semantic/bovine/c.el | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | (require 'semantic) | 28 | (require 'semantic) |
| 29 | (require 'semantic/analyze) | 29 | (require 'semantic/analyze) |
| 30 | (require 'semantic/analyze/refs) | ||
| 30 | (require 'semantic/bovine) | 31 | (require 'semantic/bovine) |
| 31 | (require 'semantic/bovine/gcc) | 32 | (require 'semantic/bovine/gcc) |
| 32 | (require 'semantic/idle) | 33 | (require 'semantic/idle) |
| @@ -812,7 +813,7 @@ Use semantic-cpp-lexer for parsing text inside a CPP macro." | |||
| 812 | ;; semantic-lex-spp-replace-or-symbol-or-keyword | 813 | ;; semantic-lex-spp-replace-or-symbol-or-keyword |
| 813 | semantic-lex-symbol-or-keyword | 814 | semantic-lex-symbol-or-keyword |
| 814 | semantic-lex-charquote | 815 | semantic-lex-charquote |
| 815 | semantic-lex-paren-or-list | 816 | semantic-lex-spp-paren-or-list |
| 816 | semantic-lex-close-paren | 817 | semantic-lex-close-paren |
| 817 | semantic-lex-ignore-comments | 818 | semantic-lex-ignore-comments |
| 818 | semantic-lex-punctuation | 819 | semantic-lex-punctuation |
| @@ -1118,7 +1119,8 @@ is its own toplevel tag. This function will return (cons A B)." | |||
| 1118 | (semantic-tag-new-variable | 1119 | (semantic-tag-new-variable |
| 1119 | (car cur) ;name | 1120 | (car cur) ;name |
| 1120 | ty ;type | 1121 | ty ;type |
| 1121 | (if default | 1122 | (if (and default |
| 1123 | (listp (cdr default))) | ||
| 1122 | (buffer-substring-no-properties | 1124 | (buffer-substring-no-properties |
| 1123 | (car default) (car (cdr default)))) | 1125 | (car default) (car (cdr default)))) |
| 1124 | :constant-flag (semantic-tag-variable-constant-p tag) | 1126 | :constant-flag (semantic-tag-variable-constant-p tag) |
| @@ -1173,11 +1175,7 @@ is its own toplevel tag. This function will return (cons A B)." | |||
| 1173 | (nth 1 (car names)) ; name | 1175 | (nth 1 (car names)) ; name |
| 1174 | "typedef" | 1176 | "typedef" |
| 1175 | (semantic-tag-type-members tag) | 1177 | (semantic-tag-type-members tag) |
| 1176 | ;; parent is just the name of what | 1178 | nil |
| 1177 | ;; is passed down as a tag. | ||
| 1178 | (list | ||
| 1179 | (semantic-tag-name | ||
| 1180 | (semantic-tag-type-superclasses tag))) | ||
| 1181 | :pointer | 1179 | :pointer |
| 1182 | (let ((stars (car (car (car names))))) | 1180 | (let ((stars (car (car (car names))))) |
| 1183 | (if (= stars 0) nil stars)) | 1181 | (if (= stars 0) nil stars)) |
| @@ -1227,6 +1225,45 @@ or \"struct\".") | |||
| 1227 | name | 1225 | name |
| 1228 | (delete "" ans)))) | 1226 | (delete "" ans)))) |
| 1229 | 1227 | ||
| 1228 | (define-mode-local-override semantic-analyze-tag-references c-mode (tag &optional db) | ||
| 1229 | "Analyze the references for TAG. | ||
| 1230 | Returns a class with information about TAG. | ||
| 1231 | |||
| 1232 | Optional argument DB is a database. It will be used to help | ||
| 1233 | locate TAG. | ||
| 1234 | |||
| 1235 | Use `semantic-analyze-current-tag' to debug this fcn." | ||
| 1236 | (when (not (semantic-tag-p tag)) (signal 'wrong-type-argument (list 'semantic-tag-p tag))) | ||
| 1237 | (let ((allhits nil) | ||
| 1238 | (scope nil) | ||
| 1239 | (refs nil)) | ||
| 1240 | (save-excursion | ||
| 1241 | (semantic-go-to-tag tag db) | ||
| 1242 | (setq scope (semantic-calculate-scope)) | ||
| 1243 | |||
| 1244 | (setq allhits (semantic--analyze-refs-full-lookup tag scope t)) | ||
| 1245 | |||
| 1246 | (when (or (zerop (semanticdb-find-result-length allhits)) | ||
| 1247 | (and (= (semanticdb-find-result-length allhits) 1) | ||
| 1248 | (eq (car (semanticdb-find-result-nth allhits 0)) tag))) | ||
| 1249 | ;; It found nothing or only itself - not good enough. As a | ||
| 1250 | ;; last resort, let's remove all namespaces from the scope and | ||
| 1251 | ;; search again. | ||
| 1252 | (oset scope parents | ||
| 1253 | (let ((parents (oref scope parents)) | ||
| 1254 | newparents) | ||
| 1255 | (dolist (cur parents) | ||
| 1256 | (unless (string= (semantic-tag-type cur) "namespace") | ||
| 1257 | (push cur newparents))) | ||
| 1258 | (reverse newparents))) | ||
| 1259 | (setq allhits (semantic--analyze-refs-full-lookup tag scope t))) | ||
| 1260 | |||
| 1261 | (setq refs (semantic-analyze-references (semantic-tag-name tag) | ||
| 1262 | :tag tag | ||
| 1263 | :tagdb db | ||
| 1264 | :scope scope | ||
| 1265 | :rawsearchdata allhits))))) | ||
| 1266 | |||
| 1230 | (defun semantic-c-reconstitute-token (tokenpart declmods typedecl) | 1267 | (defun semantic-c-reconstitute-token (tokenpart declmods typedecl) |
| 1231 | "Reconstitute a token TOKENPART with DECLMODS and TYPEDECL. | 1268 | "Reconstitute a token TOKENPART with DECLMODS and TYPEDECL. |
| 1232 | This is so we don't have to match the same starting text several times. | 1269 | This is so we don't have to match the same starting text several times. |
| @@ -1258,7 +1295,8 @@ Optional argument STAR and REF indicate the number of * and & in the typedef." | |||
| 1258 | (nth 10 tokenpart) ; initializers | 1295 | (nth 10 tokenpart) ; initializers |
| 1259 | ) | 1296 | ) |
| 1260 | (not (car (nth 3 tokenpart))))) | 1297 | (not (car (nth 3 tokenpart))))) |
| 1261 | (fcnpointer (string-match "^\\*" (car tokenpart))) | 1298 | (fcnpointer (and (> (length (car tokenpart)) 0) |
| 1299 | (= (aref (car tokenpart) 0) ?*))) | ||
| 1262 | (fnname (if fcnpointer | 1300 | (fnname (if fcnpointer |
| 1263 | (substring (car tokenpart) 1) | 1301 | (substring (car tokenpart) 1) |
| 1264 | (car tokenpart))) | 1302 | (car tokenpart))) |
| @@ -1266,70 +1304,80 @@ Optional argument STAR and REF indicate the number of * and & in the typedef." | |||
| 1266 | nil | 1304 | nil |
| 1267 | t)) | 1305 | t)) |
| 1268 | ) | 1306 | ) |
| 1269 | (if fcnpointer | 1307 | ;; The function |
| 1270 | ;; Function pointers are really variables. | 1308 | (semantic-tag-new-function |
| 1271 | (semantic-tag-new-variable | 1309 | fnname |
| 1272 | fnname | 1310 | (or typedecl ;type |
| 1273 | typedecl | 1311 | (cond ((car (nth 3 tokenpart) ) |
| 1274 | nil | 1312 | "void") ; Destructors have no return? |
| 1275 | ;; It is a function pointer | 1313 | (constructor |
| 1276 | :functionpointer-flag t | 1314 | ;; Constructors return an object. |
| 1277 | ) | 1315 | (semantic-tag-new-type |
| 1278 | ;; The function | 1316 | ;; name |
| 1279 | (semantic-tag-new-function | 1317 | (or (car semantic-c-classname) |
| 1280 | fnname | 1318 | (let ((split (semantic-analyze-split-name-c-mode |
| 1281 | (or typedecl ;type | 1319 | (car (nth 2 tokenpart))))) |
| 1282 | (cond ((car (nth 3 tokenpart) ) | 1320 | (if (stringp split) split |
| 1283 | "void") ; Destructors have no return? | 1321 | (car (last split))))) |
| 1284 | (constructor | 1322 | ;; type |
| 1285 | ;; Constructors return an object. | 1323 | (or (cdr semantic-c-classname) |
| 1286 | (semantic-tag-new-type | 1324 | "class") |
| 1287 | ;; name | 1325 | ;; members |
| 1288 | (or (car semantic-c-classname) | 1326 | nil |
| 1289 | (let ((split (semantic-analyze-split-name-c-mode | 1327 | ;; parents |
| 1290 | (car (nth 2 tokenpart))))) | 1328 | nil |
| 1291 | (if (stringp split) split | 1329 | )) |
| 1292 | (car (last split))))) | 1330 | (t "int"))) |
| 1293 | ;; type | 1331 | ;; Argument list can contain things like function pointers |
| 1294 | (or (cdr semantic-c-classname) | 1332 | (semantic-c-reconstitute-function-arglist (nth 4 tokenpart)) |
| 1295 | "class") | 1333 | :constant-flag (if (member "const" declmods) t nil) |
| 1296 | ;; members | 1334 | :typemodifiers (delete "const" declmods) |
| 1297 | nil | 1335 | :parent (car (nth 2 tokenpart)) |
| 1298 | ;; parents | 1336 | :destructor-flag (if (car (nth 3 tokenpart) ) t) |
| 1299 | nil | 1337 | :constructor-flag (if constructor t) |
| 1300 | )) | 1338 | :function-pointer fcnpointer |
| 1301 | (t "int"))) | 1339 | :pointer (nth 7 tokenpart) |
| 1302 | (nth 4 tokenpart) ;arglist | 1340 | :operator-flag operator |
| 1303 | :constant-flag (if (member "const" declmods) t nil) | 1341 | ;; Even though it is "throw" in C++, we use |
| 1304 | :typemodifiers (delete "const" declmods) | 1342 | ;; `throws' as a common name for things that toss |
| 1305 | :parent (car (nth 2 tokenpart)) | 1343 | ;; exceptions about. |
| 1306 | :destructor-flag (if (car (nth 3 tokenpart) ) t) | 1344 | :throws (nth 5 tokenpart) |
| 1307 | :constructor-flag (if constructor t) | 1345 | ;; Reentrant is a C++ thingy. Add it here |
| 1308 | :pointer (nth 7 tokenpart) | 1346 | :reentrant-flag (if (member "reentrant" (nth 6 tokenpart)) t) |
| 1309 | :operator-flag operator | 1347 | ;; A function post-const is funky. Try stuff |
| 1310 | ;; Even though it is "throw" in C++, we use | 1348 | :methodconst-flag (if (member "const" (nth 6 tokenpart)) t) |
| 1311 | ;; `throws' as a common name for things that toss | 1349 | ;; prototypes are functions w/ no body |
| 1312 | ;; exceptions about. | 1350 | :prototype-flag (if (nth 8 tokenpart) t) |
| 1313 | :throws (nth 5 tokenpart) | 1351 | ;; Pure virtual |
| 1314 | ;; Reentrant is a C++ thingy. Add it here | 1352 | :pure-virtual-flag (if (eq (nth 8 tokenpart) :pure-virtual-flag) t) |
| 1315 | :reentrant-flag (if (member "reentrant" (nth 6 tokenpart)) t) | 1353 | ;; Template specifier. |
| 1316 | ;; A function post-const is funky. Try stuff | 1354 | :template-specifier (nth 9 tokenpart)))))) |
| 1317 | :methodconst-flag (if (member "const" (nth 6 tokenpart)) t) | ||
| 1318 | ;; prototypes are functions w/ no body | ||
| 1319 | :prototype-flag (if (nth 8 tokenpart) t) | ||
| 1320 | ;; Pure virtual | ||
| 1321 | :pure-virtual-flag (if (eq (nth 8 tokenpart) :pure-virtual-flag) t) | ||
| 1322 | ;; Template specifier. | ||
| 1323 | :template-specifier (nth 9 tokenpart) | ||
| 1324 | ))) | ||
| 1325 | ) | ||
| 1326 | )) | ||
| 1327 | 1355 | ||
| 1328 | (defun semantic-c-reconstitute-template (tag specifier) | 1356 | (defun semantic-c-reconstitute-template (tag specifier) |
| 1329 | "Reconstitute the token TAG with the template SPECIFIER." | 1357 | "Reconstitute the token TAG with the template SPECIFIER." |
| 1330 | (semantic-tag-put-attribute tag :template (or specifier "")) | 1358 | (semantic-tag-put-attribute tag :template (or specifier "")) |
| 1331 | tag) | 1359 | tag) |
| 1332 | 1360 | ||
| 1361 | (defun semantic-c-reconstitute-function-arglist (arglist) | ||
| 1362 | "Reconstitute the argument list of a function. | ||
| 1363 | This currently only checks if the function expects a function | ||
| 1364 | pointer as argument." | ||
| 1365 | (let (result) | ||
| 1366 | (dolist (arg arglist) | ||
| 1367 | ;; Names starting with a '*' denote a function pointer | ||
| 1368 | (if (and (> (length (semantic-tag-name arg)) 0) | ||
| 1369 | (= (aref (semantic-tag-name arg) 0) ?*)) | ||
| 1370 | (setq result | ||
| 1371 | (append result | ||
| 1372 | (list | ||
| 1373 | (semantic-tag-new-function | ||
| 1374 | (substring (semantic-tag-name arg) 1) | ||
| 1375 | (semantic-tag-type arg) | ||
| 1376 | (cadr (semantic-tag-attributes arg)) | ||
| 1377 | :function-pointer t)))) | ||
| 1378 | (setq result (append result (list arg))))) | ||
| 1379 | result)) | ||
| 1380 | |||
| 1333 | 1381 | ||
| 1334 | ;;; Override methods & Variables | 1382 | ;;; Override methods & Variables |
| 1335 | ;; | 1383 | ;; |
| @@ -1338,7 +1386,7 @@ Optional argument STAR and REF indicate the number of * and & in the typedef." | |||
| 1338 | "Convert TAG to a string that is the print name for TAG. | 1386 | "Convert TAG to a string that is the print name for TAG. |
| 1339 | Optional PARENT and COLOR are ignored." | 1387 | Optional PARENT and COLOR are ignored." |
| 1340 | (let ((name (semantic-format-tag-name-default tag parent color)) | 1388 | (let ((name (semantic-format-tag-name-default tag parent color)) |
| 1341 | (fnptr (semantic-tag-get-attribute tag :functionpointer-flag)) | 1389 | (fnptr (semantic-tag-get-attribute tag :function-pointer)) |
| 1342 | ) | 1390 | ) |
| 1343 | (if (not fnptr) | 1391 | (if (not fnptr) |
| 1344 | name | 1392 | name |
| @@ -1823,31 +1871,31 @@ DO NOT return the list of tags encompassing point." | |||
| 1823 | (let ((idx 0) | 1871 | (let ((idx 0) |
| 1824 | (len (semanticdb-find-result-length tmp))) | 1872 | (len (semanticdb-find-result-length tmp))) |
| 1825 | (while (< idx len) | 1873 | (while (< idx len) |
| 1826 | (setq tagreturn (cons (semantic-tag-type (car (semanticdb-find-result-nth tmp idx))) tagreturn)) | 1874 | (setq tagreturn |
| 1827 | (setq idx (1+ idx))) | 1875 | (append tagreturn (list (semantic-tag-type |
| 1828 | ) | 1876 | (car (semanticdb-find-result-nth tmp idx)))))) |
| 1829 | ;; Use the encompassed types around point to also look for using statements. | 1877 | (setq idx (1+ idx)))) |
| 1830 | ;;(setq tagreturn (cons "bread_name" tagreturn)) | 1878 | ;; Use the encompassed types around point to also look for using |
| 1831 | (while (cdr tagsaroundpoint) ; don't search the last one | 1879 | ;; statements. If we deal with types, search inside members; for |
| 1832 | (setq tmp (semantic-find-tags-by-class 'using (semantic-tag-components (car tagsaroundpoint)))) | 1880 | ;; functions, we have to call `semantic-get-local-variables' to |
| 1833 | (dolist (T tmp) | 1881 | ;; parse inside the function's body. |
| 1834 | (setq tagreturn (cons (semantic-tag-type T) tagreturn)) | 1882 | (dolist (cur tagsaroundpoint) |
| 1835 | ) | 1883 | (cond |
| 1836 | (setq tagsaroundpoint (cdr tagsaroundpoint)) | 1884 | ((and (eq (semantic-tag-class cur) 'type) |
| 1837 | ) | 1885 | (setq tmp (semantic-find-tags-by-class |
| 1838 | ;; If in a function... | 1886 | 'using |
| 1839 | (when (and (semantic-tag-of-class-p (car tagsaroundpoint) 'function) | 1887 | (semantic-tag-components (car tagsaroundpoint))))) |
| 1840 | ;; ...search for using statements in the local scope... | 1888 | (dolist (T tmp) |
| 1841 | (setq tmp (semantic-find-tags-by-class | 1889 | (setq tagreturn (cons (semantic-tag-type T) tagreturn)))) |
| 1842 | 'using | 1890 | ((and (semantic-tag-of-class-p (car (last tagsaroundpoint)) 'function) |
| 1843 | (semantic-get-local-variables)))) | 1891 | (setq tmp (semantic-find-tags-by-class |
| 1844 | ;; ... and add them. | 1892 | 'using |
| 1845 | (setq tagreturn | 1893 | (semantic-get-local-variables)))) |
| 1846 | (append tagreturn | 1894 | (setq tagreturn |
| 1847 | (mapcar 'semantic-tag-type tmp)))) | 1895 | (append tagreturn |
| 1896 | (mapcar 'semantic-tag-type tmp)))))) | ||
| 1848 | ;; Return the stuff | 1897 | ;; Return the stuff |
| 1849 | tagreturn | 1898 | tagreturn)) |
| 1850 | )) | ||
| 1851 | 1899 | ||
| 1852 | (define-mode-local-override semantic-ctxt-imported-packages c++-mode (&optional point) | 1900 | (define-mode-local-override semantic-ctxt-imported-packages c++-mode (&optional point) |
| 1853 | "Return the list of using tag types in scope of POINT." | 1901 | "Return the list of using tag types in scope of POINT." |
diff --git a/lisp/cedet/semantic/bovine/gcc.el b/lisp/cedet/semantic/bovine/gcc.el index 7beb8ff3203..e3c07ca96f4 100644 --- a/lisp/cedet/semantic/bovine/gcc.el +++ b/lisp/cedet/semantic/bovine/gcc.el | |||
| @@ -210,7 +210,8 @@ It should also include other symbols GCC was compiled with.") | |||
| 210 | (semantic-add-system-include D 'c-mode)) | 210 | (semantic-add-system-include D 'c-mode)) |
| 211 | (dolist (D (semantic-gcc-get-include-paths "c++")) | 211 | (dolist (D (semantic-gcc-get-include-paths "c++")) |
| 212 | (semantic-add-system-include D 'c++-mode) | 212 | (semantic-add-system-include D 'c++-mode) |
| 213 | (let ((cppconfig (list (concat D "/bits/c++config.h") (concat D "/sys/cdefs.h")))) | 213 | (let ((cppconfig (list (concat D "/bits/c++config.h") (concat D "/sys/cdefs.h") |
| 214 | (concat D "/features.h")))) | ||
| 214 | (dolist (cur cppconfig) | 215 | (dolist (cur cppconfig) |
| 215 | ;; Presumably there will be only one of these files in the try-paths list... | 216 | ;; Presumably there will be only one of these files in the try-paths list... |
| 216 | (when (file-readable-p cur) | 217 | (when (file-readable-p cur) |
diff --git a/lisp/cedet/semantic/ctxt.el b/lisp/cedet/semantic/ctxt.el index b010a30da7f..f421e725ad9 100644 --- a/lisp/cedet/semantic/ctxt.el +++ b/lisp/cedet/semantic/ctxt.el | |||
| @@ -168,8 +168,7 @@ Uses the bovinator with the special top-symbol `bovine-inner-scope' | |||
| 168 | to collect tags, such as local variables or prototypes." | 168 | to collect tags, such as local variables or prototypes." |
| 169 | ;; This assumes a bovine parser. Make sure we don't do | 169 | ;; This assumes a bovine parser. Make sure we don't do |
| 170 | ;; anything in that case. | 170 | ;; anything in that case. |
| 171 | (when (and semantic--parse-table (not (eq semantic--parse-table t)) | 171 | (when (and semantic--parse-table (not (eq semantic--parse-table t))) |
| 172 | (not (semantic-parse-tree-unparseable-p))) | ||
| 173 | (let ((vars (semantic-get-cache-data 'get-local-variables))) | 172 | (let ((vars (semantic-get-cache-data 'get-local-variables))) |
| 174 | (if vars | 173 | (if vars |
| 175 | (progn | 174 | (progn |
diff --git a/lisp/cedet/semantic/db-mode.el b/lisp/cedet/semantic/db-mode.el index e0cb3708454..27daa9c2279 100644 --- a/lisp/cedet/semantic/db-mode.el +++ b/lisp/cedet/semantic/db-mode.el | |||
| @@ -105,7 +105,8 @@ Sets up the semanticdb environment." | |||
| 105 | (oset ctbl major-mode major-mode) | 105 | (oset ctbl major-mode major-mode) |
| 106 | ;; Local state | 106 | ;; Local state |
| 107 | (setq semanticdb-current-table ctbl) | 107 | (setq semanticdb-current-table ctbl) |
| 108 | ;; Try to swap in saved tags | 108 | (oset ctbl buffer (current-buffer)) |
| 109 | ;; Try to swap in saved tags | ||
| 109 | (if (or (not (slot-boundp ctbl 'tags)) (not (oref ctbl tags)) | 110 | (if (or (not (slot-boundp ctbl 'tags)) (not (oref ctbl tags)) |
| 110 | (/= (or (oref ctbl pointmax) 0) (point-max)) | 111 | (/= (or (oref ctbl pointmax) 0) (point-max)) |
| 111 | ) | 112 | ) |
| @@ -133,7 +134,6 @@ Sets up the semanticdb environment." | |||
| 133 | (semantic--set-buffer-cache (oref ctbl tags)) | 134 | (semantic--set-buffer-cache (oref ctbl tags)) |
| 134 | ;; Don't need it to be dirty. Set dirty due to hooks from above. | 135 | ;; Don't need it to be dirty. Set dirty due to hooks from above. |
| 135 | (oset ctbl dirty nil) ;; Special case here. | 136 | (oset ctbl dirty nil) ;; Special case here. |
| 136 | (oset ctbl buffer (current-buffer)) | ||
| 137 | ;; Bind into the buffer. | 137 | ;; Bind into the buffer. |
| 138 | (semantic--tag-link-cache-to-buffer) | 138 | (semantic--tag-link-cache-to-buffer) |
| 139 | ) | 139 | ) |
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el index 614ce706b0c..bb7836e5c98 100644 --- a/lisp/cedet/semantic/db.el +++ b/lisp/cedet/semantic/db.el | |||
| @@ -560,8 +560,9 @@ This will call `semantic-fetch-tags' if that file is in memory." | |||
| 560 | ;; | 560 | ;; |
| 561 | ;; Already in a buffer, just do it. | 561 | ;; Already in a buffer, just do it. |
| 562 | ((semanticdb-in-buffer-p obj) | 562 | ((semanticdb-in-buffer-p obj) |
| 563 | (semanticdb-set-buffer obj) | 563 | (save-excursion |
| 564 | (semantic-fetch-tags)) | 564 | (semanticdb-set-buffer obj) |
| 565 | (semantic-fetch-tags))) | ||
| 565 | ;; | 566 | ;; |
| 566 | ;; Not in a buffer. Forcing a load. | 567 | ;; Not in a buffer. Forcing a load. |
| 567 | (force | 568 | (force |
diff --git a/lisp/cedet/semantic/decorate/include.el b/lisp/cedet/semantic/decorate/include.el index 0451ad44fe8..aa488373f0d 100644 --- a/lisp/cedet/semantic/decorate/include.el +++ b/lisp/cedet/semantic/decorate/include.el | |||
| @@ -335,6 +335,9 @@ This mode provides a nice context menu on the include statements." | |||
| 335 | (defun semantic-decoration-on-includes-highlight-default (tag) | 335 | (defun semantic-decoration-on-includes-highlight-default (tag) |
| 336 | "Highlight the include TAG to show that semantic can't find it." | 336 | "Highlight the include TAG to show that semantic can't find it." |
| 337 | (let* ((file (semantic-dependency-tag-file tag)) | 337 | (let* ((file (semantic-dependency-tag-file tag)) |
| 338 | ;; Don't actually load includes | ||
| 339 | (semanticdb-find-default-throttle | ||
| 340 | (remq 'unloaded semanticdb-find-default-throttle)) | ||
| 338 | (table (semanticdb-find-table-for-include tag (current-buffer))) | 341 | (table (semanticdb-find-table-for-include tag (current-buffer))) |
| 339 | (face nil) | 342 | (face nil) |
| 340 | (map nil) | 343 | (map nil) |
| @@ -365,8 +368,8 @@ This mode provides a nice context menu on the include statements." | |||
| 365 | (semanticdb-cache-get | 368 | (semanticdb-cache-get |
| 366 | table 'semantic-decoration-unparsed-include-cache) | 369 | table 'semantic-decoration-unparsed-include-cache) |
| 367 | ;; Add a dependency. | 370 | ;; Add a dependency. |
| 368 | (let ((table semanticdb-current-table)) | 371 | (let ((currenttable semanticdb-current-table)) |
| 369 | (semanticdb-add-reference table tag)) | 372 | (semanticdb-add-reference currenttable tag)) |
| 370 | ) | 373 | ) |
| 371 | )) | 374 | )) |
| 372 | 375 | ||
diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el index cc5e9d9bec2..d959d3ab9c7 100644 --- a/lisp/cedet/semantic/decorate/mode.el +++ b/lisp/cedet/semantic/decorate/mode.el | |||
| @@ -275,7 +275,13 @@ minor mode is enabled." | |||
| 275 | 'semantic-decorate-tags-after-full-reparse nil t) | 275 | 'semantic-decorate-tags-after-full-reparse nil t) |
| 276 | ;; Add decorations to available tags. The above hooks ensure | 276 | ;; Add decorations to available tags. The above hooks ensure |
| 277 | ;; that new tags will be decorated when they become available. | 277 | ;; that new tags will be decorated when they become available. |
| 278 | (semantic-decorate-add-decorations (semantic-fetch-available-tags))) | 278 | ;; However, don't do this immediately, because EDE will be |
| 279 | ;; activated later by find-file-hook, and includes might not | ||
| 280 | ;; be found yet. | ||
| 281 | (run-with-idle-timer | ||
| 282 | 0.1 nil | ||
| 283 | (lambda () | ||
| 284 | (semantic-decorate-add-decorations (semantic-fetch-available-tags))))) | ||
| 279 | ;; Remove decorations from available tags. | 285 | ;; Remove decorations from available tags. |
| 280 | (semantic-decorate-clear-decorations (semantic-fetch-available-tags)) | 286 | (semantic-decorate-clear-decorations (semantic-fetch-available-tags)) |
| 281 | ;; Cleanup any leftover crap too. | 287 | ;; Cleanup any leftover crap too. |
diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el index c6fbbed2424..16ff6eb768e 100644 --- a/lisp/cedet/semantic/format.el +++ b/lisp/cedet/semantic/format.el | |||
| @@ -499,7 +499,12 @@ Optional argument COLOR means highlight the prototype with font-lock colors." | |||
| 499 | (setq r (concat r "[]") | 499 | (setq r (concat r "[]") |
| 500 | deref (1- deref))) | 500 | deref (1- deref))) |
| 501 | r))) | 501 | r))) |
| 502 | ) | 502 | (default (when (eq class 'variable) |
| 503 | (let ((defval | ||
| 504 | (semantic-tag-get-attribute tag :default-value))) | ||
| 505 | (when (and defval (stringp defval)) | ||
| 506 | (concat "[=" defval "]"))))) | ||
| 507 | ) | ||
| 503 | (if args | 508 | (if args |
| 504 | (setq args | 509 | (setq args |
| 505 | (concat " " | 510 | (concat " " |
| @@ -512,7 +517,8 @@ Optional argument COLOR means highlight the prototype with font-lock colors." | |||
| 512 | (if type (concat type " ")) | 517 | (if type (concat type " ")) |
| 513 | name | 518 | name |
| 514 | (or args "") | 519 | (or args "") |
| 515 | (or array "")))) | 520 | (or array "") |
| 521 | (or default "")))) | ||
| 516 | 522 | ||
| 517 | ;;;###autoload | 523 | ;;;###autoload |
| 518 | (define-overloadable-function semantic-format-tag-concise-prototype (tag &optional parent color) | 524 | (define-overloadable-function semantic-format-tag-concise-prototype (tag &optional parent color) |
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index 462e520654a..a77ebf98684 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el | |||
| @@ -70,6 +70,8 @@ | |||
| 70 | (require 'semantic) | 70 | (require 'semantic) |
| 71 | (require 'semantic/lex) | 71 | (require 'semantic/lex) |
| 72 | 72 | ||
| 73 | (declare-function semantic-c-end-of-macro "semantic/bovine/c") | ||
| 74 | |||
| 73 | ;;; Code: | 75 | ;;; Code: |
| 74 | (defvar semantic-lex-spp-macro-symbol-obarray nil | 76 | (defvar semantic-lex-spp-macro-symbol-obarray nil |
| 75 | "Table of macro keywords used by the Semantic Preprocessor. | 77 | "Table of macro keywords used by the Semantic Preprocessor. |
| @@ -527,16 +529,54 @@ and what valid VAL values are." | |||
| 527 | ;; | 529 | ;; |
| 528 | ;; Nested token FOO shows up in the table of macros, and gets replace | 530 | ;; Nested token FOO shows up in the table of macros, and gets replace |
| 529 | ;; inline. This is the same as case 2. | 531 | ;; inline. This is the same as case 2. |
| 532 | ;; | ||
| 533 | ;; CASE 5: Macros which open a scope without closing it | ||
| 534 | ;; | ||
| 535 | ;; #define __NAMESPACE_STD namespace std { | ||
| 536 | ;; #define __NAMESPACE_END } | ||
| 537 | ;; ==> | ||
| 538 | ;; ((NAMESPACE "namespace" 140 . 149) | ||
| 539 | ;; (symbol "std" 150 . 153) | ||
| 540 | ;; (open-paren "{" 154 . 155)) | ||
| 541 | ;; | ||
| 542 | ;; Note that we get a single 'open-paren' instead of a | ||
| 543 | ;; 'semantic-list', which is because we use | ||
| 544 | ;; 'semantic-lex-spp-paren-or-list' instead of | ||
| 545 | ;; 'semantic-lex-paren-or-list' in our spp-lexer. To keep things | ||
| 546 | ;; reasonably simple, we assume that such an open scope will always | ||
| 547 | ;; be closed by another macro (see | ||
| 548 | ;; `semantic-lex-spp-find-closing-macro'). We generate a | ||
| 549 | ;; 'semantic-list' to this closing macro, and we leave an overlay | ||
| 550 | ;; which contains information how far we got into the macro's | ||
| 551 | ;; stream (since it might open several scopes). | ||
| 552 | |||
| 553 | (let* ((arglist (semantic-lex-spp-macro-with-args val)) | ||
| 554 | (argalist nil) | ||
| 555 | (val-tmp nil) | ||
| 556 | (v nil) | ||
| 557 | (sppov (semantic-lex-spp-get-overlay beg)) | ||
| 558 | (sppinfo (when sppov (overlay-get sppov 'semantic-spp)))) | ||
| 559 | |||
| 560 | ;; First, check if we were already here and left information | ||
| 561 | (when sppinfo | ||
| 562 | ;; Advance in the tokens as far as we got last time | ||
| 563 | (when (numberp (car sppinfo)) | ||
| 564 | (while (and val | ||
| 565 | (>= (car sppinfo) (car (last (car val))))) | ||
| 566 | (setq val (cdr val)))) | ||
| 567 | ;; And push an open paren | ||
| 568 | (semantic-lex-push-token | ||
| 569 | (semantic-lex-token 'open-paren beg (1+ beg) "{")) | ||
| 570 | (setq semantic-lex-current-depth (1+ semantic-lex-current-depth)) | ||
| 571 | (unless val | ||
| 572 | ;; We reached the end of this macro, so delete overlay | ||
| 573 | (delete-overlay sppov))) | ||
| 530 | 574 | ||
| 531 | (let ((arglist (semantic-lex-spp-macro-with-args val)) | ||
| 532 | (argalist nil) | ||
| 533 | (val-tmp nil) | ||
| 534 | (v nil) | ||
| 535 | ) | ||
| 536 | ;; CASE 2: Dealing with the arg list. | 575 | ;; CASE 2: Dealing with the arg list. |
| 537 | (when arglist | 576 | (when (and val arglist) |
| 538 | ;; Skip the arg list. | 577 | ;; Skip the arg list. |
| 539 | (setq val (cdr val)) | 578 | (when (eq (caar val) 'spp-arg-list) |
| 579 | (setq val (cdr val))) | ||
| 540 | 580 | ||
| 541 | ;; Push args into the replacement list. | 581 | ;; Push args into the replacement list. |
| 542 | (let ((AV argvalues)) | 582 | (let ((AV argvalues)) |
| @@ -616,7 +656,32 @@ and what valid VAL values are." | |||
| 616 | (semantic-lex-push-token | 656 | (semantic-lex-push-token |
| 617 | (semantic-lex-token (semantic-lex-token-class v) beg end txt)) | 657 | (semantic-lex-token (semantic-lex-token-class v) beg end txt)) |
| 618 | ) | 658 | ) |
| 619 | 659 | ;; CASE 5: Macro which opens a scope | |
| 660 | ((eq (semantic-lex-token-class v) 'open-paren) | ||
| 661 | ;; We assume that the scope will be closed by another macro. | ||
| 662 | ;; (Everything else would be a terrible idea anyway.) | ||
| 663 | (let* ((endpoint (semantic-lex-spp-find-closing-macro)) | ||
| 664 | (ov (when endpoint | ||
| 665 | (or sppov | ||
| 666 | (make-overlay beg end))))) | ||
| 667 | (when ov | ||
| 668 | ;; Generate a semantic-list which spans to the end of | ||
| 669 | ;; the closing macro | ||
| 670 | (semantic-lex-push-token | ||
| 671 | (semantic-lex-token 'semantic-list beg endpoint)) | ||
| 672 | ;; The rest of the current macro's stream will be parsed | ||
| 673 | ;; next time. | ||
| 674 | (setq val-tmp nil) | ||
| 675 | ;; Store our current state were we are in the macro and | ||
| 676 | ;; the endpoint. | ||
| 677 | (overlay-put ov 'semantic-spp | ||
| 678 | (cons (car (last v)) endpoint))))) | ||
| 679 | ((eq (semantic-lex-token-class v) 'close-paren) | ||
| 680 | ;; Macro which closes a scope | ||
| 681 | ;; Just push the close paren, but also decrease depth | ||
| 682 | (semantic-lex-push-token | ||
| 683 | (semantic-lex-token 'close-paren beg end txt)) | ||
| 684 | (setq semantic-lex-current-depth (1- semantic-lex-current-depth))) | ||
| 620 | ;; CASE 1: Just another token in the stream. | 685 | ;; CASE 1: Just another token in the stream. |
| 621 | (t | 686 | (t |
| 622 | ;; Nothing new. | 687 | ;; Nothing new. |
| @@ -652,6 +717,37 @@ will return empty string instead.") | |||
| 652 | txt | 717 | txt |
| 653 | "")) | 718 | "")) |
| 654 | 719 | ||
| 720 | (defun semantic-lex-spp-find-closing-macro () | ||
| 721 | "Find next macro which closes a scope through a close-paren. | ||
| 722 | Returns position with the end of that macro." | ||
| 723 | (let ((macros (semantic-lex-spp-macros)) | ||
| 724 | (cmacro-regexp "\\(") | ||
| 725 | (case-fold-search nil)) | ||
| 726 | ;; Build a regexp which search for all macros with a closing | ||
| 727 | ;; paren, and search for it. | ||
| 728 | (dolist (cur macros) | ||
| 729 | (let ((stream (symbol-value cur))) | ||
| 730 | (when (and (listp stream) (listp (car stream))) | ||
| 731 | (while stream | ||
| 732 | (if (and (eq (caar stream) 'close-paren) | ||
| 733 | (string= (nth 1 (car stream)) "}")) | ||
| 734 | (setq cmacro-regexp (concat cmacro-regexp (symbol-name cur) "\\|") | ||
| 735 | stream nil) | ||
| 736 | (setq stream (cdr-safe stream))))))) | ||
| 737 | (when cmacro-regexp | ||
| 738 | (save-excursion | ||
| 739 | (when (re-search-forward | ||
| 740 | (concat (substring cmacro-regexp 0 -2) "\\)[^0-9a-zA-Z_]") nil t) | ||
| 741 | (point)))))) | ||
| 742 | |||
| 743 | (defun semantic-lex-spp-get-overlay (&optional point) | ||
| 744 | "Return first overlay which has a 'semantic-spp property." | ||
| 745 | (let ((overlays (overlays-at (or point (point))))) | ||
| 746 | (while (and overlays | ||
| 747 | (null (overlay-get (car overlays) 'semantic-spp))) | ||
| 748 | (setq overlays (cdr overlays))) | ||
| 749 | (car-safe overlays))) | ||
| 750 | |||
| 655 | ;;; Macro Merging | 751 | ;;; Macro Merging |
| 656 | ;; | 752 | ;; |
| 657 | ;; Used when token streams from different macros include each other. | 753 | ;; Used when token streams from different macros include each other. |
| @@ -824,8 +920,46 @@ STR occurs in the current buffer between BEG and END." | |||
| 824 | "\\(\\sw\\|\\s_\\)+" | 920 | "\\(\\sw\\|\\s_\\)+" |
| 825 | (let ((str (match-string 0)) | 921 | (let ((str (match-string 0)) |
| 826 | (beg (match-beginning 0)) | 922 | (beg (match-beginning 0)) |
| 827 | (end (match-end 0))) | 923 | (end (match-end 0)) |
| 828 | (semantic-lex-spp-analyzer-push-tokens-for-symbol str beg end))) | 924 | sppov) |
| 925 | (semantic-lex-spp-analyzer-push-tokens-for-symbol str beg end) | ||
| 926 | (when (setq sppov (semantic-lex-spp-get-overlay beg)) | ||
| 927 | (setq semantic-lex-end-point (cdr (overlay-get sppov 'semantic-spp)))))) | ||
| 928 | |||
| 929 | (define-lex-regex-analyzer semantic-lex-spp-paren-or-list | ||
| 930 | "Detect open parenthesis. | ||
| 931 | Contrary to `semantic-lex-paren-or-list', this will push a single | ||
| 932 | open-paren onto the stream if no closing paren can be found. | ||
| 933 | This is important for macros which open a scope which is closed | ||
| 934 | by another macro." | ||
| 935 | "\\s(" | ||
| 936 | (if (or (not semantic-lex-maximum-depth) | ||
| 937 | (< semantic-lex-current-depth semantic-lex-maximum-depth)) | ||
| 938 | (progn | ||
| 939 | (setq semantic-lex-current-depth (1+ semantic-lex-current-depth)) | ||
| 940 | (semantic-lex-push-token | ||
| 941 | (semantic-lex-token | ||
| 942 | 'open-paren (match-beginning 0) (match-end 0)))) | ||
| 943 | (save-excursion | ||
| 944 | (let ((start (match-beginning 0)) | ||
| 945 | (end (match-end 0)) | ||
| 946 | (peom (save-excursion (semantic-c-end-of-macro) (point)))) | ||
| 947 | (condition-case nil | ||
| 948 | (progn | ||
| 949 | ;; This will throw an error if no closing paren can be found. | ||
| 950 | (forward-list 1) | ||
| 951 | (when (> (point) peom) | ||
| 952 | ;; If we have left the macro, this is the wrong closing | ||
| 953 | ;; paren, so error out as well. | ||
| 954 | (error "")) | ||
| 955 | (semantic-lex-push-token | ||
| 956 | (semantic-lex-token | ||
| 957 | 'semantic-list start (point)))) | ||
| 958 | (error | ||
| 959 | ;; Only push a single open-paren. | ||
| 960 | (semantic-lex-push-token | ||
| 961 | (semantic-lex-token | ||
| 962 | 'open-paren start end)))))))) | ||
| 829 | 963 | ||
| 830 | ;;; ANALYZERS FOR NEW MACROS | 964 | ;;; ANALYZERS FOR NEW MACROS |
| 831 | ;; | 965 | ;; |
diff --git a/lisp/cedet/semantic/scope.el b/lisp/cedet/semantic/scope.el index 13e858ca000..653f02d8e41 100644 --- a/lisp/cedet/semantic/scope.el +++ b/lisp/cedet/semantic/scope.el | |||
| @@ -195,12 +195,18 @@ Use `semantic-ctxt-scoped-types' to find types." | |||
| 195 | ;; Get this thing as a tag | 195 | ;; Get this thing as a tag |
| 196 | (let ((tmp (cond | 196 | (let ((tmp (cond |
| 197 | ((stringp (car sp)) | 197 | ((stringp (car sp)) |
| 198 | (semanticdb-typecache-find (car sp))) | 198 | (or (semanticdb-typecache-find (car sp)) |
| 199 | ;(semantic-analyze-find-tag (car sp) 'type)) | 199 | ;; If we did not find it in the typecache, |
| 200 | ;; look in the tags we found so far | ||
| 201 | (car (semantic-deep-find-tags-by-name | ||
| 202 | (car sp) | ||
| 203 | code-scoped-types)))) | ||
| 200 | ((semantic-tag-p (car sp)) | 204 | ((semantic-tag-p (car sp)) |
| 201 | (if (semantic-tag-prototype-p (car sp)) | 205 | (if (semantic-tag-prototype-p (car sp)) |
| 202 | (semanticdb-typecache-find (semantic-tag-name (car sp))) | 206 | (or (semanticdb-typecache-find (semantic-tag-name (car sp))) |
| 203 | ;;(semantic-analyze-find-tag (semantic-tag-name (car sp)) 'type) | 207 | (car (semantic-deep-find-tags-by-name |
| 208 | (semantic-tag-name (car sp)) | ||
| 209 | code-scoped-types))) | ||
| 204 | (car sp))) | 210 | (car sp))) |
| 205 | (t nil)))) | 211 | (t nil)))) |
| 206 | (when tmp | 212 | (when tmp |
| @@ -506,10 +512,33 @@ tag is not something you can complete from within TYPE." | |||
| 506 | (leftover nil) | 512 | (leftover nil) |
| 507 | ) | 513 | ) |
| 508 | (dolist (S allslots) | 514 | (dolist (S allslots) |
| 509 | (when (or (not (semantic-tag-of-class-p S 'function)) | 515 | ;; We have to specially deal with 'using' tags here, since those |
| 510 | (not (semantic-tag-function-parent S))) | 516 | ;; pull in namespaces or classes into the current scope. |
| 511 | (setq leftover (cons S leftover))) | 517 | ;; (Should this go into c.el? If so, into which override?) |
| 512 | ) | 518 | (if (semantic-tag-of-class-p S 'using) |
| 519 | (let* ((fullname (semantic-analyze-unsplit-name | ||
| 520 | (list (semantic-tag-name type) | ||
| 521 | (semantic-tag-name S)))) | ||
| 522 | ;; Search the typecache, first for the unqualified name | ||
| 523 | (usingtype (or | ||
| 524 | (semanticdb-typecache-find (semantic-tag-name S)) | ||
| 525 | ;; If that didn't return anything, use | ||
| 526 | ;; fully qualified name | ||
| 527 | (semanticdb-typecache-find fullname))) | ||
| 528 | (filename (when usingtype (semantic-tag-file-name usingtype)))) | ||
| 529 | (when usingtype | ||
| 530 | ;; Use recursion to examine that namespace or class | ||
| 531 | (let ((tags (semantic-completable-tags-from-type usingtype))) | ||
| 532 | (if filename | ||
| 533 | ;; If we have a filename, copy the tags with it | ||
| 534 | (dolist (cur tags) | ||
| 535 | (setq leftover (cons (semantic-tag-copy cur nil filename) | ||
| 536 | leftover))) | ||
| 537 | ;; Otherwise just run with it | ||
| 538 | (setq leftover (append tags leftover)))))) | ||
| 539 | (when (or (not (semantic-tag-of-class-p S 'function)) | ||
| 540 | (not (semantic-tag-function-parent S))) | ||
| 541 | (setq leftover (cons S leftover))))) | ||
| 513 | (nreverse leftover))) | 542 | (nreverse leftover))) |
| 514 | 543 | ||
| 515 | (defun semantic-analyze-scoped-type-parts (type &optional scope noinherit protection) | 544 | (defun semantic-analyze-scoped-type-parts (type &optional scope noinherit protection) |
| @@ -734,8 +763,9 @@ The class returned from the scope calculation is variable | |||
| 734 | (when (called-interactively-p 'any) | 763 | (when (called-interactively-p 'any) |
| 735 | (require 'eieio-datadebug) | 764 | (require 'eieio-datadebug) |
| 736 | (data-debug-show scopecache)) | 765 | (data-debug-show scopecache)) |
| 737 | ;; Return ourselves | 766 | ;; Return ourselves, but make a clone first so that the caller |
| 738 | scopecache)))) | 767 | ;; can reset the scope cache without affecting others. |
| 768 | (clone scopecache))))) | ||
| 739 | 769 | ||
| 740 | (defun semantic-scope-find (name &optional class scope-in) | 770 | (defun semantic-scope-find (name &optional class scope-in) |
| 741 | "Find the tag with NAME, and optional CLASS in the current SCOPE-IN. | 771 | "Find the tag with NAME, and optional CLASS in the current SCOPE-IN. |