[clang] c1b482e - [clang][index] Mark file as C++ in parse-all-comments test

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 00:42:53 PST 2021


Author: Jan Svoboda
Date: 2021-02-08T09:42:44+01:00
New Revision: c1b482e726a943862ec5277a44c1994acfb7f97f

URL: https://github.com/llvm/llvm-project/commit/c1b482e726a943862ec5277a44c1994acfb7f97f
DIFF: https://github.com/llvm/llvm-project/commit/c1b482e726a943862ec5277a44c1994acfb7f97f.diff

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

`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.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D95879

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/test/Index/parse-all-comments.c b/clang/test/Index/parse-all-comments.c
index 66981e2b421b..e199b03acd3a 100644
--- a/clang/test/Index/parse-all-comments.c
+++ b/clang/test/Index/parse-all-comments.c
@@ -75,7 +75,7 @@ int trdoxyO;
 
 // 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


        


More information about the cfe-commits mailing list