[PATCH] D95879: [clang][index] Mark file as C++ in parse-all-comments test

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 09:32:40 PST 2021


jansvoboda11 created this revision.
jansvoboda11 added reviewers: dexonsmith, Bigcheese.
Herald added a subscriber: arphaman.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

`CompilerInvocation::CreateFromArgs` doesn't always report command line parsing failures through the return value. Sometimes, errors are only reported via diagnostics.

Some clients like `c-index-test` only check the return value and don't check the state of `DiagnosticsEngine`.

If we were to start returning the correct return value from `CreateFromArgs`, this index test starts to fail, because it specifies `-std=c++11` for a C input, which is invalid.

This patch fixes that issue by adding forgotten `-x c++` argument.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95879

Files:
  clang/test/Index/parse-all-comments.c


Index: clang/test/Index/parse-all-comments.c
===================================================================
--- clang/test/Index/parse-all-comments.c
+++ clang/test/Index/parse-all-comments.c
@@ -75,7 +75,7 @@
 
 // RUN: c-index-test -write-pch %t/out.pch -fparse-all-comments -x c++ -std=c++11 %s
 
-// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -std=c++11 -fparse-all-comments > %t/out.c-index-direct
+// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -x c++ -std=c++11 %s -fparse-all-comments > %t/out.c-index-direct
 // RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch
 
 // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95879.320821.patch
Type: text/x-patch
Size: 790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210202/4f9ba602/attachment.bin>


More information about the cfe-commits mailing list