summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp16
-rw-r--r--clang/lib/Lex/Lexer.cpp4
-rw-r--r--clang/lib/Lex/Preprocessor.cpp4
-rw-r--r--clang/lib/Parse/Parser.cpp4
-rw-r--r--clang/lib/Sema/Sema.cpp2
-rw-r--r--clang/lib/Sema/Sema.h2
6 files changed, 17 insertions, 15 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index e83d4f37415..164ac1b6364 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -129,7 +129,7 @@ Diagnostic::Diagnostic(DiagnosticClient *client) : Client(client) {
NumDiagnostics = 0;
NumErrors = 0;
CustomDiagInfo = 0;
- NumDiagArgs = -1;
+ CurDiagID = ~0U;
}
Diagnostic::~Diagnostic() {
@@ -215,7 +215,9 @@ Diagnostic::Level Diagnostic::getDiagnosticLevel(unsigned DiagID) const {
/// ProcessDiag - This is the method used to report a diagnostic that is
/// finally fully formed.
-void Diagnostic::ProcessDiag(const DiagnosticInfo &Info) {
+void Diagnostic::ProcessDiag() {
+ DiagnosticInfo Info(this);
+
// Figure out the diagnostic level of this message.
Diagnostic::Level DiagLevel = getDiagnosticLevel(Info.getID());
@@ -347,25 +349,25 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const {
unsigned StrNo = *DiagStr++ - '0';
switch (getArgKind(StrNo)) {
- case DiagnosticInfo::ak_std_string: {
+ case Diagnostic::ak_std_string: {
const std::string &S = getArgStdStr(StrNo);
assert(ModifierLen == 0 && "No modifiers for strings yet");
OutStr.append(S.begin(), S.end());
break;
}
- case DiagnosticInfo::ak_c_string: {
+ case Diagnostic::ak_c_string: {
const char *S = getArgCStr(StrNo);
assert(ModifierLen == 0 && "No modifiers for strings yet");
OutStr.append(S, S + strlen(S));
break;
}
- case DiagnosticInfo::ak_identifierinfo: {
+ case Diagnostic::ak_identifierinfo: {
const IdentifierInfo *II = getArgIdentifier(StrNo);
assert(ModifierLen == 0 && "No modifiers for strings yet");
OutStr.append(II->getName(), II->getName() + II->getLength());
break;
}
- case DiagnosticInfo::ak_sint: {
+ case Diagnostic::ak_sint: {
int Val = getArgSInt(StrNo);
if (ModifierIs(Modifier, ModifierLen, "select")) {
@@ -380,7 +382,7 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const {
}
break;
}
- case DiagnosticInfo::ak_uint: {
+ case Diagnostic::ak_uint: {
unsigned Val = getArgUInt(StrNo);
if (ModifierIs(Modifier, ModifierLen, "select")) {
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index eebdd1e2eb3..4c25287b07c 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -309,9 +309,9 @@ SourceLocation Lexer::getSourceLocation(const char *Loc) const {
/// Diag - Forwarding function for diagnostics. This translate a source
/// position in the current buffer into a SourceLocation object for rendering.
-DiagnosticInfo Lexer::Diag(const char *Loc, unsigned DiagID) const {
+DiagnosticBuilder Lexer::Diag(const char *Loc, unsigned DiagID) const {
if (LexingRawMode && Diagnostic::isBuiltinNoteWarningOrExtension(DiagID))
- return DiagnosticInfo(0, FullSourceLoc(), 0);
+ return DiagnosticBuilder();
return PP->Diag(getSourceLocation(Loc), DiagID);
}
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 3d0b4d0da58..5f8f3517fef 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -117,11 +117,11 @@ Preprocessor::~Preprocessor() {
/// Diag - Forwarding function for diagnostics. This emits a diagnostic at
/// the specified Token's location, translating the token's start
/// position in the current buffer into a SourcePosition object for rendering.
-DiagnosticInfo Preprocessor::Diag(SourceLocation Loc, unsigned DiagID) {
+DiagnosticBuilder Preprocessor::Diag(SourceLocation Loc, unsigned DiagID) {
return Diags.Report(getFullLoc(Loc), DiagID);
}
-DiagnosticInfo Preprocessor::Diag(const Token &Tok, unsigned DiagID) {
+DiagnosticBuilder Preprocessor::Diag(const Token &Tok, unsigned DiagID) {
return Diags.Report(getFullLoc(Tok.getLocation()), DiagID);
}
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 86c29760d47..ae75266e041 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -41,11 +41,11 @@ Parser::Parser(Preprocessor &pp, Action &actions)
Action::~Action() {}
-DiagnosticInfo Parser::Diag(SourceLocation Loc, unsigned DiagID) {
+DiagnosticBuilder Parser::Diag(SourceLocation Loc, unsigned DiagID) {
return Diags.Report(FullSourceLoc(Loc,PP.getSourceManager()), DiagID);
}
-DiagnosticInfo Parser::Diag(const Token &Tok, unsigned DiagID) {
+DiagnosticBuilder Parser::Diag(const Token &Tok, unsigned DiagID) {
return Diag(Tok.getLocation(), DiagID);
}
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 44e589179e4..7c498440c6e 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -157,7 +157,7 @@ void Sema::ActOnEndOfTranslationUnit() {
// Helper functions.
//===----------------------------------------------------------------------===//
-DiagnosticInfo Sema::Diag(SourceLocation Loc, unsigned DiagID) {
+DiagnosticBuilder Sema::Diag(SourceLocation Loc, unsigned DiagID) {
return PP.getDiagnostics().Report(FullSourceLoc(Loc, PP.getSourceManager()),
DiagID);
}
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index d569994d167..6d9e5820666 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -226,7 +226,7 @@ public:
const LangOptions &getLangOptions() const;
/// The primitive diagnostic helpers.
- DiagnosticInfo Diag(SourceLocation Loc, unsigned DiagID);
+ DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID);
virtual void DeleteExpr(ExprTy *E);
virtual void DeleteStmt(StmtTy *S);
OpenPOWER on IntegriCloud