[clang-tidy] Pass absolute path to OptionsProvider::getOptions/getRawOptions.

Summary:
Although there is no guarantee of getOptions/getRawOptions receiving an
absolute path, we try to make it if possible. So FileOptionProvider subclasses
don't have to convert the path to an absolute path.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D22154

llvm-svn: 275051
diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
index d295917..eed7d31 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -313,13 +313,19 @@
   if (!PathList.empty()) {
     FileName = PathList.front();
   }
-  ClangTidyOptions EffectiveOptions = OptionsProvider->getOptions(FileName);
+
+  SmallString<256> FilePath(FileName);
+  if (std::error_code EC = llvm::sys::fs::make_absolute(FilePath)) {
+    llvm::errs() << "Can't make absolute path from " << FileName << ": "
+                 << EC.message() << "\n";
+  }
+  ClangTidyOptions EffectiveOptions = OptionsProvider->getOptions(FilePath);
   std::vector<std::string> EnabledChecks = getCheckNames(EffectiveOptions);
 
   if (ExplainConfig) {
     //FIXME: Show other ClangTidyOptions' fields, like ExtraArg.
     std::vector<clang::tidy::ClangTidyOptionsProvider::OptionsSource>
-        RawOptions = OptionsProvider->getRawOptions(FileName);
+        RawOptions = OptionsProvider->getRawOptions(FilePath);
     for (const std::string &Check : EnabledChecks) {
       for (auto It = RawOptions.rbegin(); It != RawOptions.rend(); ++It) {
         if (It->first.Checks && GlobList(*It->first.Checks).contains(Check)) {