Skip to content

Commit ae4d718

Browse files
fix: Treat all kinds of comments as doc comments (#325)
1 parent 5ceb07c commit ae4d718

File tree

4 files changed

+69
-4
lines changed

4 files changed

+69
-4
lines changed

indexer/Worker.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class IndexerFrontendAction : public clang::ASTFrontendAction {
4444
std::unique_ptr<clang::ASTConsumer>
4545
CreateASTConsumer(clang::CompilerInstance &compilerInstance,
4646
llvm::StringRef filepath) override {
47+
compilerInstance.getLangOpts().CommentOpts.ParseAllComments = true;
4748
auto &preprocessor = compilerInstance.getPreprocessor();
4849
auto callbacks = std::make_unique<IndexerPreprocessorWrapper>(
4950
compilerInstance.getSourceManager(), this->preprocessorOptions,

test/index/docs/docs.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// format-options: showDocs
2+
3+
/// Dumhdurum!
4+
enum class Apink {
5+
/** Leader
6+
* Lead Dancer */
7+
Chorong,
8+
// Vocalist
9+
Bomi,
10+
Eunji, // Main Vocalist
11+
// From Busan
12+
/* Departed
13+
* :( */
14+
Naeun,
15+
Namjoo, /* Vocalist */
16+
//! Maknae
17+
Hayoung,
18+
};

test/index/docs/docs.snapshot.cc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// format-options: showDocs
2+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition [..] `<file>/docs.cc`/
3+
//documentation
4+
//| File: docs.cc
5+
6+
/// Dumhdurum!
7+
enum class Apink {
8+
// ^^^^^ definition [..] Apink#
9+
// documentation
10+
// | Dumhdurum!
11+
/** Leader
12+
* Lead Dancer */
13+
Chorong,
14+
// ^^^^^^^ definition [..] Apink#Chorong.
15+
// documentation
16+
// | Leader
17+
// | Lead Dancer
18+
// Vocalist
19+
Bomi,
20+
// ^^^^ definition [..] Apink#Bomi.
21+
// documentation
22+
// | Vocalist
23+
Eunji, // Main Vocalist
24+
// ^^^^^ definition [..] Apink#Eunji.
25+
// documentation
26+
// | Main Vocalist
27+
// | From Busan
28+
// From Busan
29+
/* Departed
30+
* :( */
31+
Naeun,
32+
// ^^^^^ definition [..] Apink#Naeun.
33+
// documentation
34+
// | Departed
35+
// | :(
36+
Namjoo, /* Vocalist */
37+
// ^^^^^^ definition [..] Apink#Namjoo.
38+
// documentation
39+
// | Vocalist
40+
//! Maknae
41+
Hayoung,
42+
// ^^^^^^^ definition [..] Apink#Hayoung.
43+
// documentation
44+
// | Maknae
45+
};

test/index/types/types.snapshot.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@
3333
enum D {
3434
// ^ definition [..] D#
3535
// documentation
36-
// | No documentation available.
36+
// | Old MacDonald had a farm
37+
// | Ee i ee i o
3738
// And on his farm he had some cows
3839
D1,
3940
// ^^ definition [..] D1.
4041
// documentation
41-
// | No documentation available.
42+
// | And on his farm he had some cows
4243
};
4344

4445
/// Ee i ee i oh
@@ -91,7 +92,7 @@
9192
F1,
9293
// ^^ definition [..] has_anon_enum/F1.
9394
// documentation
94-
// | No documentation available.
95+
// | Here a moo, there a moo
9596
/** Everywhere a moo-moo */
9697
F2 = E2
9798
// ^^ definition [..] has_anon_enum/F2.
@@ -193,7 +194,7 @@
193194
enum class PartiallyDocumented {
194195
// ^^^^^^^^^^^^^^^^^^^ definition [..] PartiallyDocumented#
195196
// documentation
196-
// | No documentation available.
197+
// | Regression test for https://github.com/sourcegraph/scip-clang/issues/105
197198
/// :smugcat:
198199
Documented,
199200
// ^^^^^^^^^^ definition [..] PartiallyDocumented#Documented.

0 commit comments

Comments
 (0)