[PATCH] D61316: [clangd] Improvements to header mapping: more precise parsing of cppreference symbol pages.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 2 01:46:53 PDT 2019
sammccall added inline comments.
================
Comment at: clangd/include-mapping/gen_std.py:90
+ # Decl may not be for the symbol name we're looking for.
+ if not re.search("\\b%s\\b" % symbol_name, text):
+ continue
----------------
kadircet wrote:
> does this also work with functions? For example floor will be written as:
> ```constexpr ToDuration floor(const duration<Rep, Period>& d);```
> which does not contain floor as a word. https://en.cppreference.com/w/cpp/chrono/duration/floor
> which does not contain floor as a word
`\b` matches between a word character and non-word character.
Both ` ` and `(` are non-word characters, so we should be fine?
================
Comment at: clangd/include-mapping/gen_std.py:95
+ if was_decl:
+ current_headers = []
+ was_decl = False
----------------
kadircet wrote:
> why not perform clean-up unconditionally?
This isn't cleanup.
```
header1
header2
declX
```
declX is associated with header1 and header2
```
header1
declY
header2
declX
```
declX is associated with header2 only. We reset current_headers when we see header2 because it was preceded by a decl. I'll add a comment.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61316/new/
https://reviews.llvm.org/D61316
More information about the cfe-commits
mailing list