r173853 - [Frontend] Factor out helper function, for clarity.
Daniel Dunbar
daniel at zuster.org
Tue Jan 29 15:59:37 PST 2013
Author: ddunbar
Date: Tue Jan 29 17:59:37 2013
New Revision: 173853
URL: http://llvm.org/viewvc/llvm-project?rev=173853&view=rev
Log:
[Frontend] Factor out helper function, for clarity.
Modified:
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=173853&r1=173852&r2=173853&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Tue Jan 29 17:59:37 2013
@@ -103,6 +103,14 @@ public:
} // end anonymous namespace.
+static bool CanPrefixSysroot(StringRef Path) {
+#if defined(_WIN32)
+ return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
+#else
+ return llvm::sys::path::is_absolute(Path);
+#endif
+}
+
void InitHeaderSearch::AddPath(const Twine &Path,
IncludeDirGroup Group, bool isCXXAware,
bool isFramework, bool IgnoreSysRoot) {
@@ -115,16 +123,9 @@ void InitHeaderSearch::AddPath(const Twi
// Handle isysroot.
if ((Group == System || Group == CXXSystem) && !IgnoreSysRoot &&
-#if defined(_WIN32)
- !MappedPathStr.empty() &&
- llvm::sys::path::is_separator(MappedPathStr[0]) &&
-#else
- llvm::sys::path::is_absolute(MappedPathStr) &&
-#endif
- IsNotEmptyOrRoot) {
+ CanPrefixSysroot(MappedPathStr) && IsNotEmptyOrRoot) {
MappedPathStorage.clear();
- MappedPathStr =
- (IncludeSysroot + Path).toStringRef(MappedPathStorage);
+ MappedPathStr = (IncludeSysroot + Path).toStringRef(MappedPathStorage);
}
// Compute the DirectoryLookup type.
More information about the cfe-commits
mailing list