forked from OSchip/llvm-project
Changed to using an "operator bool" instead of an "operator void*"
and avoid returning a pointer to the current object. In the new "operator bool" implementation, check the filename object first since many times we have FileSpec objects with a filename, yet no directory. llvm-svn: 139488
This commit is contained in:
parent
24756648e5
commit
6372d1cda2
|
@ -180,8 +180,7 @@ public:
|
|||
/// A pointer to this object if either the directory or filename
|
||||
/// is valid, NULL otherwise.
|
||||
//------------------------------------------------------------------
|
||||
operator
|
||||
void* () const;
|
||||
operator bool() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Logical NOT operator.
|
||||
|
|
|
@ -352,10 +352,9 @@ FileSpec::SetFile (const char *pathname, bool resolve)
|
|||
// if (file_spec)
|
||||
// {}
|
||||
//----------------------------------------------------------------------
|
||||
FileSpec::operator
|
||||
void*() const
|
||||
FileSpec::operator bool() const
|
||||
{
|
||||
return (m_directory || m_filename) ? const_cast<FileSpec*>(this) : NULL;
|
||||
return m_filename || m_directory;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue