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:
parent
e05c4dfc42
commit
a7fc74fdc1
|
@ -244,6 +244,11 @@ public:
|
||||||
unsigned getID() const { return DiagID; }
|
unsigned getID() const { return DiagID; }
|
||||||
const FullSourceLoc &getLocation() const { return Loc; }
|
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; }
|
unsigned getNumArgs() const { return DiagObj->NumDiagArgs; }
|
||||||
|
|
||||||
/// getArgStr - Return the provided argument string specified by Idx.
|
/// getArgStr - Return the provided argument string specified by Idx.
|
||||||
|
|
Loading…
Reference in New Issue