summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2012-12-24 18:15:21 +0000
committerBob Wilson <bob.wilson@apple.com>2012-12-24 18:15:21 +0000
commit4ed23578daa2ab659255511885f998d8876354d8 (patch)
treea1b75c77a95d2193da1e22e3816e52f64615471c /llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp
parent06b84eb414b76f6513c56a08c898a60d4d121987 (diff)
downloadbcm5719-llvm-4ed23578daa2ab659255511885f998d8876354d8.tar.gz
bcm5719-llvm-4ed23578daa2ab659255511885f998d8876354d8.zip
Add LLVMContext::emitWarning methods and use them. <rdar://problem/12867368>
When the backend is used from clang, it should produce proper diagnostics instead of just printing messages to errs(). Other clients may also want to register their own error handlers with the LLVMContext, and the same handler should work for warnings in the same way as the existing emitError methods. llvm-svn: 171041
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp b/llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp
index 8f8d027dca7..3c851681b90 100644
--- a/llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp
@@ -22,6 +22,7 @@
#include "llvm/Analysis/ProfileInfo.h"
#include "llvm/Analysis/ProfileInfoLoader.h"
#include "llvm/Constants.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
@@ -75,8 +76,8 @@ inline static void printEdgeCounter(ProfileInfo::Edge e,
bool OptimalEdgeProfiler::runOnModule(Module &M) {
Function *Main = M.getFunction("main");
if (Main == 0) {
- errs() << "WARNING: cannot insert edge profiling into a module"
- << " with no main function!\n";
+ M.getContext().emitWarning("cannot insert edge profiling into a module"
+ " with no main function");
return false; // No main, no instrumentation!
}
OpenPOWER on IntegriCloud