Allow diagnostics to be used in bool context, like:

return Diag(...);

when the function returns bool.  This always evaluates to true.

llvm-svn: 59555
This commit is contained in:
Chris Lattner 2008-11-18 21:53:02 +00:00
parent e05c4dfc42
commit a7fc74fdc1
1 changed files with 5 additions and 0 deletions

View File

@ -243,6 +243,11 @@ public:
const Diagnostic *getDiags() const { return DiagObj; }
unsigned getID() const { return DiagID; }
const FullSourceLoc &getLocation() const { return Loc; }
/// Operator bool: conversion of DiagnosticInfo to bool always returns true.
/// This allows is to be used in boolean error contexts like:
/// return Diag(...);
operator bool() const { return true; }
unsigned getNumArgs() const { return DiagObj->NumDiagArgs; }