[PATCH] D133009: [libclang] Fix conversion from `StringRef` to `CXString`

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 31 08:39:37 PDT 2022


gribozavr2 added inline comments.


================
Comment at: clang/test/Index/comment-lots-of-unknown-commands.c:3
 
+// XFAIL: *
+
----------------
egorzhdan wrote:
> This test was never properly passing. Because of the bug in string conversion, the printed comments contained the entire source file and not just the comments' text, which was enough to cause `// CHECK`-s in the test to succeed.
> ```
> // CHECK:         (CXComment_InlineCommand CommandName=[tel] RenderNormal HasTrailingNewline)
> // CHECK:         (CXComment_InlineCommand CommandName=[n] RenderNormal HasTrailingNewline))
> // CHECK:       (CXComment_VerbatimLine Text=[\n at Lo\n at il\n at tle\n at axt\n at ba\n at ust\n at ac\n at tpe\n at tpl\n at ctG\n at ru\n at m\n at tG\n at it\n at rh\n at G\n at rpc\n at el\n at er\n at w\n at eo\n at tx\n at oo\n at dD\n at dD\n*/\nvoid f();\n\n// CHECK:  CommentAST=[\n// CHECK:    (CXComment_FullComment\n// CHECK:       (CXComment_Paragraph\n// CHECK:      ...
> ```
Please update the test to pass then. Here's the diff:

```
diff --git a/clang/test/Index/comment-lots-of-unknown-commands.c b/clang/test/Index/comment-lots-of-unknown-commands.c
index 41a03d394488..e1adcc150b1e 100644
--- a/clang/test/Index/comment-lots-of-unknown-commands.c
+++ b/clang/test/Index/comment-lots-of-unknown-commands.c
@@ -1,6 +1,5 @@
 // RUN: c-index-test -test-load-source-reparse 1 local %s | FileCheck %s

-// XFAIL: *

 // See PR 21254. We had too few bits to encode command IDs so if you created
 // enough of them the ID codes would wrap around. This test creates commands up
@@ -183,7 +182,7 @@ void f();
 // CHECK:         (CXComment_InlineCommand CommandName=[ei] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[oun] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[ou] RenderNormal HasTrailingNewline)
-// CHECK:         (CXComment_InlineCommand CommandName=[nl] RenderNormal HasTrailingNewline)
+// CHECK:         (CXComment_InlineCommand CommandName=[n] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[ien] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[fr] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[en] RenderNormal HasTrailingNewline)
@@ -204,7 +203,7 @@ void f();
 // CHECK:         (CXComment_InlineCommand CommandName=[fro] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[ast] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[ae] RenderNormal HasTrailingNewline)
-// CHECK:         (CXComment_InlineCommand CommandName=[nN] RenderNormal HasTrailingNewline)
+// CHECK:         (CXComment_InlineCommand CommandName=[n] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[pc] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[tae] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[ws] RenderNormal HasTrailingNewline)
@@ -268,10 +267,8 @@ void f();
 // CHECK:         (CXComment_InlineCommand CommandName=[an] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[de] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[tel] RenderNormal HasTrailingNewline)
-// CHECK:         (CXComment_InlineCommand CommandName=[nd] RenderNormal HasTrailingNewline)
-// CHECK:         (CXComment_InlineCommand CommandName=[dic] RenderNormal HasTrailingNewline)
+// CHECK:         (CXComment_InlineCommand CommandName=[n] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[Lo] RenderNormal HasTrailingNewline)
-// CHECK:         (CXComment_InlineCommand CommandName=[il] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[tle] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[axt] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[ba] RenderNormal HasTrailingNewline)
@@ -283,7 +280,6 @@ void f();
 // CHECK:         (CXComment_InlineCommand CommandName=[ru] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[m] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[tG] RenderNormal HasTrailingNewline)
-// CHECK:         (CXComment_InlineCommand CommandName=[it] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[rh] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[G] RenderNormal HasTrailingNewline)
 // CHECK:         (CXComment_InlineCommand CommandName=[rpc] RenderNormal HasTrailingNewline)
```



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133009/new/

https://reviews.llvm.org/D133009



More information about the cfe-commits mailing list