[clang-tools-extra] r187746 - Reverting r187736. It broke some public bots:

Arnold Schwaighofer aschwaighofer at apple.com
Mon Aug 5 15:03:41 PDT 2013


Author: arnolds
Date: Mon Aug  5 17:03:41 2013
New Revision: 187746

URL: http://llvm.org/viewvc/llvm-project?rev=187746&view=rev
Log:
Reverting r187736. It broke some public bots:

http://lab.llvm.org:8011/builders/clang-native-arm-cortex-a9/builds/10248
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/3327


Modified:
    clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp

Modified: clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp?rev=187746&r1=187745&r2=187746&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp (original)
+++ clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp Mon Aug  5 17:03:41 2013
@@ -818,12 +818,8 @@ public:
     if (HeaderPath.startswith("<"))
       return;
     HeaderHandle H = addHeader(HeaderPath);
-    if (H != getCurrentHeaderHandle()) {
-      // Check for nested header.
-      if (!InNestedHeader)
-        InNestedHeader = isHeaderHandleInStack(H);
+    if (H != getCurrentHeaderHandle())
       pushHeaderHandle(H);
-    }
   }
   // Handle exiting a header source file.
   void handleHeaderExit(llvm::StringRef HeaderPath) {
@@ -835,7 +831,6 @@ public:
       while ((H != getCurrentHeaderHandle()) && (HeaderStack.size() != 0))
         popHeaderHandle();
     }
-    InNestedHeader = false;
   }
 
   // Lookup/add string.
@@ -844,13 +839,11 @@ public:
   // Get the handle of a header file entry.
   // Return HeaderHandleInvalid if not found.
   HeaderHandle findHeaderHandle(llvm::StringRef HeaderPath) const {
-    std::string CanonicalPath(HeaderPath);
-    std::replace(CanonicalPath.begin(), CanonicalPath.end(), '\\', '/');
     HeaderHandle H = 0;
     for (std::vector<StringHandle>::const_iterator I = HeaderPaths.begin(),
                                                    E = HeaderPaths.end();
          I != E; ++I, ++H) {
-      if (**I == CanonicalPath)
+      if (**I == HeaderPath)
         return H;
     }
     return HeaderHandleInvalid;
@@ -859,12 +852,12 @@ public:
   // Add a new header file entry, or return existing handle.
   // Return the header handle.
   HeaderHandle addHeader(llvm::StringRef HeaderPath) {
-    std::string CanonicalPath(HeaderPath);
-    std::replace(CanonicalPath.begin(), CanonicalPath.end(), '\\', '/');
-    HeaderHandle H = findHeaderHandle(CanonicalPath);
+    std::string canonicalPath(HeaderPath);
+    std::replace(canonicalPath.begin(), canonicalPath.end(), '\\', '/');
+    HeaderHandle H = findHeaderHandle(canonicalPath);
     if (H == HeaderHandleInvalid) {
       H = HeaderPaths.size();
-      HeaderPaths.push_back(addString(CanonicalPath));
+      HeaderPaths.push_back(addString(canonicalPath));
     }
     return H;
   }
@@ -1000,9 +993,6 @@ public:
                                   bool ConditionValue,
                                   llvm::StringRef ConditionUnexpanded,
                                   InclusionPathHandle InclusionPathHandle) {
-    // Ignore header guards, assuming the header guard is the only conditional.
-    if (InNestedHeader)
-      return;
     StringHandle ConditionUnexpandedHandle(addString(ConditionUnexpanded));
     PPItemKey InstanceKey(PP, ConditionUnexpandedHandle, H, InstanceLoc);
     ConditionalExpansionMapIter I = ConditionalExpansions.find(InstanceKey);
@@ -1012,8 +1002,7 @@ public:
           getSourceLocationString(PP, InstanceLoc) + ":\n" +
           getSourceLine(PP, InstanceLoc) + "\n";
       ConditionalExpansions[InstanceKey] =
-          ConditionalTracker(DirectiveKind, ConditionValue,
-                             ConditionUnexpandedHandle,
+          ConditionalTracker(DirectiveKind, ConditionValue, ConditionUnexpandedHandle,
                              InclusionPathHandle);
     } else {
       // We've seen the conditional before.  Get its tracker.
@@ -1168,7 +1157,6 @@ private:
   InclusionPathHandle CurrentInclusionPathHandle;
   MacroExpansionMap MacroExpansions;
   ConditionalExpansionMap ConditionalExpansions;
-  bool InNestedHeader;
 };
 
 // PreprocessorTracker functions.
@@ -1192,12 +1180,10 @@ void PreprocessorCallbacks::FileChanged(
     PPTracker.handleHeaderEntry(PP, getSourceLocationFile(PP, Loc));
     break;
   case ExitFile:
-    {
-      const clang::FileEntry *F =
-        PP.getSourceManager().getFileEntryForID(PrevFID);
-      if (F != NULL)
-        PPTracker.handleHeaderExit(F->getName());
-    }
+    if (PrevFID.isInvalid())
+      PPTracker.handleHeaderExit(RootHeaderFile);
+    else
+      PPTracker.handleHeaderExit(getSourceLocationFile(PP, Loc));
     break;
   case SystemHeaderPragma:
   case RenameFile:





More information about the cfe-commits mailing list