[PATCH] cpp11-migrate: Fix parsing of '.' for header include/excludes
Edwin Vane
edwin.vane at intel.com
Tue Jun 18 11:46:20 PDT 2013
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();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1004.1.patch
Type: text/x-patch
Size: 1261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130618/b4f7d898/attachment.bin>
More information about the cfe-commits
mailing list