Use LLVM's preferred current_path API instead of calling getcwd(3) directly.

The existing code also failed to allocate a buffer for it so getcwd corrupted
the stack. sys::fs::current_path takes care of the memory management.

git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@180669 91177308-0d34-0410-b5e6-96231b3b80d8
Exit early when $PWD isn't set. Remove unused unistd.h include.

git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@180670 91177308-0d34-0410-b5e6-96231b3b80d8