[cfe-commits] r100600 - /cfe/trunk/include/clang/Parse/DeclSpec.h

Jeffrey Yasskin jyasskin at google.com
Tue Apr 6 18:55:59 PDT 2010


Author: jyasskin
Date: Tue Apr  6 20:55:59 2010
New Revision: 100600

URL: http://llvm.org/viewvc/llvm-project?rev=100600&view=rev
Log:
Deprecate CXXScopeSpec::isSet() in favor of isNotEmpty() or isValid().

Modified:
    cfe/trunk/include/clang/Parse/DeclSpec.h

Modified: cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=100600&r1=100599&r2=100600&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Parse/DeclSpec.h Tue Apr  6 20:55:59 2010
@@ -27,9 +27,18 @@
   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 @@
   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() {





More information about the cfe-commits mailing list