Mathieu Béliveau writes:
> Here's included a small sample project. Note: I also did tried to add a
> temporary #include "Sample.h" in the .inl file but it didn't seemed to help
> the completion (and as it obviously creates a dependency loop, I'd prefer to
> avoid that anyways. Also note that the use of template here is purely
> artificial but I did it to clearly show why I'm using a .inl file (namely to
> have a way enforce the interface and implementation separation idiom when
> using templates.)
Temporarily #includ'ing "Sample.h" did the trick for me. For avoiding
dependency loops I'd just use include guards.
Anyway, if for some reason this doesn't work out, here's a very ugly
solution which will add the proper #include to the tags behind your back
when the cache gets updated:
(defun DE-inl-add-header-file (taglist)
"Super-ugly function to add appropriate header to C++ .inl file."
(let ((name (buffer-file-name (current-buffer)))
old)
(when (and name taglist
(eq major-mode 'c++-mode)
(string-match "\\(.*\\)\\.inl\\'" name))
(setq old (car taglist))
(setcar taglist
(semantic-tag-new-include (concat (match-string 1 name) ".h") nil))
(setcdr taglist (cons old (cdr taglist))))))
(add-hook 'semantic-after-toplevel-cache-change-hook 'DE-inl-add-header-file)
It depends on the .inl and .h files having the same basename, though.
Cheers,
David
|