forked from OSchip/llvm-project
Parse and ignore #pragma runtime_checks in MS extensions mode (PR25138)
We already silently ignore the /RTC, which controls the same functionality. llvm-svn: 250099
This commit is contained in:
parent
a704d4bb27
commit
7357bbc6c3
|
@ -76,7 +76,7 @@ public:
|
|||
/// used to ignore particular pragmas.
|
||||
class EmptyPragmaHandler : public PragmaHandler {
|
||||
public:
|
||||
EmptyPragmaHandler();
|
||||
explicit EmptyPragmaHandler(StringRef Name = StringRef());
|
||||
|
||||
void HandlePragma(Preprocessor &PP, PragmaIntroducerKind Introducer,
|
||||
Token &FirstToken) override;
|
||||
|
|
|
@ -163,6 +163,7 @@ class Parser : public CodeCompletionHandler {
|
|||
std::unique_ptr<PragmaHandler> MSConstSeg;
|
||||
std::unique_ptr<PragmaHandler> MSCodeSeg;
|
||||
std::unique_ptr<PragmaHandler> MSSection;
|
||||
std::unique_ptr<PragmaHandler> MSRuntimeChecks;
|
||||
std::unique_ptr<PragmaHandler> OptimizeHandler;
|
||||
std::unique_ptr<PragmaHandler> LoopHintHandler;
|
||||
std::unique_ptr<PragmaHandler> UnrollHintHandler;
|
||||
|
|
|
@ -38,7 +38,7 @@ PragmaHandler::~PragmaHandler() {
|
|||
// EmptyPragmaHandler Implementation.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
EmptyPragmaHandler::EmptyPragmaHandler() {}
|
||||
EmptyPragmaHandler::EmptyPragmaHandler(StringRef Name) : PragmaHandler(Name) {}
|
||||
|
||||
void EmptyPragmaHandler::HandlePragma(Preprocessor &PP,
|
||||
PragmaIntroducerKind Introducer,
|
||||
|
|
|
@ -156,6 +156,10 @@ struct PragmaUnrollHintHandler : public PragmaHandler {
|
|||
Token &FirstToken) override;
|
||||
};
|
||||
|
||||
struct PragmaMSRuntimeChecksHandler : public EmptyPragmaHandler {
|
||||
PragmaMSRuntimeChecksHandler() : EmptyPragmaHandler("runtime_checks") {}
|
||||
};
|
||||
|
||||
} // end namespace
|
||||
|
||||
void Parser::initializePragmaHandlers() {
|
||||
|
@ -222,6 +226,8 @@ void Parser::initializePragmaHandlers() {
|
|||
PP.AddPragmaHandler(MSCodeSeg.get());
|
||||
MSSection.reset(new PragmaMSPragma("section"));
|
||||
PP.AddPragmaHandler(MSSection.get());
|
||||
MSRuntimeChecks.reset(new PragmaMSRuntimeChecksHandler());
|
||||
PP.AddPragmaHandler(MSRuntimeChecks.get());
|
||||
}
|
||||
|
||||
OptimizeHandler.reset(new PragmaOptimizeHandler(Actions));
|
||||
|
@ -288,6 +294,8 @@ void Parser::resetPragmaHandlers() {
|
|||
MSCodeSeg.reset();
|
||||
PP.RemovePragmaHandler(MSSection.get());
|
||||
MSSection.reset();
|
||||
PP.RemovePragmaHandler(MSRuntimeChecks.get());
|
||||
MSRuntimeChecks.reset();
|
||||
}
|
||||
|
||||
PP.RemovePragmaHandler("STDC", FPContractHandler.get());
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions
|
||||
// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -Wunknown-pragmas
|
||||
// RUN: not %clang_cc1 %s -fms-extensions -E | FileCheck %s
|
||||
// REQUIRES: non-ps4-sdk
|
||||
|
||||
|
@ -53,7 +53,7 @@ __pragma(comment(linker," bar=" BAR))
|
|||
|
||||
void f()
|
||||
{
|
||||
__pragma()
|
||||
__pragma() // expected-warning{{unknown pragma ignored}}
|
||||
// CHECK: #pragma
|
||||
|
||||
// If we ever actually *support* __pragma(warning(disable: x)),
|
||||
|
@ -159,3 +159,6 @@ void g() {}
|
|||
#pragma warning(default 321) // expected-warning {{expected ':'}}
|
||||
#pragma warning(asdf : 321) // expected-warning {{expected 'push', 'pop'}}
|
||||
#pragma warning(push, -1) // expected-warning {{requires a level between 0 and 4}}
|
||||
|
||||
// Test that runtime_checks is parsed but ignored.
|
||||
#pragma runtime_checks("sc", restore) // no-warning
|
||||
|
|
Loading…
Reference in New Issue