diff options
author | Bob Wilson <bob.wilson@apple.com> | 2012-12-24 18:15:21 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2012-12-24 18:15:21 +0000 |
commit | a0be09f511c68a88ee95b73c8f0ebd78156a559e (patch) | |
tree | 678964cde398eea6351973aba975ccec327aad3b /lib/Transforms/Instrumentation/EdgeProfiling.cpp | |
parent | fa45cdf646572cf11b03cfdaa63f75fd74fc7d34 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/EdgeProfiling.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/EdgeProfiling.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp index 41e42aff49..cf12b1f758 100644 --- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp @@ -21,6 +21,7 @@ #include "llvm/Transforms/Instrumentation.h" #include "ProfilingUtils.h" #include "llvm/ADT/Statistic.h" +#include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Support/raw_ostream.h" @@ -54,8 +55,8 @@ ModulePass *llvm::createEdgeProfilerPass() { return new EdgeProfiler(); } bool EdgeProfiler::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! } |