[PATCH] D110160: [clang][tooling] NFC: Refactor command-line diagnostic tests

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 21 14:46:38 PDT 2021


dexonsmith added a comment.

Stepping back, maybe it'd be better to use a more generic option that is unlikely to have special behaviour in any target (or downstream).

Best one I could find is triggering `err_drv_unknown_language` with `-x this-is-an-unknown-language`. WDYT?



================
Comment at: clang/unittests/Tooling/ToolingTest.cpp:280-281
   InMemoryFileSystem->addFile(
-      "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int a() {}\n"));
-  ErrorCountingDiagnosticConsumer Consumer;
+      "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("void a() {}\n"));
+  TextDiagnosticBuffer Consumer;
   Invocation.setDiagnosticConsumer(&Consumer);
----------------
Can this just be empty and use `-E`? But if you switch to another error maybe you don't need to modify this anyway?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110160



More information about the cfe-commits mailing list