2010-07-25 11:12:58 +08:00
|
|
|
//===--- InitHeaderSearch.cpp - Initialize header search paths ------------===//
|
2008-08-22 17:25:22 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the InitHeaderSearch class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-02-04 06:48:20 +08:00
|
|
|
#ifdef HAVE_CLANG_CONFIG_H
|
|
|
|
# include "clang/Config/config.h"
|
|
|
|
#endif
|
|
|
|
|
2009-11-10 07:02:47 +08:00
|
|
|
#include "clang/Frontend/Utils.h"
|
2008-08-22 17:25:22 +08:00
|
|
|
#include "clang/Basic/FileManager.h"
|
|
|
|
#include "clang/Basic/LangOptions.h"
|
2009-11-07 12:20:50 +08:00
|
|
|
#include "clang/Frontend/HeaderSearchOptions.h"
|
|
|
|
#include "clang/Lex/HeaderSearch.h"
|
2008-08-22 17:25:22 +08:00
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
2009-11-13 13:13:58 +08:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2009-11-12 13:48:41 +08:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2009-11-10 07:02:47 +08:00
|
|
|
#include "llvm/ADT/Triple.h"
|
2009-12-08 20:38:20 +08:00
|
|
|
#include "llvm/ADT/Twine.h"
|
2009-08-24 06:45:33 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2010-11-30 02:12:39 +08:00
|
|
|
#include "llvm/Support/Path.h"
|
2008-09-05 17:41:20 +08:00
|
|
|
#include "llvm/Config/config.h"
|
2009-10-13 04:50:45 +08:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define WIN32_LEAN_AND_MEAN 1
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
2008-08-22 17:25:22 +08:00
|
|
|
using namespace clang;
|
2009-11-10 07:02:47 +08:00
|
|
|
using namespace clang::frontend;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
/// InitHeaderSearch - This class makes it easier to set the search paths of
|
|
|
|
/// a HeaderSearch object. InitHeaderSearch stores several search path lists
|
|
|
|
/// internally, which can be sent to a HeaderSearch object in one swoop.
|
|
|
|
class InitHeaderSearch {
|
|
|
|
std::vector<DirectoryLookup> IncludeGroup[4];
|
|
|
|
HeaderSearch& Headers;
|
|
|
|
bool Verbose;
|
2010-12-26 04:09:27 +08:00
|
|
|
std::string IncludeSysroot;
|
|
|
|
bool IsNotEmptyOrRoot;
|
2009-11-10 07:02:47 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2010-11-15 15:15:26 +08:00
|
|
|
InitHeaderSearch(HeaderSearch &HS, bool verbose, llvm::StringRef sysroot)
|
2010-12-26 04:09:27 +08:00
|
|
|
: Headers(HS), Verbose(verbose), IncludeSysroot(sysroot),
|
|
|
|
IsNotEmptyOrRoot(!(sysroot.empty() || sysroot == "/")) {
|
2010-11-15 15:15:26 +08:00
|
|
|
}
|
2009-11-10 07:02:47 +08:00
|
|
|
|
|
|
|
/// AddPath - Add the specified path to the specified group list.
|
2009-12-08 20:38:20 +08:00
|
|
|
void AddPath(const llvm::Twine &Path, IncludeDirGroup Group,
|
2009-11-10 07:02:47 +08:00
|
|
|
bool isCXXAware, bool isUserSupplied,
|
|
|
|
bool isFramework, bool IgnoreSysRoot = false);
|
|
|
|
|
2010-05-06 01:00:31 +08:00
|
|
|
/// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu
|
2009-11-10 07:02:47 +08:00
|
|
|
/// libstdc++.
|
2009-12-08 20:38:20 +08:00
|
|
|
void AddGnuCPlusPlusIncludePaths(llvm::StringRef Base,
|
|
|
|
llvm::StringRef ArchDir,
|
|
|
|
llvm::StringRef Dir32,
|
|
|
|
llvm::StringRef Dir64,
|
2009-11-10 07:02:47 +08:00
|
|
|
const llvm::Triple &triple);
|
|
|
|
|
2010-12-22 00:45:42 +08:00
|
|
|
/// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a MinGW
|
2009-11-10 07:02:47 +08:00
|
|
|
/// libstdc++.
|
2009-12-08 20:38:20 +08:00
|
|
|
void AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base,
|
|
|
|
llvm::StringRef Arch,
|
|
|
|
llvm::StringRef Version);
|
2009-11-10 07:02:47 +08:00
|
|
|
|
|
|
|
/// AddDelimitedPaths - Add a list of paths delimited by the system PATH
|
|
|
|
/// separator. The processing follows that of the CPATH variable for gcc.
|
2009-12-08 20:11:06 +08:00
|
|
|
void AddDelimitedPaths(llvm::StringRef String);
|
2009-11-10 07:02:47 +08:00
|
|
|
|
|
|
|
// AddDefaultCIncludePaths - Add paths that should always be searched.
|
2010-05-17 03:03:52 +08:00
|
|
|
void AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|
|
|
const HeaderSearchOptions &HSOpts);
|
2009-11-10 07:02:47 +08:00
|
|
|
|
|
|
|
// AddDefaultCPlusPlusIncludePaths - Add paths that should be searched when
|
|
|
|
// compiling c++.
|
|
|
|
void AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple);
|
|
|
|
|
|
|
|
/// AddDefaultSystemIncludePaths - Adds the default system include paths so
|
|
|
|
/// that e.g. stdio.h is found.
|
|
|
|
void AddDefaultSystemIncludePaths(const LangOptions &Lang,
|
2010-03-25 04:13:48 +08:00
|
|
|
const llvm::Triple &triple,
|
2010-05-17 03:03:52 +08:00
|
|
|
const HeaderSearchOptions &HSOpts);
|
2009-11-10 07:02:47 +08:00
|
|
|
|
|
|
|
/// Realize - Merges all search path lists into one list and send it to
|
|
|
|
/// HeaderSearch.
|
|
|
|
void Realize();
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2008-08-22 17:25:22 +08:00
|
|
|
|
2009-12-08 20:38:20 +08:00
|
|
|
void InitHeaderSearch::AddPath(const llvm::Twine &Path,
|
2009-09-05 17:49:39 +08:00
|
|
|
IncludeDirGroup Group, bool isCXXAware,
|
|
|
|
bool isUserSupplied, bool isFramework,
|
|
|
|
bool IgnoreSysRoot) {
|
2009-12-08 20:38:20 +08:00
|
|
|
assert(!Path.isTriviallyEmpty() && "can't handle empty path here");
|
2008-08-22 17:25:22 +08:00
|
|
|
FileManager &FM = Headers.getFileMgr();
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
// Compute the actual path, taking into consideration -isysroot.
|
2010-11-15 08:05:18 +08:00
|
|
|
llvm::SmallString<256> MappedPathStorage;
|
2010-11-15 08:48:13 +08:00
|
|
|
llvm::StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
// Handle isysroot.
|
2010-12-18 05:22:22 +08:00
|
|
|
if (Group == System && !IgnoreSysRoot &&
|
|
|
|
llvm::sys::path::is_absolute(MappedPathStr) &&
|
2010-12-26 04:09:27 +08:00
|
|
|
IsNotEmptyOrRoot) {
|
2010-11-15 17:28:23 +08:00
|
|
|
MappedPathStorage.clear();
|
2010-11-15 15:15:26 +08:00
|
|
|
MappedPathStr =
|
2010-12-26 04:09:27 +08:00
|
|
|
(IncludeSysroot + Path).toStringRef(MappedPathStorage);
|
2008-08-22 17:25:22 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
// Compute the DirectoryLookup type.
|
2008-10-27 09:19:25 +08:00
|
|
|
SrcMgr::CharacteristicKind Type;
|
2008-08-22 17:25:22 +08:00
|
|
|
if (Group == Quoted || Group == Angled)
|
2008-09-27 05:18:42 +08:00
|
|
|
Type = SrcMgr::C_User;
|
2008-08-22 17:25:22 +08:00
|
|
|
else if (isCXXAware)
|
2008-09-27 05:18:42 +08:00
|
|
|
Type = SrcMgr::C_System;
|
2008-08-22 17:25:22 +08:00
|
|
|
else
|
2008-09-27 05:18:42 +08:00
|
|
|
Type = SrcMgr::C_ExternCSystem;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
// If the directory exists, add it.
|
2010-11-23 16:35:12 +08:00
|
|
|
if (const DirectoryEntry *DE = FM.getDirectory(MappedPathStr)) {
|
2008-08-22 17:25:22 +08:00
|
|
|
IncludeGroup[Group].push_back(DirectoryLookup(DE, Type, isUserSupplied,
|
|
|
|
isFramework));
|
|
|
|
return;
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
// Check to see if this is an apple-style headermap (which are not allowed to
|
|
|
|
// be frameworks).
|
|
|
|
if (!isFramework) {
|
2010-11-23 16:35:12 +08:00
|
|
|
if (const FileEntry *FE = FM.getFile(MappedPathStr)) {
|
2008-08-22 17:25:22 +08:00
|
|
|
if (const HeaderMap *HM = Headers.CreateHeaderMap(FE)) {
|
|
|
|
// It is a headermap, add it to the search path.
|
|
|
|
IncludeGroup[Group].push_back(DirectoryLookup(HM, Type,isUserSupplied));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
if (Verbose)
|
2010-11-15 08:48:13 +08:00
|
|
|
llvm::errs() << "ignoring nonexistent directory \""
|
|
|
|
<< MappedPathStr << "\"\n";
|
2008-08-22 17:25:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-08 20:11:06 +08:00
|
|
|
void InitHeaderSearch::AddDelimitedPaths(llvm::StringRef at) {
|
|
|
|
if (at.empty()) // Empty string should not add '.' path.
|
2008-08-22 17:25:22 +08:00
|
|
|
return;
|
|
|
|
|
2009-12-08 20:11:06 +08:00
|
|
|
llvm::StringRef::size_type delim;
|
|
|
|
while ((delim = at.find(llvm::sys::PathSeparator)) != llvm::StringRef::npos) {
|
|
|
|
if (delim == 0)
|
2008-08-22 17:25:22 +08:00
|
|
|
AddPath(".", Angled, false, true, false);
|
|
|
|
else
|
2009-12-08 20:11:06 +08:00
|
|
|
AddPath(at.substr(0, delim), Angled, false, true, false);
|
|
|
|
at = at.substr(delim + 1);
|
2008-08-22 17:25:22 +08:00
|
|
|
}
|
2009-12-08 20:11:06 +08:00
|
|
|
|
|
|
|
if (at.empty())
|
2008-08-22 17:25:22 +08:00
|
|
|
AddPath(".", Angled, false, true, false);
|
|
|
|
else
|
|
|
|
AddPath(at, Angled, false, true, false);
|
|
|
|
}
|
|
|
|
|
2009-12-08 20:38:20 +08:00
|
|
|
void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(llvm::StringRef Base,
|
|
|
|
llvm::StringRef ArchDir,
|
|
|
|
llvm::StringRef Dir32,
|
|
|
|
llvm::StringRef Dir64,
|
2009-10-15 01:09:44 +08:00
|
|
|
const llvm::Triple &triple) {
|
2009-11-24 00:31:19 +08:00
|
|
|
// Add the base dir
|
2009-11-17 03:49:37 +08:00
|
|
|
AddPath(Base, System, true, false, false);
|
|
|
|
|
|
|
|
// Add the multilib dirs
|
2009-10-15 01:09:44 +08:00
|
|
|
llvm::Triple::ArchType arch = triple.getArch();
|
|
|
|
bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64;
|
|
|
|
if (is64bit)
|
2009-11-17 03:49:37 +08:00
|
|
|
AddPath(Base + "/" + ArchDir + "/" + Dir64, System, true, false, false);
|
2009-10-15 01:09:44 +08:00
|
|
|
else
|
2009-11-17 03:49:37 +08:00
|
|
|
AddPath(Base + "/" + ArchDir + "/" + Dir32, System, true, false, false);
|
2009-11-24 00:31:19 +08:00
|
|
|
|
|
|
|
// Add the backward dir
|
|
|
|
AddPath(Base + "/backward", System, true, false, false);
|
2009-10-06 09:33:02 +08:00
|
|
|
}
|
2008-08-22 17:25:22 +08:00
|
|
|
|
2009-12-08 20:38:20 +08:00
|
|
|
void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base,
|
|
|
|
llvm::StringRef Arch,
|
|
|
|
llvm::StringRef Version) {
|
2010-01-21 00:18:11 +08:00
|
|
|
AddPath(Base + "/" + Arch + "/" + Version + "/include/c++",
|
|
|
|
System, true, false, false);
|
2010-09-04 00:45:53 +08:00
|
|
|
AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/" + Arch,
|
|
|
|
System, true, false, false);
|
2010-01-21 00:18:11 +08:00
|
|
|
AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/backward",
|
|
|
|
System, true, false, false);
|
2009-10-13 04:50:45 +08:00
|
|
|
}
|
2009-10-09 07:29:47 +08:00
|
|
|
|
2009-10-13 04:50:45 +08:00
|
|
|
// FIXME: This probably should goto to some platform utils place.
|
|
|
|
#ifdef _MSC_VER
|
2009-11-21 08:15:52 +08:00
|
|
|
|
2009-10-13 04:50:45 +08:00
|
|
|
// Read registry string.
|
2009-11-21 08:15:52 +08:00
|
|
|
// This also supports a means to look for high-versioned keys by use
|
|
|
|
// of a $VERSION placeholder in the key path.
|
|
|
|
// $VERSION in the key path is a placeholder for the version number,
|
|
|
|
// causing the highest value path to be searched for and used.
|
|
|
|
// I.e. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION".
|
|
|
|
// There can be additional characters in the component. Only the numberic
|
|
|
|
// characters are compared.
|
2010-01-21 00:21:40 +08:00
|
|
|
static bool getSystemRegistryString(const char *keyPath, const char *valueName,
|
|
|
|
char *value, size_t maxLength) {
|
2009-10-09 07:29:47 +08:00
|
|
|
HKEY hRootKey = NULL;
|
|
|
|
HKEY hKey = NULL;
|
|
|
|
const char* subKey = NULL;
|
|
|
|
DWORD valueType;
|
|
|
|
DWORD valueSize = maxLength - 1;
|
2009-11-21 08:15:52 +08:00
|
|
|
long lResult;
|
2009-10-09 07:29:47 +08:00
|
|
|
bool returnValue = false;
|
|
|
|
if (strncmp(keyPath, "HKEY_CLASSES_ROOT\\", 18) == 0) {
|
|
|
|
hRootKey = HKEY_CLASSES_ROOT;
|
|
|
|
subKey = keyPath + 18;
|
|
|
|
}
|
|
|
|
else if (strncmp(keyPath, "HKEY_USERS\\", 11) == 0) {
|
|
|
|
hRootKey = HKEY_USERS;
|
|
|
|
subKey = keyPath + 11;
|
|
|
|
}
|
|
|
|
else if (strncmp(keyPath, "HKEY_LOCAL_MACHINE\\", 19) == 0) {
|
|
|
|
hRootKey = HKEY_LOCAL_MACHINE;
|
|
|
|
subKey = keyPath + 19;
|
2008-09-05 17:41:20 +08:00
|
|
|
}
|
2009-10-09 07:29:47 +08:00
|
|
|
else if (strncmp(keyPath, "HKEY_CURRENT_USER\\", 18) == 0) {
|
|
|
|
hRootKey = HKEY_CURRENT_USER;
|
|
|
|
subKey = keyPath + 18;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return(false);
|
2009-11-21 08:15:52 +08:00
|
|
|
const char *placeHolder = strstr(subKey, "$VERSION");
|
|
|
|
char bestName[256];
|
|
|
|
bestName[0] = '\0';
|
|
|
|
// If we have a $VERSION placeholder, do the highest-version search.
|
|
|
|
if (placeHolder) {
|
|
|
|
const char *keyEnd = placeHolder - 1;
|
|
|
|
const char *nextKey = placeHolder;
|
|
|
|
// Find end of previous key.
|
|
|
|
while ((keyEnd > subKey) && (*keyEnd != '\\'))
|
|
|
|
keyEnd--;
|
|
|
|
// Find end of key containing $VERSION.
|
|
|
|
while (*nextKey && (*nextKey != '\\'))
|
|
|
|
nextKey++;
|
|
|
|
size_t partialKeyLength = keyEnd - subKey;
|
|
|
|
char partialKey[256];
|
|
|
|
if (partialKeyLength > sizeof(partialKey))
|
|
|
|
partialKeyLength = sizeof(partialKey);
|
|
|
|
strncpy(partialKey, subKey, partialKeyLength);
|
|
|
|
partialKey[partialKeyLength] = '\0';
|
|
|
|
HKEY hTopKey = NULL;
|
|
|
|
lResult = RegOpenKeyEx(hRootKey, partialKey, 0, KEY_READ, &hTopKey);
|
|
|
|
if (lResult == ERROR_SUCCESS) {
|
|
|
|
char keyName[256];
|
|
|
|
int bestIndex = -1;
|
|
|
|
double bestValue = 0.0;
|
|
|
|
DWORD index, size = sizeof(keyName) - 1;
|
2009-12-08 01:18:48 +08:00
|
|
|
for (index = 0; RegEnumKeyEx(hTopKey, index, keyName, &size, NULL,
|
|
|
|
NULL, NULL, NULL) == ERROR_SUCCESS; index++) {
|
|
|
|
const char *sp = keyName;
|
|
|
|
while (*sp && !isdigit(*sp))
|
|
|
|
sp++;
|
|
|
|
if (!*sp)
|
|
|
|
continue;
|
|
|
|
const char *ep = sp + 1;
|
|
|
|
while (*ep && (isdigit(*ep) || (*ep == '.')))
|
|
|
|
ep++;
|
|
|
|
char numBuf[32];
|
|
|
|
strncpy(numBuf, sp, sizeof(numBuf) - 1);
|
|
|
|
numBuf[sizeof(numBuf) - 1] = '\0';
|
|
|
|
double value = strtod(numBuf, NULL);
|
|
|
|
if (value > bestValue) {
|
|
|
|
bestIndex = (int)index;
|
|
|
|
bestValue = value;
|
|
|
|
strcpy(bestName, keyName);
|
|
|
|
}
|
2009-11-21 08:15:52 +08:00
|
|
|
size = sizeof(keyName) - 1;
|
|
|
|
}
|
|
|
|
// If we found the highest versioned key, open the key and get the value.
|
|
|
|
if (bestIndex != -1) {
|
|
|
|
// Append rest of key.
|
|
|
|
strncat(bestName, nextKey, sizeof(bestName) - 1);
|
|
|
|
bestName[sizeof(bestName) - 1] = '\0';
|
|
|
|
// Open the chosen key path remainder.
|
|
|
|
lResult = RegOpenKeyEx(hTopKey, bestName, 0, KEY_READ, &hKey);
|
|
|
|
if (lResult == ERROR_SUCCESS) {
|
|
|
|
lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
|
|
|
|
(LPBYTE)value, &valueSize);
|
|
|
|
if (lResult == ERROR_SUCCESS)
|
|
|
|
returnValue = true;
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RegCloseKey(hTopKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lResult = RegOpenKeyEx(hRootKey, subKey, 0, KEY_READ, &hKey);
|
|
|
|
if (lResult == ERROR_SUCCESS) {
|
|
|
|
lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
|
|
|
|
(LPBYTE)value, &valueSize);
|
|
|
|
if (lResult == ERROR_SUCCESS)
|
|
|
|
returnValue = true;
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
2009-10-09 07:29:47 +08:00
|
|
|
}
|
|
|
|
return(returnValue);
|
|
|
|
}
|
2009-10-13 04:50:45 +08:00
|
|
|
#else // _MSC_VER
|
|
|
|
// Read registry string.
|
2010-01-21 00:21:40 +08:00
|
|
|
static bool getSystemRegistryString(const char*, const char*, char*, size_t) {
|
2009-10-13 04:50:45 +08:00
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
#endif // _MSC_VER
|
2008-09-05 17:41:20 +08:00
|
|
|
|
2009-10-09 07:29:47 +08:00
|
|
|
// Get Visual Studio installation directory.
|
2010-01-21 00:21:40 +08:00
|
|
|
static bool getVisualStudioDir(std::string &path) {
|
2010-08-22 05:55:07 +08:00
|
|
|
// First check the environment variables that vsvars32.bat sets.
|
|
|
|
const char* vcinstalldir = getenv("VCINSTALLDIR");
|
|
|
|
if(vcinstalldir) {
|
|
|
|
char *p = const_cast<char *>(strstr(vcinstalldir, "\\VC"));
|
|
|
|
if (p)
|
|
|
|
*p = '\0';
|
|
|
|
path = vcinstalldir;
|
|
|
|
return(true);
|
|
|
|
}
|
|
|
|
|
2009-11-21 08:15:52 +08:00
|
|
|
char vsIDEInstallDir[256];
|
2010-05-18 13:47:04 +08:00
|
|
|
char vsExpressIDEInstallDir[256];
|
2010-08-22 05:55:07 +08:00
|
|
|
// Then try the windows registry.
|
2009-11-21 08:15:52 +08:00
|
|
|
bool hasVCDir = getSystemRegistryString(
|
|
|
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION",
|
|
|
|
"InstallDir", vsIDEInstallDir, sizeof(vsIDEInstallDir) - 1);
|
2010-05-18 13:47:04 +08:00
|
|
|
bool hasVCExpressDir = getSystemRegistryString(
|
|
|
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\$VERSION",
|
|
|
|
"InstallDir", vsExpressIDEInstallDir, sizeof(vsExpressIDEInstallDir) - 1);
|
2009-10-09 07:29:47 +08:00
|
|
|
// If we have both vc80 and vc90, pick version we were compiled with.
|
2009-11-21 08:15:52 +08:00
|
|
|
if (hasVCDir && vsIDEInstallDir[0]) {
|
2009-10-13 04:50:45 +08:00
|
|
|
char *p = (char*)strstr(vsIDEInstallDir, "\\Common7\\IDE");
|
|
|
|
if (p)
|
|
|
|
*p = '\0';
|
|
|
|
path = vsIDEInstallDir;
|
|
|
|
return(true);
|
2009-10-09 07:29:47 +08:00
|
|
|
}
|
2010-05-18 13:47:04 +08:00
|
|
|
else if (hasVCExpressDir && vsExpressIDEInstallDir[0]) {
|
|
|
|
char *p = (char*)strstr(vsExpressIDEInstallDir, "\\Common7\\IDE");
|
|
|
|
if (p)
|
|
|
|
*p = '\0';
|
|
|
|
path = vsExpressIDEInstallDir;
|
|
|
|
return(true);
|
|
|
|
}
|
2009-10-13 04:50:45 +08:00
|
|
|
else {
|
|
|
|
// Try the environment.
|
2010-05-18 13:47:04 +08:00
|
|
|
const char* vs100comntools = getenv("VS100COMNTOOLS");
|
2009-10-13 04:50:45 +08:00
|
|
|
const char* vs90comntools = getenv("VS90COMNTOOLS");
|
|
|
|
const char* vs80comntools = getenv("VS80COMNTOOLS");
|
|
|
|
const char* vscomntools = NULL;
|
2010-05-18 13:47:04 +08:00
|
|
|
|
|
|
|
// Try to find the version that we were compiled with
|
|
|
|
if(false) {}
|
|
|
|
#if (_MSC_VER >= 1600) // VC100
|
|
|
|
else if(vs100comntools) {
|
|
|
|
vscomntools = vs100comntools;
|
2009-10-13 04:50:45 +08:00
|
|
|
}
|
2010-05-18 13:47:04 +08:00
|
|
|
#elif (_MSC_VER == 1500) // VC80
|
|
|
|
else if(vs90comntools) {
|
|
|
|
vscomntools = vs90comntools;
|
|
|
|
}
|
|
|
|
#elif (_MSC_VER == 1400) // VC80
|
|
|
|
else if(vs80comntools) {
|
|
|
|
vscomntools = vs80comntools;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// Otherwise find any version we can
|
|
|
|
else if (vs100comntools)
|
|
|
|
vscomntools = vs100comntools;
|
2009-10-13 04:50:45 +08:00
|
|
|
else if (vs90comntools)
|
|
|
|
vscomntools = vs90comntools;
|
|
|
|
else if (vs80comntools)
|
|
|
|
vscomntools = vs80comntools;
|
2010-05-18 13:47:04 +08:00
|
|
|
|
2009-10-13 04:50:45 +08:00
|
|
|
if (vscomntools && *vscomntools) {
|
2010-04-20 00:39:44 +08:00
|
|
|
char *p = const_cast<char *>(strstr(vscomntools, "\\Common7\\Tools"));
|
2009-10-13 04:50:45 +08:00
|
|
|
if (p)
|
|
|
|
*p = '\0';
|
|
|
|
path = vscomntools;
|
|
|
|
return(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
return(false);
|
2009-10-09 07:29:47 +08:00
|
|
|
}
|
2009-07-02 02:59:43 +08:00
|
|
|
|
2009-11-21 08:15:52 +08:00
|
|
|
// Get Windows SDK installation directory.
|
2010-01-21 00:21:40 +08:00
|
|
|
static bool getWindowsSDKDir(std::string &path) {
|
2009-11-21 08:15:52 +08:00
|
|
|
char windowsSDKInstallDir[256];
|
|
|
|
// Try the Windows registry.
|
|
|
|
bool hasSDKDir = getSystemRegistryString(
|
|
|
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\$VERSION",
|
|
|
|
"InstallationFolder", windowsSDKInstallDir, sizeof(windowsSDKInstallDir) - 1);
|
|
|
|
// If we have both vc80 and vc90, pick version we were compiled with.
|
|
|
|
if (hasSDKDir && windowsSDKInstallDir[0]) {
|
|
|
|
path = windowsSDKInstallDir;
|
|
|
|
return(true);
|
|
|
|
}
|
|
|
|
return(false);
|
|
|
|
}
|
|
|
|
|
2010-05-17 03:03:52 +08:00
|
|
|
void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|
|
|
const HeaderSearchOptions &HSOpts) {
|
2011-02-03 02:59:27 +08:00
|
|
|
llvm::Triple::OSType os = triple.getOS();
|
|
|
|
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::NetBSD:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// FIXME: temporary hack: hard-coded paths.
|
|
|
|
AddPath("/usr/local/include", System, true, false, false);
|
|
|
|
break;
|
|
|
|
}
|
2010-05-17 03:03:52 +08:00
|
|
|
|
|
|
|
// Builtin includes use #include_next directives and should be positioned
|
|
|
|
// just prior C include dirs.
|
|
|
|
if (HSOpts.UseBuiltinIncludes) {
|
|
|
|
// Ignore the sys root, we *always* look for clang headers relative to
|
|
|
|
// supplied path.
|
|
|
|
llvm::sys::Path P(HSOpts.ResourceDir);
|
|
|
|
P.appendComponent("include");
|
|
|
|
AddPath(P.str(), System, false, false, false, /*IgnoreSysRoot=*/ true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add dirs specified via 'configure --with-c-include-dirs'.
|
2009-11-12 15:28:29 +08:00
|
|
|
llvm::StringRef CIncludeDirs(C_INCLUDE_DIRS);
|
|
|
|
if (CIncludeDirs != "") {
|
2009-11-13 13:13:58 +08:00
|
|
|
llvm::SmallVector<llvm::StringRef, 5> dirs;
|
|
|
|
CIncludeDirs.split(dirs, ":");
|
|
|
|
for (llvm::SmallVectorImpl<llvm::StringRef>::iterator i = dirs.begin();
|
|
|
|
i != dirs.end();
|
|
|
|
++i)
|
2009-11-12 13:48:41 +08:00
|
|
|
AddPath(*i, System, false, false, false);
|
|
|
|
return;
|
|
|
|
}
|
2011-02-03 02:59:27 +08:00
|
|
|
|
2009-10-09 07:29:47 +08:00
|
|
|
switch (os) {
|
2010-09-10 01:38:18 +08:00
|
|
|
case llvm::Triple::Win32: {
|
|
|
|
std::string VSDir;
|
|
|
|
std::string WindowsSDKDir;
|
|
|
|
if (getVisualStudioDir(VSDir)) {
|
|
|
|
AddPath(VSDir + "\\VC\\include", System, false, false, false);
|
|
|
|
if (getWindowsSDKDir(WindowsSDKDir))
|
|
|
|
AddPath(WindowsSDKDir + "\\include", System, false, false, false);
|
|
|
|
else
|
|
|
|
AddPath(VSDir + "\\VC\\PlatformSDK\\Include",
|
|
|
|
System, false, false, false);
|
|
|
|
} else {
|
|
|
|
// Default install paths.
|
|
|
|
AddPath("C:/Program Files/Microsoft Visual Studio 10.0/VC/include",
|
|
|
|
System, false, false, false);
|
|
|
|
AddPath("C:/Program Files/Microsoft Visual Studio 9.0/VC/include",
|
|
|
|
System, false, false, false);
|
|
|
|
AddPath(
|
2009-11-24 01:49:27 +08:00
|
|
|
"C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include",
|
2010-09-10 01:38:18 +08:00
|
|
|
System, false, false, false);
|
|
|
|
AddPath("C:/Program Files/Microsoft Visual Studio 8/VC/include",
|
|
|
|
System, false, false, false);
|
|
|
|
AddPath(
|
2009-11-24 01:49:27 +08:00
|
|
|
"C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include",
|
2010-09-10 01:38:18 +08:00
|
|
|
System, false, false, false);
|
2009-10-09 07:29:47 +08:00
|
|
|
}
|
|
|
|
break;
|
2010-09-10 01:38:18 +08:00
|
|
|
}
|
2010-04-12 03:29:39 +08:00
|
|
|
case llvm::Triple::Haiku:
|
|
|
|
AddPath("/boot/common/include", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/app", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/arch", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/device", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/drivers", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/game", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/interface", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/kernel", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/locale", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/mail", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/media", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/midi", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/midi2", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/net", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/storage", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/support", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/translation",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/add-ons/graphics",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/add-ons/input_server",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/add-ons/screen_saver",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/add-ons/tracker",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/be_apps/Deskbar",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/be_apps/NetPositive",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/os/be_apps/Tracker",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/cpp", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/cpp/i586-pc-haiku",
|
|
|
|
System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/3rdparty", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/bsd", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/glibc", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers/posix", System, true, false, false);
|
|
|
|
AddPath("/boot/develop/headers", System, true, false, false);
|
2010-08-22 09:00:03 +08:00
|
|
|
break;
|
2010-10-11 10:27:37 +08:00
|
|
|
case llvm::Triple::Cygwin:
|
|
|
|
AddPath("/usr/include/w32api", System, true, false, false);
|
|
|
|
break;
|
2009-10-09 07:29:47 +08:00
|
|
|
case llvm::Triple::MinGW64:
|
2009-10-13 04:50:45 +08:00
|
|
|
case llvm::Triple::MinGW32:
|
2009-10-09 07:29:47 +08:00
|
|
|
AddPath("c:/mingw/include", System, true, false, false);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2008-08-22 17:25:22 +08:00
|
|
|
}
|
2009-10-14 02:51:32 +08:00
|
|
|
|
|
|
|
AddPath("/usr/include", System, false, false, false);
|
2009-10-27 22:47:31 +08:00
|
|
|
}
|
|
|
|
|
2010-05-05 13:28:39 +08:00
|
|
|
void InitHeaderSearch::
|
|
|
|
AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) {
|
2009-10-27 22:47:31 +08:00
|
|
|
llvm::Triple::OSType os = triple.getOS();
|
2009-11-17 03:49:37 +08:00
|
|
|
llvm::StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT);
|
|
|
|
if (CxxIncludeRoot != "") {
|
|
|
|
llvm::StringRef CxxIncludeArch(CXX_INCLUDE_ARCH);
|
|
|
|
if (CxxIncludeArch == "")
|
|
|
|
AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(),
|
2010-05-05 13:28:39 +08:00
|
|
|
CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
|
|
|
|
triple);
|
2009-11-17 03:49:37 +08:00
|
|
|
else
|
|
|
|
AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH,
|
2010-05-05 13:28:39 +08:00
|
|
|
CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
|
|
|
|
triple);
|
2009-11-17 03:49:37 +08:00
|
|
|
return;
|
|
|
|
}
|
2009-10-27 22:47:31 +08:00
|
|
|
// FIXME: temporary hack: hard-coded paths.
|
|
|
|
switch (os) {
|
|
|
|
case llvm::Triple::Cygwin:
|
2010-10-11 10:27:37 +08:00
|
|
|
// Cygwin-1.7
|
|
|
|
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
|
|
|
|
// g++-4 / Cygwin-1.5
|
|
|
|
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2");
|
|
|
|
// FIXME: Do we support g++-3.4.4?
|
|
|
|
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4");
|
2009-10-27 22:47:31 +08:00
|
|
|
break;
|
|
|
|
case llvm::Triple::MinGW64:
|
2010-09-01 23:51:58 +08:00
|
|
|
// Try gcc 4.5.0
|
|
|
|
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.5.0");
|
2009-10-27 22:47:31 +08:00
|
|
|
// Try gcc 4.4.0
|
|
|
|
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.4.0");
|
|
|
|
// Try gcc 4.3.0
|
|
|
|
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.3.0");
|
|
|
|
// Fall through.
|
|
|
|
case llvm::Triple::MinGW32:
|
2010-09-01 23:51:58 +08:00
|
|
|
// Try gcc 4.5.0
|
|
|
|
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0");
|
2009-10-27 22:47:31 +08:00
|
|
|
// Try gcc 4.4.0
|
|
|
|
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");
|
|
|
|
// Try gcc 4.3.0
|
|
|
|
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");
|
|
|
|
break;
|
|
|
|
case llvm::Triple::Darwin:
|
2010-05-28 09:54:31 +08:00
|
|
|
switch (triple.getArch()) {
|
|
|
|
default: break;
|
|
|
|
|
2010-05-29 09:15:12 +08:00
|
|
|
case llvm::Triple::ppc:
|
|
|
|
case llvm::Triple::ppc64:
|
2010-05-29 09:21:11 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
|
|
|
|
"powerpc-apple-darwin10", "", "ppc64",
|
|
|
|
triple);
|
2010-05-29 09:15:12 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
|
|
|
|
"powerpc-apple-darwin10", "", "ppc64",
|
|
|
|
triple);
|
|
|
|
break;
|
|
|
|
|
2010-05-28 09:54:31 +08:00
|
|
|
case llvm::Triple::x86:
|
|
|
|
case llvm::Triple::x86_64:
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
|
|
|
|
"i686-apple-darwin10", "", "x86_64", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
|
|
|
|
"i686-apple-darwin8", "", "", triple);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case llvm::Triple::arm:
|
|
|
|
case llvm::Triple::thumb:
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
|
|
|
|
"arm-apple-darwin10", "v7", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
|
|
|
|
"arm-apple-darwin10", "v6", "", triple);
|
|
|
|
break;
|
|
|
|
}
|
2009-10-27 22:47:31 +08:00
|
|
|
break;
|
2010-01-09 13:41:14 +08:00
|
|
|
case llvm::Triple::DragonFly:
|
|
|
|
AddPath("/usr/include/c++/4.1", System, true, false, false);
|
|
|
|
break;
|
2009-10-27 22:47:31 +08:00
|
|
|
case llvm::Triple::Linux:
|
2010-05-06 22:11:13 +08:00
|
|
|
//===------------------------------------------------------------------===//
|
|
|
|
// Debian based distros.
|
|
|
|
// Note: these distros symlink /usr/include/c++/X.Y.Z -> X.Y
|
|
|
|
//===------------------------------------------------------------------===//
|
2011-02-16 05:16:43 +08:00
|
|
|
// Ubuntu 10.10 LTS "Lucid Lynx" -- gcc-4.4.5
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
|
|
|
|
"i686-linux-gnu", "", "64", triple);
|
|
|
|
// The rest of 10.10 is the same as previous versions.
|
|
|
|
|
2010-05-06 22:11:13 +08:00
|
|
|
// Ubuntu 10.04 LTS "Lucid Lynx" -- gcc-4.4.3
|
|
|
|
// Ubuntu 9.10 "Karmic Koala" -- gcc-4.4.1
|
|
|
|
// Debian 6.0 "squeeze" -- gcc-4.4.2
|
2010-02-28 06:35:43 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
|
2009-12-19 01:43:54 +08:00
|
|
|
"x86_64-linux-gnu", "32", "", triple);
|
2010-02-28 06:35:43 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
|
2010-05-06 22:11:13 +08:00
|
|
|
"i486-linux-gnu", "", "64", triple);
|
2011-02-02 05:32:14 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
|
|
|
|
"arm-linux-gnueabi", "", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
// Ubuntu 9.04 "Jaunty Jackalope" -- gcc-4.3.3
|
|
|
|
// Ubuntu 8.10 "Intrepid Ibex" -- gcc-4.3.2
|
|
|
|
// Debian 5.0 "lenny" -- gcc-4.3.2
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
|
2009-11-17 03:49:37 +08:00
|
|
|
"x86_64-linux-gnu", "32", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
|
|
|
|
"i486-linux-gnu", "", "64", triple);
|
2010-06-04 22:28:10 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
|
|
|
|
"arm-linux-gnueabi", "", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
// Ubuntu 8.04.4 LTS "Hardy Heron" -- gcc-4.2.4
|
|
|
|
// Ubuntu 8.04.[0-3] LTS "Hardy Heron" -- gcc-4.2.3
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2",
|
|
|
|
"x86_64-linux-gnu", "32", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2",
|
|
|
|
"i486-linux-gnu", "", "64", triple);
|
|
|
|
// Ubuntu 7.10 "Gutsy Gibbon" -- gcc-4.1.3
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1",
|
|
|
|
"x86_64-linux-gnu", "32", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1",
|
|
|
|
"i486-linux-gnu", "", "64", triple);
|
2009-11-17 23:28:35 +08:00
|
|
|
|
2010-05-06 22:11:13 +08:00
|
|
|
//===------------------------------------------------------------------===//
|
|
|
|
// Redhat based distros.
|
|
|
|
//===------------------------------------------------------------------===//
|
2010-11-03 02:39:34 +08:00
|
|
|
// Fedora 14
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1",
|
|
|
|
"x86_64-redhat-linux", "32", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1",
|
|
|
|
"i686-redhat-linux", "", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
// Fedora 13
|
2010-05-29 09:01:38 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
|
|
|
|
"x86_64-redhat-linux", "32", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
|
|
|
|
"i686-redhat-linux","", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
// Fedora 12
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
|
2010-01-20 07:30:00 +08:00
|
|
|
"x86_64-redhat-linux", "32", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
|
|
|
|
"i686-redhat-linux","", "", triple);
|
|
|
|
// Fedora 12 (pre-FEB-2010)
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
|
|
|
|
"x86_64-redhat-linux", "32", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
|
|
|
|
"i686-redhat-linux","", "", triple);
|
2009-11-17 23:28:35 +08:00
|
|
|
// Fedora 11
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
|
2010-05-06 22:11:13 +08:00
|
|
|
"x86_64-redhat-linux", "32", "", triple);
|
2010-04-23 23:55:20 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
|
2010-05-06 22:11:13 +08:00
|
|
|
"i586-redhat-linux","", "", triple);
|
|
|
|
// Fedora 10
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
|
2010-04-23 23:55:20 +08:00
|
|
|
"x86_64-redhat-linux", "32", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
|
|
|
|
"i386-redhat-linux","", "", triple);
|
|
|
|
// Fedora 9
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
|
2010-04-23 23:55:20 +08:00
|
|
|
"x86_64-redhat-linux", "32", "", triple);
|
2010-05-06 22:11:13 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
|
|
|
|
"i386-redhat-linux", "", "", triple);
|
|
|
|
// Fedora 8
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
|
|
|
|
"x86_64-redhat-linux", "", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
|
|
|
|
"i386-redhat-linux", "", "", triple);
|
2010-04-23 23:55:20 +08:00
|
|
|
|
2010-05-06 22:11:13 +08:00
|
|
|
//===------------------------------------------------------------------===//
|
2010-04-23 23:55:20 +08:00
|
|
|
|
2010-05-06 22:11:13 +08:00
|
|
|
// Exherbo (2010-01-25)
|
2010-04-23 23:55:20 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
|
2010-05-06 22:11:13 +08:00
|
|
|
"x86_64-pc-linux-gnu", "32", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
|
|
|
|
"i686-pc-linux-gnu", "", "", triple);
|
2010-04-23 23:55:20 +08:00
|
|
|
|
2009-10-27 22:47:31 +08:00
|
|
|
// openSUSE 11.1 32 bit
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
|
2009-11-17 03:49:37 +08:00
|
|
|
"i586-suse-linux", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
// openSUSE 11.1 64 bit
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
|
2009-11-17 03:49:37 +08:00
|
|
|
"x86_64-suse-linux", "32", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
// openSUSE 11.2
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
|
2009-11-17 03:49:37 +08:00
|
|
|
"i586-suse-linux", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
|
2009-11-17 03:49:37 +08:00
|
|
|
"x86_64-suse-linux", "", "", triple);
|
2010-11-26 02:51:59 +08:00
|
|
|
|
|
|
|
// openSUSE 11.4
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
|
|
|
|
"i586-suse-linux", "", "", triple);
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
|
|
|
|
"x86_64-suse-linux", "", "", triple);
|
|
|
|
|
2009-10-27 22:47:31 +08:00
|
|
|
// Arch Linux 2008-06-24
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
|
2009-11-17 03:49:37 +08:00
|
|
|
"i686-pc-linux-gnu", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
|
2009-11-17 03:49:37 +08:00
|
|
|
"x86_64-unknown-linux-gnu", "", "", triple);
|
2010-09-12 01:51:45 +08:00
|
|
|
// Gentoo x86 2010.0 stable
|
|
|
|
AddGnuCPlusPlusIncludePaths(
|
|
|
|
"/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4",
|
|
|
|
"i686-pc-linux-gnu", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
// Gentoo x86 2009.1 stable
|
|
|
|
AddGnuCPlusPlusIncludePaths(
|
2009-11-06 06:03:02 +08:00
|
|
|
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4",
|
2009-11-17 03:49:37 +08:00
|
|
|
"i686-pc-linux-gnu", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
// Gentoo x86 2009.0 stable
|
|
|
|
AddGnuCPlusPlusIncludePaths(
|
2009-11-06 06:03:02 +08:00
|
|
|
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4",
|
2009-11-17 03:49:37 +08:00
|
|
|
"i686-pc-linux-gnu", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
// Gentoo x86 2008.0 stable
|
|
|
|
AddGnuCPlusPlusIncludePaths(
|
2009-11-06 06:03:02 +08:00
|
|
|
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4",
|
2009-11-17 03:49:37 +08:00
|
|
|
"i686-pc-linux-gnu", "", "", triple);
|
2010-11-28 15:20:14 +08:00
|
|
|
|
|
|
|
// Gentoo amd64 gcc 4.4.5
|
2009-10-27 22:47:31 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths(
|
2010-11-28 15:20:14 +08:00
|
|
|
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4",
|
|
|
|
"x86_64-pc-linux-gnu", "32", "", triple);
|
|
|
|
// Gentoo amd64 gcc 4.4.4
|
2010-03-04 05:41:50 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths(
|
2010-11-28 15:20:14 +08:00
|
|
|
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4",
|
|
|
|
"x86_64-pc-linux-gnu", "32", "", triple);
|
2010-03-04 05:41:50 +08:00
|
|
|
// Gentoo amd64 gcc 4.4.3
|
|
|
|
AddGnuCPlusPlusIncludePaths(
|
|
|
|
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4",
|
|
|
|
"x86_64-pc-linux-gnu", "32", "", triple);
|
2010-11-28 15:20:14 +08:00
|
|
|
// Gentoo amd64 gcc 4.3.2
|
2010-11-16 20:42:55 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths(
|
2010-11-28 15:20:14 +08:00
|
|
|
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4",
|
|
|
|
"x86_64-pc-linux-gnu", "", "", triple);
|
|
|
|
// Gentoo amd64 stable
|
|
|
|
AddGnuCPlusPlusIncludePaths(
|
|
|
|
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4",
|
|
|
|
"i686-pc-linux-gnu", "", "", triple);
|
2010-11-16 20:42:55 +08:00
|
|
|
|
2010-07-25 05:33:13 +08:00
|
|
|
// Gentoo amd64 llvm-gcc trunk
|
|
|
|
AddGnuCPlusPlusIncludePaths(
|
|
|
|
"/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1",
|
|
|
|
"x86_64-pc-linux-gnu", "", "", triple);
|
2010-11-28 15:20:14 +08:00
|
|
|
|
2009-10-27 22:47:31 +08:00
|
|
|
break;
|
|
|
|
case llvm::Triple::FreeBSD:
|
2010-05-06 22:11:13 +08:00
|
|
|
// FreeBSD 8.0
|
|
|
|
// FreeBSD 7.3
|
2010-01-17 08:00:11 +08:00
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", "", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
break;
|
2010-09-01 06:39:50 +08:00
|
|
|
case llvm::Triple::NetBSD:
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/g++", "", "", "", triple);
|
|
|
|
break;
|
2010-08-02 07:13:54 +08:00
|
|
|
case llvm::Triple::OpenBSD: {
|
|
|
|
std::string t = triple.getTriple();
|
|
|
|
if (t.substr(0, 6) == "x86_64")
|
|
|
|
t.replace(0, 6, "amd64");
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/include/g++",
|
|
|
|
t, "", "", triple);
|
|
|
|
break;
|
|
|
|
}
|
2010-07-08 00:01:42 +08:00
|
|
|
case llvm::Triple::Minix:
|
|
|
|
AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3",
|
|
|
|
"", "", "", triple);
|
|
|
|
break;
|
2009-10-27 22:47:31 +08:00
|
|
|
case llvm::Triple::Solaris:
|
|
|
|
// Solaris - Fall though..
|
|
|
|
case llvm::Triple::AuroraUX:
|
|
|
|
// AuroraUX
|
|
|
|
AddGnuCPlusPlusIncludePaths("/opt/gcc4/include/c++/4.2.4",
|
2009-11-17 03:49:37 +08:00
|
|
|
"i386-pc-solaris2.11", "", "", triple);
|
2009-10-27 22:47:31 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang,
|
2010-03-25 04:13:48 +08:00
|
|
|
const llvm::Triple &triple,
|
2010-05-17 03:03:52 +08:00
|
|
|
const HeaderSearchOptions &HSOpts) {
|
2010-09-10 01:38:22 +08:00
|
|
|
if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes) {
|
|
|
|
if (!HSOpts.CXXSystemIncludes.empty()) {
|
|
|
|
for (unsigned i = 0, e = HSOpts.CXXSystemIncludes.size(); i != e; ++i)
|
|
|
|
AddPath(HSOpts.CXXSystemIncludes[i], System, true, false, false);
|
|
|
|
} else
|
|
|
|
AddDefaultCPlusPlusIncludePaths(triple);
|
|
|
|
}
|
2009-11-24 00:31:19 +08:00
|
|
|
|
2010-05-17 03:03:52 +08:00
|
|
|
AddDefaultCIncludePaths(triple, HSOpts);
|
2009-11-07 12:20:39 +08:00
|
|
|
|
|
|
|
// Add the default framework include paths on Darwin.
|
|
|
|
if (triple.getOS() == llvm::Triple::Darwin) {
|
|
|
|
AddPath("/System/Library/Frameworks", System, true, false, true);
|
|
|
|
AddPath("/Library/Frameworks", System, true, false, true);
|
|
|
|
}
|
2009-10-27 22:47:31 +08:00
|
|
|
}
|
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
/// RemoveDuplicates - If there are duplicate directory entries in the specified
|
|
|
|
/// search list, remove the later (dead) ones.
|
|
|
|
static void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,
|
|
|
|
bool Verbose) {
|
|
|
|
llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenDirs;
|
|
|
|
llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenFrameworkDirs;
|
|
|
|
llvm::SmallPtrSet<const HeaderMap *, 8> SeenHeaderMaps;
|
|
|
|
for (unsigned i = 0; i != SearchList.size(); ++i) {
|
2008-09-27 01:46:45 +08:00
|
|
|
unsigned DirToRemove = i;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-08 09:00:10 +08:00
|
|
|
const DirectoryLookup &CurEntry = SearchList[i];
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-08 09:00:10 +08:00
|
|
|
if (CurEntry.isNormalDir()) {
|
2008-08-22 17:25:22 +08:00
|
|
|
// If this isn't the first time we've seen this dir, remove it.
|
2009-02-08 09:00:10 +08:00
|
|
|
if (SeenDirs.insert(CurEntry.getDir()))
|
2008-08-22 17:25:22 +08:00
|
|
|
continue;
|
2009-02-08 09:00:10 +08:00
|
|
|
} else if (CurEntry.isFramework()) {
|
2008-08-22 17:25:22 +08:00
|
|
|
// If this isn't the first time we've seen this framework dir, remove it.
|
2009-02-08 09:00:10 +08:00
|
|
|
if (SeenFrameworkDirs.insert(CurEntry.getFrameworkDir()))
|
2008-08-22 17:25:22 +08:00
|
|
|
continue;
|
|
|
|
} else {
|
2009-02-08 09:00:10 +08:00
|
|
|
assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?");
|
2008-08-22 17:25:22 +08:00
|
|
|
// If this isn't the first time we've seen this headermap, remove it.
|
2009-02-08 09:00:10 +08:00
|
|
|
if (SeenHeaderMaps.insert(CurEntry.getHeaderMap()))
|
2008-08-22 17:25:22 +08:00
|
|
|
continue;
|
2009-02-08 08:55:22 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-08 08:55:22 +08:00
|
|
|
// If we have a normal #include dir/framework/headermap that is shadowed
|
|
|
|
// later in the chain by a system include location, we actually want to
|
|
|
|
// ignore the user's request and drop the user dir... keeping the system
|
|
|
|
// dir. This is weird, but required to emulate GCC's search path correctly.
|
|
|
|
//
|
|
|
|
// Since dupes of system dirs are rare, just rescan to find the original
|
|
|
|
// that we're nuking instead of using a DenseMap.
|
2009-02-08 09:00:10 +08:00
|
|
|
if (CurEntry.getDirCharacteristic() != SrcMgr::C_User) {
|
2009-02-08 08:55:22 +08:00
|
|
|
// Find the dir that this is the same of.
|
|
|
|
unsigned FirstDir;
|
|
|
|
for (FirstDir = 0; ; ++FirstDir) {
|
|
|
|
assert(FirstDir != i && "Didn't find dupe?");
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-08 09:00:10 +08:00
|
|
|
const DirectoryLookup &SearchEntry = SearchList[FirstDir];
|
|
|
|
|
2009-02-08 08:55:22 +08:00
|
|
|
// If these are different lookup types, then they can't be the dupe.
|
2009-02-08 09:00:10 +08:00
|
|
|
if (SearchEntry.getLookupType() != CurEntry.getLookupType())
|
2009-02-08 08:55:22 +08:00
|
|
|
continue;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-08 08:55:22 +08:00
|
|
|
bool isSame;
|
2009-02-08 09:00:10 +08:00
|
|
|
if (CurEntry.isNormalDir())
|
|
|
|
isSame = SearchEntry.getDir() == CurEntry.getDir();
|
|
|
|
else if (CurEntry.isFramework())
|
|
|
|
isSame = SearchEntry.getFrameworkDir() == CurEntry.getFrameworkDir();
|
2009-02-08 08:55:22 +08:00
|
|
|
else {
|
2009-02-08 09:00:10 +08:00
|
|
|
assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?");
|
|
|
|
isSame = SearchEntry.getHeaderMap() == CurEntry.getHeaderMap();
|
2009-02-08 08:55:22 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-08 08:55:22 +08:00
|
|
|
if (isSame)
|
|
|
|
break;
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-08 08:55:22 +08:00
|
|
|
// If the first dir in the search path is a non-system dir, zap it
|
|
|
|
// instead of the system one.
|
|
|
|
if (SearchList[FirstDir].getDirCharacteristic() == SrcMgr::C_User)
|
|
|
|
DirToRemove = FirstDir;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Verbose) {
|
2009-12-03 17:14:02 +08:00
|
|
|
llvm::errs() << "ignoring duplicate directory \""
|
|
|
|
<< CurEntry.getName() << "\"\n";
|
2009-02-08 08:55:22 +08:00
|
|
|
if (DirToRemove != i)
|
2009-12-03 17:14:02 +08:00
|
|
|
llvm::errs() << " as it is a non-system directory that duplicates "
|
|
|
|
<< "a system directory\n";
|
2008-08-22 17:25:22 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-09-27 01:46:45 +08:00
|
|
|
// This is reached if the current entry is a duplicate. Remove the
|
|
|
|
// DirToRemove (usually the current dir).
|
|
|
|
SearchList.erase(SearchList.begin()+DirToRemove);
|
2008-08-22 17:25:22 +08:00
|
|
|
--i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InitHeaderSearch::Realize() {
|
|
|
|
// Concatenate ANGLE+SYSTEM+AFTER chains together into SearchList.
|
|
|
|
std::vector<DirectoryLookup> SearchList;
|
|
|
|
SearchList = IncludeGroup[Angled];
|
|
|
|
SearchList.insert(SearchList.end(), IncludeGroup[System].begin(),
|
|
|
|
IncludeGroup[System].end());
|
|
|
|
SearchList.insert(SearchList.end(), IncludeGroup[After].begin(),
|
|
|
|
IncludeGroup[After].end());
|
|
|
|
RemoveDuplicates(SearchList, Verbose);
|
|
|
|
RemoveDuplicates(IncludeGroup[Quoted], Verbose);
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
// Prepend QUOTED list on the search list.
|
2009-09-09 23:08:12 +08:00
|
|
|
SearchList.insert(SearchList.begin(), IncludeGroup[Quoted].begin(),
|
2008-08-22 17:25:22 +08:00
|
|
|
IncludeGroup[Quoted].end());
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-08-22 17:25:22 +08:00
|
|
|
|
|
|
|
bool DontSearchCurDir = false; // TODO: set to true if -I- is set?
|
|
|
|
Headers.SetSearchPaths(SearchList, IncludeGroup[Quoted].size(),
|
|
|
|
DontSearchCurDir);
|
|
|
|
|
|
|
|
// If verbose, print the list of directories that will be searched.
|
|
|
|
if (Verbose) {
|
2009-12-03 17:14:02 +08:00
|
|
|
llvm::errs() << "#include \"...\" search starts here:\n";
|
2008-08-22 17:25:22 +08:00
|
|
|
unsigned QuotedIdx = IncludeGroup[Quoted].size();
|
|
|
|
for (unsigned i = 0, e = SearchList.size(); i != e; ++i) {
|
|
|
|
if (i == QuotedIdx)
|
2009-12-03 17:14:02 +08:00
|
|
|
llvm::errs() << "#include <...> search starts here:\n";
|
2008-08-22 17:25:22 +08:00
|
|
|
const char *Name = SearchList[i].getName();
|
|
|
|
const char *Suffix;
|
|
|
|
if (SearchList[i].isNormalDir())
|
|
|
|
Suffix = "";
|
|
|
|
else if (SearchList[i].isFramework())
|
|
|
|
Suffix = " (framework directory)";
|
|
|
|
else {
|
|
|
|
assert(SearchList[i].isHeaderMap() && "Unknown DirectoryLookup");
|
|
|
|
Suffix = " (headermap)";
|
|
|
|
}
|
2009-12-03 17:14:02 +08:00
|
|
|
llvm::errs() << " " << Name << Suffix << "\n";
|
2008-08-22 17:25:22 +08:00
|
|
|
}
|
2009-12-03 17:14:02 +08:00
|
|
|
llvm::errs() << "End of search list.\n";
|
2008-08-22 17:25:22 +08:00
|
|
|
}
|
|
|
|
}
|
2009-11-07 12:20:50 +08:00
|
|
|
|
2009-11-12 05:44:21 +08:00
|
|
|
void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
|
|
|
|
const HeaderSearchOptions &HSOpts,
|
|
|
|
const LangOptions &Lang,
|
2009-11-07 12:20:50 +08:00
|
|
|
const llvm::Triple &Triple) {
|
|
|
|
InitHeaderSearch Init(HS, HSOpts.Verbose, HSOpts.Sysroot);
|
|
|
|
|
|
|
|
// Add the user defined entries.
|
|
|
|
for (unsigned i = 0, e = HSOpts.UserEntries.size(); i != e; ++i) {
|
|
|
|
const HeaderSearchOptions::Entry &E = HSOpts.UserEntries[i];
|
2009-11-17 13:04:15 +08:00
|
|
|
Init.AddPath(E.Path, E.Group, false, E.IsUserSupplied, E.IsFramework,
|
2010-08-25 06:27:37 +08:00
|
|
|
!E.IsSysRootRelative);
|
2009-11-07 12:20:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add entries from CPATH and friends.
|
2009-12-08 20:11:06 +08:00
|
|
|
Init.AddDelimitedPaths(HSOpts.EnvIncPath);
|
2009-11-17 06:38:40 +08:00
|
|
|
if (Lang.CPlusPlus && Lang.ObjC1)
|
2009-12-08 20:11:06 +08:00
|
|
|
Init.AddDelimitedPaths(HSOpts.ObjCXXEnvIncPath);
|
2009-11-17 06:38:40 +08:00
|
|
|
else if (Lang.CPlusPlus)
|
2009-12-08 20:11:06 +08:00
|
|
|
Init.AddDelimitedPaths(HSOpts.CXXEnvIncPath);
|
2009-11-17 06:38:40 +08:00
|
|
|
else if (Lang.ObjC1)
|
2009-12-08 20:11:06 +08:00
|
|
|
Init.AddDelimitedPaths(HSOpts.ObjCEnvIncPath);
|
2009-11-17 06:38:40 +08:00
|
|
|
else
|
2009-12-08 20:11:06 +08:00
|
|
|
Init.AddDelimitedPaths(HSOpts.CEnvIncPath);
|
2009-11-07 12:20:50 +08:00
|
|
|
|
2009-11-07 12:58:12 +08:00
|
|
|
if (HSOpts.UseStandardIncludes)
|
2010-05-17 03:03:52 +08:00
|
|
|
Init.AddDefaultSystemIncludePaths(Lang, Triple, HSOpts);
|
2009-11-07 12:20:50 +08:00
|
|
|
|
|
|
|
Init.Realize();
|
|
|
|
}
|