diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-02-09 22:11:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-02-09 22:11:23 +0000 |
commit | 025feadb973272d5c5097bb72cb2f6fef44474d3 (patch) | |
tree | 439433d25e19da46c19b50ef7638090c96526bb8 /include/llvm/Support/PathV2.h | |
parent | a372d16f92392bb4cd4184783466f0300a51a9ae (diff) | |
download | llvm-025feadb973272d5c5097bb72cb2f6fef44474d3.tar.gz llvm-025feadb973272d5c5097bb72cb2f6fef44474d3.tar.bz2 llvm-025feadb973272d5c5097bb72cb2f6fef44474d3.tar.xz |
Add llvm::sys::path::canonical(), which provides the canonicalized
name of a path, after resolving symbolic links and eliminating excess
path elements such as "foo/../" and "./".
This routine still needs a Windows implementation, but I don't have a
Windows machine available. Help? Please?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PathV2.h')
-rw-r--r-- | include/llvm/Support/PathV2.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Support/PathV2.h b/include/llvm/Support/PathV2.h index 3866e410e6..976fa6a7b2 100644 --- a/include/llvm/Support/PathV2.h +++ b/include/llvm/Support/PathV2.h @@ -244,6 +244,15 @@ const StringRef filename(StringRef path); /// @result The stem of \a path. const StringRef stem(StringRef path); +/// Convert path to a canonical form, resolving symbolic links and removing +/// unnecessary path elements (e.g., "foo/../", "./"). +/// +/// @param path A path that is going to be canonicalized by resolving symlinks +/// and removing unnecessary path elements (e.g., "./"). +/// +/// @param buffer The resulting canonical path. +void canonical(const char *path, SmallVectorImpl<char> &result); + /// @brief Get extension. /// /// If filename contains a dot but not solely one or two dots, result is the |