diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2016-01-28 10:07:27 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2016-01-28 10:07:27 +0000 |
commit | b4b092ea1bf6b41012f0d9b98f8d519e9384c109 (patch) | |
tree | 251170034b8d4bcf080b61d8cb2e09194009b083 /llvm/lib/CodeGen | |
parent | d3b78430d1112dec60dfe13b349bb629bc960874 (diff) | |
download | bcm5719-llvm-b4b092ea1bf6b41012f0d9b98f8d519e9384c109.tar.gz bcm5719-llvm-b4b092ea1bf6b41012f0d9b98f8d519e9384c109.zip |
Add backend dignostic printer for unsupported features
Re-commit of r258951 after fixing layering violation.
The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.
In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.
Differential Revision: http://reviews.llvm.org/D16590
llvm-svn: 259035
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/CMakeLists.txt | 1 | ||||
-rw-r--r-- | llvm/lib/CodeGen/DiagnosticInfoCodeGen.cpp | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt index 8e326fae4e3..b55a475445a 100644 --- a/llvm/lib/CodeGen/CMakeLists.txt +++ b/llvm/lib/CodeGen/CMakeLists.txt @@ -18,6 +18,7 @@ add_llvm_library(LLVMCodeGen CriticalAntiDepBreaker.cpp DeadMachineInstructionElim.cpp DFAPacketizer.cpp + DiagnosticInfoCodeGen.cpp DwarfEHPrepare.cpp EarlyIfConversion.cpp EdgeBundles.cpp diff --git a/llvm/lib/CodeGen/DiagnosticInfoCodeGen.cpp b/llvm/lib/CodeGen/DiagnosticInfoCodeGen.cpp new file mode 100644 index 00000000000..43adc5ee79e --- /dev/null +++ b/llvm/lib/CodeGen/DiagnosticInfoCodeGen.cpp @@ -0,0 +1,33 @@ +//===- llvm/Support/DiagnosticInfoCodeGen.cpp - Diagnostic Definitions -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the different classes involved in codegen diagnostics. +// +// Diagnostics reporting is still done as part of the LLVMContext. +//===----------------------------------------------------------------------===// + +#include "llvm/CodeGen/DiagnosticInfoCodeGen.h" +#include "llvm/IR/DiagnosticPrinter.h" + +namespace llvm { + +void DiagnosticInfoUnsupported::print(DiagnosticPrinter &DP) const { + std::string Str; + raw_string_ostream OS(Str); + + OS << getLocationStr() << ": in function " << getFunction().getName() << ' ' + << *getFunction().getFunctionType() << ": " << Msg; + if (Value) + Value->print(OS); + OS << '\n'; + OS.flush(); + DP << Str; +} + +} |