From 63b4b456be050968c2eb6ed77ade88dd25c8e820 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 15 Mar 2011 02:32:36 +0000 Subject: [PATCH] lib/Frontend/InitHeaderSearch.cpp: Introduce AddMinGW64CXXPaths(Base) for x86_64-w64-mingw32. llvm-svn: 127652 --- clang/lib/Frontend/InitHeaderSearch.cpp | 36 ++++++++++++++++--------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index 60c3e9c4d0b8..78634d89826d 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -76,6 +76,10 @@ public: llvm::StringRef Arch, llvm::StringRef Version); + /// AddMinGW64CXXPaths - Add the necessary paths to support + /// libstdc++ of x86_64-w64-mingw32 aka mingw-w64. + void AddMinGW64CXXPaths(llvm::StringRef Base); + /// AddDelimitedPaths - Add a list of paths delimited by the system PATH /// separator. The processing follows that of the CPATH variable for gcc. void AddDelimitedPaths(llvm::StringRef String); @@ -207,6 +211,15 @@ void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, CXXSystem, true, false, false); } +void InitHeaderSearch::AddMinGW64CXXPaths(llvm::StringRef Base) { + AddPath(Base, + CXXSystem, true, false, false); + AddPath(Base + "/x86_64-w64-mingw32", + CXXSystem, true, false, false); + AddPath(Base + "/backward", + CXXSystem, true, false, false); +} + // FIXME: This probably should goto to some platform utils place. #ifdef _MSC_VER @@ -534,6 +547,10 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, AddPath("/usr/include/w32api", System, true, false, false); break; case llvm::Triple::MinGW32: + // FIXME: We should be aware of i686-w64-mingw32. + if (triple.getArch() == llvm::Triple::x86_64) + AddPath("c:/mingw/x86_64-w64-mingw32/include", + System, true, false, false); AddPath("/mingw/include", System, true, false, false); AddPath("c:/mingw/include", System, true, false, false); break; @@ -571,18 +588,13 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4"); break; case llvm::Triple::MinGW32: - // mingw-w64-20110207 - AddPath("c:/MinGW/include/c++/4.5.3", CXXSystem, true, false, false); - AddPath("c:/MinGW/include/c++/4.5.3/x86_64-w64-mingw32", CXXSystem, true, - false, false); - AddPath("c:/MinGW/include/c++/4.5.3/backward", CXXSystem, true, false, - false); - // mingw-w64-20101129 - AddPath("c:/MinGW/include/c++/4.5.2", CXXSystem, true, false, false); - AddPath("c:/MinGW/include/c++/4.5.2/x86_64-w64-mingw32", CXXSystem, true, - false, false); - AddPath("c:/MinGW/include/c++/4.5.2/backward", CXXSystem, true, false, - false); + // FIXME: We should be aware of i686-w64-mingw32. + if (triple.getArch() == llvm::Triple::x86_64) { + // mingw-w64-20110207 + AddMinGW64CXXPaths("c:/mingw/x86_64-w64-mingw32/include/c++/4.5.3"); + // mingw-w64-20101129 + AddMinGW64CXXPaths("c:/mingw/x86_64-w64-mingw32/include/c++/4.5.2"); + } // Try gcc 4.5.2 (MSYS) AddMinGWCPlusPlusIncludePaths("/mingw/lib/gcc", "mingw32", "4.5.2"); // Try gcc 4.5.0