summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/VerifyDiagnosticConsumer.cpp')
-rw-r--r--clang/lib/Frontend/VerifyDiagnosticConsumer.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
index 9df39782abb..856b51db3dc 100644
--- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -30,8 +30,9 @@ typedef VerifyDiagnosticConsumer::ExpectedData ExpectedData;
VerifyDiagnosticConsumer::VerifyDiagnosticConsumer(DiagnosticsEngine &_Diags)
: Diags(_Diags),
PrimaryClient(Diags.getClient()), OwnsPrimaryClient(Diags.ownsClient()),
- Buffer(new TextDiagnosticBuffer()), CurrentPreprocessor(0),
- LangOpts(0), SrcManager(0), ActiveSourceFiles(0), Status(HasNoDirectives)
+ Buffer(new TextDiagnosticBuffer()), CurrentPreprocessor(nullptr),
+ LangOpts(nullptr), SrcManager(nullptr), ActiveSourceFiles(0),
+ Status(HasNoDirectives)
{
Diags.takeClient();
if (Diags.hasSourceManager())
@@ -41,7 +42,7 @@ VerifyDiagnosticConsumer::VerifyDiagnosticConsumer(DiagnosticsEngine &_Diags)
VerifyDiagnosticConsumer::~VerifyDiagnosticConsumer() {
assert(!ActiveSourceFiles && "Incomplete parsing of source files!");
assert(!CurrentPreprocessor && "CurrentPreprocessor should be invalid!");
- SrcManager = 0;
+ SrcManager = nullptr;
CheckDiagnostics();
Diags.takeClient();
if (OwnsPrimaryClient)
@@ -104,8 +105,8 @@ void VerifyDiagnosticConsumer::EndSourceFile() {
// Check diagnostics once last file completed.
CheckDiagnostics();
- CurrentPreprocessor = 0;
- LangOpts = 0;
+ CurrentPreprocessor = nullptr;
+ LangOpts = nullptr;
}
}
@@ -202,7 +203,7 @@ class ParseHelper
{
public:
ParseHelper(StringRef S)
- : Begin(S.begin()), End(S.end()), C(Begin), P(Begin), PEnd(NULL) { }
+ : Begin(S.begin()), End(S.end()), C(Begin), P(Begin), PEnd(nullptr) {}
// Return true if string literal is next.
bool Next(StringRef S) {
@@ -325,15 +326,15 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM,
PH.Advance();
// Next token: { error | warning | note }
- DirectiveList* DL = NULL;
+ DirectiveList *DL = nullptr;
if (PH.Next("error"))
- DL = ED ? &ED->Errors : NULL;
+ DL = ED ? &ED->Errors : nullptr;
else if (PH.Next("warning"))
- DL = ED ? &ED->Warnings : NULL;
+ DL = ED ? &ED->Warnings : nullptr;
else if (PH.Next("remark"))
- DL = ED ? &ED->Remarks : NULL;
+ DL = ED ? &ED->Remarks : nullptr;
else if (PH.Next("note"))
- DL = ED ? &ED->Notes : NULL;
+ DL = ED ? &ED->Notes : nullptr;
else if (PH.Next("no-diagnostics")) {
if (Status == VerifyDiagnosticConsumer::HasOtherExpectedDirectives)
Diags.Report(Pos, diag::err_verify_invalid_no_diags)
@@ -397,8 +398,8 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM,
// Lookup file via Preprocessor, like a #include.
const DirectoryLookup *CurDir;
- const FileEntry *FE = PP->LookupFile(Pos, Filename, false, NULL, CurDir,
- NULL, NULL, 0);
+ const FileEntry *FE = PP->LookupFile(Pos, Filename, false, nullptr,
+ CurDir, nullptr, nullptr, nullptr);
if (!FE) {
Diags.Report(Pos.getLocWithOffset(PH.C-PH.Begin),
diag::err_verify_missing_file) << Filename << KindStr;
@@ -596,7 +597,8 @@ static bool findDirectives(SourceManager &SM, FileID FID,
if (Comment.empty()) continue;
// Find first directive.
- if (ParseDirective(Comment, 0, SM, 0, Tok.getLocation(), Status))
+ if (ParseDirective(Comment, nullptr, SM, nullptr, Tok.getLocation(),
+ Status))
return true;
}
return false;
@@ -840,11 +842,11 @@ void VerifyDiagnosticConsumer::CheckDiagnostics() {
// Check that the expected diagnostics occurred.
NumErrors += CheckResults(Diags, *SrcManager, *Buffer, ED);
} else {
- NumErrors += (PrintUnexpected(Diags, 0, Buffer->err_begin(),
+ NumErrors += (PrintUnexpected(Diags, nullptr, Buffer->err_begin(),
Buffer->err_end(), "error") +
- PrintUnexpected(Diags, 0, Buffer->warn_begin(),
+ PrintUnexpected(Diags, nullptr, Buffer->warn_begin(),
Buffer->warn_end(), "warn") +
- PrintUnexpected(Diags, 0, Buffer->note_begin(),
+ PrintUnexpected(Diags, nullptr, Buffer->note_begin(),
Buffer->note_end(), "note"));
}
OpenPOWER on IntegriCloud