Hi arielbernal, tareqsiraj,

sys::fs::make_absolute was turning '.' into '<path>/.' which broke
prefix comparison logic. Stripping these extra chars fixes the problem.

http://llvm-reviews.chandlerc.com/D1004

Files:
  cpp11-migrate/Core/IncludeExcludeInfo.cpp

Index: cpp11-migrate/Core/IncludeExcludeInfo.cpp
===================================================================
--- cpp11-migrate/Core/IncludeExcludeInfo.cpp
+++ cpp11-migrate/Core/IncludeExcludeInfo.cpp
@@ -14,6 +14,7 @@
 
//===----------------------------------------------------------------------===//
 
 #include "IncludeExcludeInfo.h"
+#include "clang/Tooling/Tooling.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -58,10 +59,18 @@
                                             E = Tokens.end();
        I != E; ++I) {
     // Convert each path to its absolute path.
-    SmallString<64> AbsolutePath = I->rtrim();
-    if (error_code Err = sys::fs::make_absolute(AbsolutePath))
+    SmallString<64> Path = I->rtrim();
+    if (error_code Err = sys::fs::make_absolute(Path))
       return Err;
-    List.push_back(std::string(AbsolutePath.str()));
+
+    // sys::fs::make_absolute will turn "." into "<path>/.". Need to strip
+    // that off.
+    if (Path.endswith("/."))
+      List.push_back(Path.slice(0, Path.size() - 2).str());
+    else
+      List.push_back(Path.str());
+
+    llvm::errs() << "Parse: " <<List.back() << "\n";
   }
   return error_code::success();
 }
Index: cpp11-migrate/Core/IncludeExcludeInfo.cpp
===================================================================
--- cpp11-migrate/Core/IncludeExcludeInfo.cpp
+++ cpp11-migrate/Core/IncludeExcludeInfo.cpp
@@ -14,6 +14,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "IncludeExcludeInfo.h"
+#include "clang/Tooling/Tooling.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -58,10 +59,18 @@
                                             E = Tokens.end();
        I != E; ++I) {
     // Convert each path to its absolute path.
-    SmallString<64> AbsolutePath = I->rtrim();
-    if (error_code Err = sys::fs::make_absolute(AbsolutePath))
+    SmallString<64> Path = I->rtrim();
+    if (error_code Err = sys::fs::make_absolute(Path))
       return Err;
-    List.push_back(std::string(AbsolutePath.str()));
+
+    // sys::fs::make_absolute will turn "." into "<path>/.". Need to strip
+    // that off.
+    if (Path.endswith("/."))
+      List.push_back(Path.slice(0, Path.size() - 2).str());
+    else
+      List.push_back(Path.str());
+
+    llvm::errs() << "Parse: " <<List.back() << "\n";
   }
   return error_code::success();
 }
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to