]> granicus.if.org Git - clang/commitdiff
Deprecate CXXScopeSpec::isSet() in favor of isNotEmpty() or isValid().
authorJeffrey Yasskin <jyasskin@google.com>
Wed, 7 Apr 2010 01:55:59 +0000 (01:55 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Wed, 7 Apr 2010 01:55:59 +0000 (01:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100600 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/DeclSpec.h

index f6f1eb936b7a90b3445cb2074da61a663717888c..e83edbb301804caa7c8d3f59a55e1b38c823d50e 100644 (file)
@@ -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() {