[cfe-commits] r86617 - in /cfe/trunk: include/clang/Frontend/HeaderSearchOptions.h include/clang/Frontend/InitHeaderSearch.h include/clang/Frontend/Utils.h lib/Frontend/InitHeaderSearch.cpp tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Mon Nov 9 15:02:47 PST 2009
Author: ddunbar
Date: Mon Nov 9 17:02:47 2009
New Revision: 86617
URL: http://llvm.org/viewvc/llvm-project?rev=86617&view=rev
Log:
Privatize InitHeaderSearch, this functionality is only exposed via
ApplyHeaderSearchOptions now.
Removed:
cfe/trunk/include/clang/Frontend/InitHeaderSearch.h
Modified:
cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h
cfe/trunk/include/clang/Frontend/Utils.h
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h?rev=86617&r1=86616&r2=86617&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/HeaderSearchOptions.h Mon Nov 9 17:02:47 2009
@@ -10,25 +10,34 @@
#ifndef LLVM_CLANG_FRONTEND_HEADERSEARCHOPTIONS_H
#define LLVM_CLANG_FRONTEND_HEADERSEARCHOPTIONS_H
-// FIXME: Drop this dependency.
-#include "clang/Frontend/InitHeaderSearch.h"
#include "llvm/ADT/StringRef.h"
namespace clang {
+namespace frontend {
+ /// IncludeDirGroup - Identifiers the group a include entry belongs to, which
+ /// represents its relative positive in the search list.
+ enum IncludeDirGroup {
+ Quoted = 0, ///< `#include ""` paths. Thing `gcc -iquote`.
+ Angled, ///< Paths for both `#include ""` and `#include <>`. (`-I`)
+ System, ///< Like Angled, but marks system directories.
+ After ///< Like System, but searched after the system directories.
+ };
+}
+
/// HeaderSearchOptions - Helper class for storing options related to the
/// initialization of the HeaderSearch object.
class HeaderSearchOptions {
public:
struct Entry {
std::string Path;
- InitHeaderSearch::IncludeDirGroup Group;
+ frontend::IncludeDirGroup Group;
unsigned IsCXXAware : 1;
unsigned IsUserSupplied : 1;
unsigned IsFramework : 1;
unsigned IgnoreSysRoot : 1;
- Entry(llvm::StringRef _Path, InitHeaderSearch::IncludeDirGroup _Group,
+ Entry(llvm::StringRef _Path, frontend::IncludeDirGroup _Group,
bool _IsCXXAware, bool _IsUserSupplied, bool _IsFramework,
bool _IgnoreSysRoot)
: Path(_Path), Group(_Group), IsCXXAware(_IsCXXAware),
@@ -70,7 +79,7 @@
: Sysroot(_Sysroot), UseStandardIncludes(true) {}
/// AddPath - Add the \arg Path path to the specified \arg Group list.
- void AddPath(llvm::StringRef Path, InitHeaderSearch::IncludeDirGroup Group,
+ void AddPath(llvm::StringRef Path, frontend::IncludeDirGroup Group,
bool IsCXXAware, bool IsUserSupplied,
bool IsFramework, bool IgnoreSysRoot = false) {
UserEntries.push_back(Entry(Path, Group, IsCXXAware, IsUserSupplied,
Removed: cfe/trunk/include/clang/Frontend/InitHeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/InitHeaderSearch.h?rev=86616&view=auto
==============================================================================
--- cfe/trunk/include/clang/Frontend/InitHeaderSearch.h (original)
+++ cfe/trunk/include/clang/Frontend/InitHeaderSearch.h (removed)
@@ -1,96 +0,0 @@
-//===--- InitHeaderSearch.h - Initialize header search paths ----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the InitHeaderSearch class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_FRONTEND_INIT_HEADER_SEARCH_H_
-#define LLVM_CLANG_FRONTEND_INIT_HEADER_SEARCH_H_
-
-#include "clang/Lex/DirectoryLookup.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Triple.h"
-#include <string>
-#include <vector>
-
-namespace clang {
-
-class HeaderSearch;
-class HeaderSearchOptions;
-class LangOptions;
-
-/// 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;
- std::string isysroot;
-
-public:
- /// IncludeDirGroup - Identifies the several search path
- /// lists stored internally.
- enum IncludeDirGroup {
- Quoted = 0, ///< `#include ""` paths. Thing `gcc -iquote`.
- Angled, ///< Paths for both `#include ""` and `#include <>`. (`-I`)
- System, ///< Like Angled, but marks system directories.
- After ///< Like System, but searched after the system directories.
- };
-
- InitHeaderSearch(HeaderSearch &HS,
- bool verbose = false, const std::string &iSysroot = "")
- : Headers(HS), Verbose(verbose), isysroot(iSysroot) {}
-
- /// AddPath - Add the specified path to the specified group list.
- void AddPath(const llvm::StringRef &Path, IncludeDirGroup Group,
- bool isCXXAware, bool isUserSupplied,
- bool isFramework, bool IgnoreSysRoot = false);
-
- /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to suport a gnu
- /// libstdc++.
- void AddGnuCPlusPlusIncludePaths(const std::string &Base, const char *Dir32,
- const char *Dir64,
- const llvm::Triple &triple);
-
- /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to suport a MinGW
- /// libstdc++.
- void AddMinGWCPlusPlusIncludePaths(const std::string &Base,
- const char *Arch,
- const char *Version);
-
- /// AddDelimitedPaths - Add a list of paths delimited by the system PATH
- /// separator. The processing follows that of the CPATH variable for gcc.
- void AddDelimitedPaths(const char *String);
-
- // AddDefaultCIncludePaths - Add paths that should always be searched.
- void AddDefaultCIncludePaths(const llvm::Triple &triple);
-
- // 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,
- const llvm::Triple &triple);
-
- /// Realize - Merges all search path lists into one list and send it to
- /// HeaderSearch.
- void Realize();
-};
-
-void ApplyHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
- HeaderSearch &HS, const LangOptions &Lang,
- const llvm::Triple &triple);
-
-} // end namespace clang
-
-#endif
Modified: cfe/trunk/include/clang/Frontend/Utils.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=86617&r1=86616&r2=86617&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/Utils.h (original)
+++ cfe/trunk/include/clang/Frontend/Utils.h Mon Nov 9 17:02:47 2009
@@ -18,6 +18,7 @@
#include <string>
namespace llvm {
+class Triple;
class raw_ostream;
class raw_fd_ostream;
}
@@ -26,6 +27,8 @@
class ASTConsumer;
class Decl;
class Diagnostic;
+class HeaderSearch;
+class HeaderSearchOptions;
class IdentifierTable;
class LangOptions;
class MinimalAction;
@@ -35,6 +38,11 @@
class Stmt;
class TargetInfo;
+/// Apply the header search options to get given HeaderSearch object.
+void ApplyHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
+ HeaderSearch &HS, const LangOptions &Lang,
+ const llvm::Triple &triple);
+
/// InitializePreprocessor - Initialize the preprocessor getting it and the
/// environment ready to process a single file.
///
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=86617&r1=86616&r2=86617&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Mon Nov 9 17:02:47 2009
@@ -11,13 +11,14 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Frontend/InitHeaderSearch.h"
+#include "clang/Frontend/Utils.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Frontend/HeaderSearchOptions.h"
#include "clang/Lex/HeaderSearch.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include "llvm/Config/config.h"
@@ -27,6 +28,64 @@
#include <windows.h>
#endif
using namespace clang;
+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;
+ std::string isysroot;
+
+public:
+
+ InitHeaderSearch(HeaderSearch &HS,
+ bool verbose = false, const std::string &iSysroot = "")
+ : Headers(HS), Verbose(verbose), isysroot(iSysroot) {}
+
+ /// AddPath - Add the specified path to the specified group list.
+ void AddPath(const llvm::StringRef &Path, IncludeDirGroup Group,
+ bool isCXXAware, bool isUserSupplied,
+ bool isFramework, bool IgnoreSysRoot = false);
+
+ /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to suport a gnu
+ /// libstdc++.
+ void AddGnuCPlusPlusIncludePaths(const std::string &Base, const char *Dir32,
+ const char *Dir64,
+ const llvm::Triple &triple);
+
+ /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to suport a MinGW
+ /// libstdc++.
+ void AddMinGWCPlusPlusIncludePaths(const std::string &Base,
+ const char *Arch,
+ const char *Version);
+
+ /// AddDelimitedPaths - Add a list of paths delimited by the system PATH
+ /// separator. The processing follows that of the CPATH variable for gcc.
+ void AddDelimitedPaths(const char *String);
+
+ // AddDefaultCIncludePaths - Add paths that should always be searched.
+ void AddDefaultCIncludePaths(const llvm::Triple &triple);
+
+ // 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,
+ const llvm::Triple &triple);
+
+ /// Realize - Merges all search path lists into one list and send it to
+ /// HeaderSearch.
+ void Realize();
+};
+
+}
void InitHeaderSearch::AddPath(const llvm::StringRef &Path,
IncludeDirGroup Group, bool isCXXAware,
@@ -601,7 +660,7 @@
if (!HSOpts.BuiltinIncludePath.empty()) {
// Ignore the sys root, we *always* look for clang headers relative to
// supplied path.
- Init.AddPath(HSOpts.BuiltinIncludePath, InitHeaderSearch::System,
+ Init.AddPath(HSOpts.BuiltinIncludePath, System,
false, false, false, /*IgnoreSysRoot=*/ true);
}
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86617&r1=86616&r2=86617&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Mon Nov 9 17:02:47 2009
@@ -31,7 +31,6 @@
#include "clang/Frontend/FixItRewriter.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/HeaderSearchOptions.h"
-#include "clang/Frontend/InitHeaderSearch.h"
#include "clang/Frontend/PCHReader.h"
#include "clang/Frontend/PathDiagnosticClients.h"
#include "clang/Frontend/PreprocessorOptions.h"
@@ -1051,32 +1050,32 @@
unsigned Iidx = 0, Fidx = 0;
while (Iidx < I_dirs.size() && Fidx < F_dirs.size()) {
if (I_dirs.getPosition(Iidx) < F_dirs.getPosition(Fidx)) {
- Opts.AddPath(I_dirs[Iidx], InitHeaderSearch::Angled, false, true, false);
+ Opts.AddPath(I_dirs[Iidx], frontend::Angled, false, true, false);
++Iidx;
} else {
- Opts.AddPath(F_dirs[Fidx], InitHeaderSearch::Angled, false, true, true);
+ Opts.AddPath(F_dirs[Fidx], frontend::Angled, false, true, true);
++Fidx;
}
}
// Consume what's left from whatever list was longer.
for (; Iidx != I_dirs.size(); ++Iidx)
- Opts.AddPath(I_dirs[Iidx], InitHeaderSearch::Angled, false, true, false);
+ Opts.AddPath(I_dirs[Iidx], frontend::Angled, false, true, false);
for (; Fidx != F_dirs.size(); ++Fidx)
- Opts.AddPath(F_dirs[Fidx], InitHeaderSearch::Angled, false, true, true);
+ Opts.AddPath(F_dirs[Fidx], frontend::Angled, false, true, true);
// Handle -idirafter... options.
for (unsigned i = 0, e = idirafter_dirs.size(); i != e; ++i)
- Opts.AddPath(idirafter_dirs[i], InitHeaderSearch::After,
+ Opts.AddPath(idirafter_dirs[i], frontend::After,
false, true, false);
// Handle -iquote... options.
for (unsigned i = 0, e = iquote_dirs.size(); i != e; ++i)
- Opts.AddPath(iquote_dirs[i], InitHeaderSearch::Quoted, false, true, false);
+ Opts.AddPath(iquote_dirs[i], frontend::Quoted, false, true, false);
// Handle -isystem... options.
for (unsigned i = 0, e = isystem_dirs.size(); i != e; ++i)
- Opts.AddPath(isystem_dirs[i], InitHeaderSearch::System, false, true, false);
+ Opts.AddPath(isystem_dirs[i], frontend::System, false, true, false);
// Walk the -iprefix/-iwithprefix/-iwithprefixbefore argument lists in
// parallel, processing the values in order of occurance to get the right
@@ -1105,12 +1104,12 @@
iwithprefix_vals.getPosition(iwithprefix_idx) <
iwithprefixbefore_vals.getPosition(iwithprefixbefore_idx))) {
Opts.AddPath(Prefix+iwithprefix_vals[iwithprefix_idx],
- InitHeaderSearch::System, false, false, false);
+ frontend::System, false, false, false);
++iwithprefix_idx;
iwithprefix_done = iwithprefix_idx == iwithprefix_vals.size();
} else {
Opts.AddPath(Prefix+iwithprefixbefore_vals[iwithprefixbefore_idx],
- InitHeaderSearch::Angled, false, false, false);
+ frontend::Angled, false, false, false);
++iwithprefixbefore_idx;
iwithprefixbefore_done =
iwithprefixbefore_idx == iwithprefixbefore_vals.size();
More information about the cfe-commits
mailing list