r200265 - Remove dead code; MacroDirective's IsHidden flag is always false.

Richard Smith richard-llvm at metafoo.co.uk
Mon Jan 27 15:54:39 PST 2014


Author: rsmith
Date: Mon Jan 27 17:54:39 2014
New Revision: 200265

URL: http://llvm.org/viewvc/llvm-project?rev=200265&view=rev
Log:
Remove dead code; MacroDirective's IsHidden flag is always false.

Modified:
    cfe/trunk/include/clang/Lex/MacroInfo.h
    cfe/trunk/lib/Lex/MacroInfo.cpp
    cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Lex/MacroInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/MacroInfo.h?rev=200265&r1=200264&r2=200265&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/MacroInfo.h (original)
+++ cfe/trunk/include/clang/Lex/MacroInfo.h Mon Jan 27 17:54:39 2014
@@ -21,7 +21,7 @@
 #include <cassert>
 
 namespace clang {
-  class Preprocessor;
+class Preprocessor;
 
 /// \brief Encapsulates the data about a macro definition (e.g. its tokens).
 ///
@@ -338,12 +338,6 @@ protected:
   /// \brief True if the macro directive was loaded from a PCH file.
   bool IsFromPCH : 1;
 
-  /// \brief Whether the macro directive is currently "hidden".
-  ///
-  /// Note that this is transient state that is never serialized to the AST
-  /// file.
-  bool IsHidden : 1;
-
   // Used by DefMacroDirective -----------------------------------------------//
 
   /// \brief True if this macro was imported from a module.
@@ -360,10 +354,10 @@ protected:
   bool IsPublic : 1;
 
   MacroDirective(Kind K, SourceLocation Loc)
-    : Previous(0), Loc(Loc), MDKind(K), IsFromPCH(false), IsHidden(false),
+    : Previous(0), Loc(Loc), MDKind(K), IsFromPCH(false),
       IsImported(false), IsAmbiguous(false),
       IsPublic(true) {
-  }
+  } 
 
 public:
   Kind getKind() const { return Kind(MDKind); }
@@ -386,12 +380,6 @@ public:
 
   void setIsFromPCH() { IsFromPCH = true; }
 
-  /// \brief Determine whether this macro directive is hidden.
-  bool isHidden() const { return IsHidden; }
-
-  /// \brief Set whether this macro directive is hidden.
-  void setHidden(bool Val) { IsHidden = Val; }
-
   class DefInfo {
     DefMacroDirective *DefDirective;
     SourceLocation UndefLoc;
@@ -423,31 +411,31 @@ public:
 
     LLVM_EXPLICIT operator bool() const { return isValid(); }
 
-    inline DefInfo getPreviousDefinition(bool AllowHidden = false);
-    const DefInfo getPreviousDefinition(bool AllowHidden = false) const {
-      return const_cast<DefInfo*>(this)->getPreviousDefinition(AllowHidden);
+    inline DefInfo getPreviousDefinition();
+    const DefInfo getPreviousDefinition() const {
+      return const_cast<DefInfo*>(this)->getPreviousDefinition();
     }
   };
 
   /// \brief Traverses the macro directives history and returns the next
   /// macro definition directive along with info about its undefined location
   /// (if there is one) and if it is public or private.
-  DefInfo getDefinition(bool AllowHidden = false);
-  const DefInfo getDefinition(bool AllowHidden = false) const {
-    return const_cast<MacroDirective*>(this)->getDefinition(AllowHidden);
+  DefInfo getDefinition();
+  const DefInfo getDefinition() const {
+    return const_cast<MacroDirective*>(this)->getDefinition();
   }
 
-  bool isDefined(bool AllowHidden = false) const {
-    if (const DefInfo Def = getDefinition(AllowHidden))
+  bool isDefined() const {
+    if (const DefInfo Def = getDefinition())
       return !Def.isUndefined();
     return false;
   }
 
-  const MacroInfo *getMacroInfo(bool AllowHidden = false) const {
-    return getDefinition(AllowHidden).getMacroInfo();
+  const MacroInfo *getMacroInfo() const {
+    return getDefinition().getMacroInfo();
   }
-  MacroInfo *getMacroInfo(bool AllowHidden = false) {
-    return getDefinition(AllowHidden).getMacroInfo();
+  MacroInfo *getMacroInfo() {
+    return getDefinition().getMacroInfo();
   }
 
   /// \brief Find macro definition active in the specified source location. If
@@ -538,10 +526,10 @@ inline MacroInfo *MacroDirective::DefInf
 }
 
 inline MacroDirective::DefInfo
-MacroDirective::DefInfo::getPreviousDefinition(bool AllowHidden) {
+MacroDirective::DefInfo::getPreviousDefinition() {
   if (isInvalid() || DefDirective->getPrevious() == 0)
     return DefInfo();
-  return DefDirective->getPrevious()->getDefinition(AllowHidden);
+  return DefDirective->getPrevious()->getDefinition();
 }
 
 }  // end namespace clang

Modified: cfe/trunk/lib/Lex/MacroInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroInfo.cpp?rev=200265&r1=200264&r2=200265&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/MacroInfo.cpp (original)
+++ cfe/trunk/lib/Lex/MacroInfo.cpp Mon Jan 27 17:54:39 2014
@@ -125,14 +125,11 @@ bool MacroInfo::isIdenticalTo(const Macr
   return true;
 }
 
-MacroDirective::DefInfo MacroDirective::getDefinition(bool AllowHidden) {
+MacroDirective::DefInfo MacroDirective::getDefinition() {
   MacroDirective *MD = this;
   SourceLocation UndefLoc;
   Optional<bool> isPublic;
   for (; MD; MD = MD->getPrevious()) {
-    if (!AllowHidden && MD->isHidden())
-      continue;
-
     if (DefMacroDirective *DefMD = dyn_cast<DefMacroDirective>(MD))
       return DefInfo(DefMD, UndefLoc,
                      !isPublic.hasValue() || isPublic.getValue());

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=200265&r1=200264&r2=200265&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Mon Jan 27 17:54:39 2014
@@ -1951,8 +1951,6 @@ void ASTWriter::WritePreprocessor(const
 
     // Emit the macro directives in reverse source order.
     for (; MD; MD = MD->getPrevious()) {
-      if (MD->isHidden())
-        continue;
       if (shouldIgnoreMacro(MD, IsModule, PP))
         continue;
 
@@ -2995,9 +2993,6 @@ class ASTIdentifierTableTrait {
     bool isUndefined = false;
     Optional<bool> isPublic;
     for (; MD; MD = MD->getPrevious()) {
-      if (MD->isHidden())
-        continue;
-
       SubmoduleID ThisModID = getSubmoduleID(MD);
       if (ThisModID == 0) {
         isUndefined = false;





More information about the cfe-commits mailing list