[llvm-mc] Pushing plumbing through for --fatal-warnings flag.

llvm-svn: 243334
This commit is contained in:
Colin LeMahieu 2015-07-27 21:56:53 +00:00
parent 4630de80c5
commit fe2c8b8015
12 changed files with 20 additions and 11 deletions

View File

@ -92,7 +92,7 @@ private:
MCTargetAsmParser(const MCTargetAsmParser &) = delete;
void operator=(const MCTargetAsmParser &) = delete;
protected: // Can only create subclasses.
MCTargetAsmParser();
MCTargetAsmParser(MCTargetOptions const &);
/// AvailableFeatures - The current set of available features.
uint64_t AvailableFeatures;

View File

@ -40,6 +40,9 @@ cl::opt<bool> ShowMCInst("asm-show-inst",
cl::desc("Emit internal instruction representation to "
"assembly file"));
cl::opt<bool> FatalWarnings("fatal-warnings",
cl::desc("Treat warnings as errors"));
cl::opt<std::string>
ABIName("target-abi", cl::Hidden,
cl::desc("The name of the ABI to be targeted from the backend."),
@ -53,6 +56,7 @@ static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
Options.DwarfVersion = DwarfVersion;
Options.ShowMCInst = ShowMCInst;
Options.ABIName = ABIName;
Options.MCFatalWarnings = FatalWarnings;
return Options;
}

View File

@ -10,8 +10,8 @@
#include "llvm/MC/MCTargetAsmParser.h"
using namespace llvm;
MCTargetAsmParser::MCTargetAsmParser()
: AvailableFeatures(0), ParsingInlineAsm(false)
MCTargetAsmParser::MCTargetAsmParser(MCTargetOptions const &MCOptions)
: AvailableFeatures(0), ParsingInlineAsm(false), MCOptions(MCOptions)
{
}

View File

@ -117,7 +117,7 @@ public:
};
AArch64AsmParser(MCSubtargetInfo &STI, MCAsmParser &Parser,
const MCInstrInfo &MII, const MCTargetOptions &Options)
: MCTargetAsmParser(), STI(STI) {
: MCTargetAsmParser(Options), STI(STI) {
MCAsmParserExtension::Initialize(Parser);
MCStreamer &S = getParser().getStreamer();
if (S.getTargetStreamer() == nullptr)

View File

@ -328,7 +328,7 @@ public:
AMDGPUAsmParser(MCSubtargetInfo &STI, MCAsmParser &_Parser,
const MCInstrInfo &MII,
const MCTargetOptions &Options)
: MCTargetAsmParser(), STI(STI), MII(MII), Parser(_Parser),
: MCTargetAsmParser(Options), STI(STI), MII(MII), Parser(_Parser),
ForcedEncodingSize(0){
if (STI.getFeatureBits().none()) {

View File

@ -349,7 +349,7 @@ public:
ARMAsmParser(MCSubtargetInfo &STI, MCAsmParser &Parser,
const MCInstrInfo &MII, const MCTargetOptions &Options)
: STI(STI), MII(MII), UC(Parser) {
: MCTargetAsmParser(Options), STI(STI), MII(MII), UC(Parser) {
MCAsmParserExtension::Initialize(Parser);
// Cache the MCRegisterInfo.

View File

@ -382,7 +382,7 @@ public:
MipsAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser,
const MCInstrInfo &MII, const MCTargetOptions &Options)
: MCTargetAsmParser(), STI(sti),
: MCTargetAsmParser(Options), STI(sti),
ABI(MipsABIInfo::computeTargetABI(Triple(sti.getTargetTriple()),
sti.getCPU(), Options)) {
MCAsmParserExtension::Initialize(parser);

View File

@ -293,7 +293,7 @@ class PPCAsmParser : public MCTargetAsmParser {
public:
PPCAsmParser(MCSubtargetInfo &STI, MCAsmParser &, const MCInstrInfo &MII,
const MCTargetOptions &Options)
: MCTargetAsmParser(), STI(STI), MII(MII) {
: MCTargetAsmParser(Options), STI(STI), MII(MII) {
// Check for 64-bit vs. 32-bit pointer mode.
Triple TheTriple(STI.getTargetTriple());
IsPPC64 = (TheTriple.getArch() == Triple::ppc64 ||

View File

@ -87,7 +87,7 @@ public:
SparcAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser,
const MCInstrInfo &MII,
const MCTargetOptions &Options)
: MCTargetAsmParser(), STI(sti), Parser(parser) {
: MCTargetAsmParser(Options), STI(sti), Parser(parser) {
// Initialize the set of available features.
setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
}

View File

@ -389,7 +389,7 @@ public:
SystemZAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser,
const MCInstrInfo &MII,
const MCTargetOptions &Options)
: MCTargetAsmParser(), STI(sti), Parser(parser) {
: MCTargetAsmParser(Options), STI(sti), Parser(parser) {
MCAsmParserExtension::Initialize(Parser);
// Initialize the set of available features.

View File

@ -800,7 +800,7 @@ private:
public:
X86AsmParser(MCSubtargetInfo &sti, MCAsmParser &Parser,
const MCInstrInfo &mii, const MCTargetOptions &Options)
: MCTargetAsmParser(), STI(sti), MII(mii), InstInfo(nullptr) {
: MCTargetAsmParser(Options), STI(sti), MII(mii), InstInfo(nullptr) {
// Initialize the set of available features.
setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));

View File

@ -0,0 +1,5 @@
# RUN: not llvm-mc --fatal-warnings %s 2>&1 | FileCheck %s
# XFAIL: hexagon
# CHECK: error: .warning directive invoked in source file
.warning