[gcov] Emit errors when opening the notes file fails

No time to write a test case, on to the next bug. =P

Discovered while investigating PR34659

llvm-svn: 313571
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 56d0f5e..b203353 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -519,6 +519,12 @@
 
     std::error_code EC;
     raw_fd_ostream out(mangleName(CU, GCovFileType::GCNO), EC, sys::fs::F_None);
+    if (EC) {
+      Ctx->emitError(Twine("failed to open coverage notes file for writing: ") +
+                     EC.message());
+      continue;
+    }
+
     std::string EdgeDestinations;
 
     unsigned FunctionIdent = 0;