From bb95255e08c5d56616f5581118f5babe2c4e6ea6 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 4 Oct 2008 20:58:18 +0000 Subject: [PATCH] Bug fix, CPATH="" does not add '.' to search path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57072 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/InitHeaderSearch.cpp | 2 +- test/Driver/env-include-paths.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Driver/InitHeaderSearch.cpp b/lib/Driver/InitHeaderSearch.cpp index 3ebca8e175..a2fa826d0c 100644 --- a/lib/Driver/InitHeaderSearch.cpp +++ b/lib/Driver/InitHeaderSearch.cpp @@ -81,7 +81,7 @@ void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group, void InitHeaderSearch::AddEnvVarPaths(const char *Name) { const char* at = getenv(Name); - if (!at) + if (!at || *at == 0) // Empty string should not add '.' path. return; const char* delim = strchr(at, llvm::sys::PathSeparator); diff --git a/test/Driver/env-include-paths.c b/test/Driver/env-include-paths.c index de4ba5b1b7..91ca48070c 100644 --- a/test/Driver/env-include-paths.c +++ b/test/Driver/env-include-paths.c @@ -3,7 +3,6 @@ // RUN: env CPATH="xyz:xyz" clang -fsyntax-only -verify -DAS_SOURCE %s && // RUN: env CPATH="xyz::xyz" clang -fsyntax-only -verify -DSHOULD_FIND -DAS_SOURCE %s && // RUN: env CPATH="../Driver" clang -fsyntax-only -verify -DSHOULD_FIND -DAS_SOURCE %s -// XFAIL #ifdef AS_SOURCE #undef AS_SOURCE