[PATCH] D72523: [remark][diagnostics] Using clang diagnostic handler for IR input files

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 18:46:21 PST 2020


tejohnson added a comment.

Thanks for fixing this missing -Rpass support!



================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:594
+  // SourceLoc.
+  if (Context == nullptr) {
+    return FullSourceLoc();
----------------
Does this only happen with IR input? Does it always happen with IR input? If not, what happens when we have a non-null Context but IR input? It sounds like it should still always return an invalid Loc since there is no SourceManager? In that case can you set a flag on the BackendConsumer so we can bail out directly in the IR input case, instead of going through the motions only to get an invalid Loc back anyway? It would also be more clear.


================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:650
+  if (!Loc.isValid()) {
+    MsgStream << D.getLocationStr() << ": in function "
+              << D.getFunction().getName() << ' '
----------------
Can you add a test for this one?

Also, what determines the format of the message when Loc is valid? I was trying to figure out where that got determined, but couldn't easily track it down. 


================
Comment at: clang/test/CodeGen/thinlto-clang-diagnostic-handler-in-be.c:8
+// RUN: llvm-lto -thinlto -o %t %t1.bo
+// RUN: %clang -cc1 -O2 -fexperimental-new-pass-manager -x ir %t1.bo -fthinlto-index=%t.thinlto.bc -emit-obj -Rpass-analysis=info 2>&1 | FileCheck %s -check-prefix=CHECK-REMARK
+// RUN: llvm-profdata merge -o %t2.profdata %S/Inputs/thinlto_expect2.proftext
----------------
In this case (since no -Wmisexpect), presumably we should not be getting the warning, whereas without your fix we were, correct? In that case, please add a NOT check to confirm that we don't get the message anymore.


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

https://reviews.llvm.org/D72523





More information about the cfe-commits mailing list