From: Jeffrey Yasskin Date: Wed, 7 Apr 2010 01:55:59 +0000 (+0000) Subject: Deprecate CXXScopeSpec::isSet() in favor of isNotEmpty() or isValid(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=595f2698fe000b2c7703de8f6eafcd51366ec14a;p=clang Deprecate CXXScopeSpec::isSet() in favor of isNotEmpty() or isValid(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100600 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/DeclSpec.h b/include/clang/Parse/DeclSpec.h index f6f1eb936b..e83edbb301 100644 --- a/include/clang/Parse/DeclSpec.h +++ b/include/clang/Parse/DeclSpec.h @@ -27,9 +27,18 @@ namespace clang { class Preprocessor; class Declarator; struct TemplateIdAnnotation; - + /// CXXScopeSpec - Represents a C++ nested-name-specifier or a global scope -/// specifier. +/// specifier. These can be in 3 states: +/// 1) Not present, identified by isEmpty() +/// 2) Present, identified by isNotEmpty() +/// 2.a) Valid, idenified by isValid() +/// 2.b) Invalid, identified by isInvalid(). +/// +/// isSet() is deprecated because it mostly corresponded to "valid" but was +/// often used as if it meant "present". +/// +/// The actual scope is described by getScopeRep(). class CXXScopeSpec { SourceRange Range; void *ScopeRep; @@ -47,13 +56,18 @@ public: ActionBase::CXXScopeTy *getScopeRep() const { return ScopeRep; } void setScopeRep(ActionBase::CXXScopeTy *S) { ScopeRep = S; } + /// No scope specifier. bool isEmpty() const { return !Range.isValid(); } + /// A scope specifier is present, but may be valid or invalid. bool isNotEmpty() const { return !isEmpty(); } - /// isInvalid - An error occured during parsing of the scope specifier. + /// An error occured during parsing of the scope specifier. bool isInvalid() const { return isNotEmpty() && ScopeRep == 0; } + /// A scope specifier is present, and it refers to a real scope. + bool isValid() const { return isNotEmpty() && ScopeRep != 0; } - /// isSet - A scope specifier was resolved to a valid C++ scope. + /// Deprecated. Some call sites intend isNotEmpty() while others intend + /// isValid(). bool isSet() const { return ScopeRep != 0; } void clear() {