opnsense-src/include/clang/Driver/ToolChain.h

135 lines
4.3 KiB
C
Raw Normal View History

2009-06-02 13:58:47 -04:00
//===--- ToolChain.h - Collections of tools for one platform ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef CLANG_DRIVER_TOOLCHAIN_H_
#define CLANG_DRIVER_TOOLCHAIN_H_
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/System/Path.h"
#include <string>
namespace clang {
namespace driver {
class Compilation;
class DerivedArgList;
2010-01-01 05:34:51 -05:00
class Driver;
2009-06-02 13:58:47 -04:00
class HostInfo;
class InputArgList;
class JobAction;
class Tool;
/// ToolChain - Access to tools for a single platform.
class ToolChain {
public:
typedef llvm::SmallVector<std::string, 4> path_list;
private:
const HostInfo &Host;
const llvm::Triple Triple;
/// The list of toolchain specific path prefixes to search for
/// files.
path_list FilePaths;
/// The list of toolchain specific path prefixes to search for
/// programs.
path_list ProgramPaths;
protected:
ToolChain(const HostInfo &Host, const llvm::Triple &_Triple);
public:
virtual ~ToolChain();
// Accessors
2010-01-01 05:34:51 -05:00
const Driver &getDriver() const;
2009-06-22 04:08:35 -04:00
const llvm::Triple &getTriple() const { return Triple; }
2010-02-16 04:31:36 -05:00
llvm::StringRef getArchName() const { return Triple.getArchName(); }
llvm::StringRef getPlatform() const { return Triple.getVendorName(); }
llvm::StringRef getOS() const { return Triple.getOSName(); }
2009-06-02 13:58:47 -04:00
std::string getTripleString() const {
return Triple.getTriple();
}
path_list &getFilePaths() { return FilePaths; }
const path_list &getFilePaths() const { return FilePaths; }
path_list &getProgramPaths() { return ProgramPaths; }
const path_list &getProgramPaths() const { return ProgramPaths; }
// Tool access.
2009-10-14 14:03:49 -04:00
/// TranslateArgs - Create a new derived argument list for any argument
/// translations this ToolChain may wish to perform.
///
/// \param BoundArch - The bound architecture name, or 0.
virtual DerivedArgList *TranslateArgs(InputArgList &Args,
const char *BoundArch) const = 0;
2009-06-02 13:58:47 -04:00
/// SelectTool - Choose a tool to use to handle the action \arg JA.
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const = 0;
// Helper methods
2009-10-14 14:03:49 -04:00
std::string GetFilePath(const Compilation &C, const char *Name) const;
std::string GetProgramPath(const Compilation &C, const char *Name,
bool WantFile = false) const;
2009-06-02 13:58:47 -04:00
// Platform defaults information
2009-11-18 09:59:57 -05:00
/// IsBlocksDefault - Does this tool chain enable -fblocks by default.
virtual bool IsBlocksDefault() const { return false; }
2010-02-16 04:31:36 -05:00
/// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
/// by default.
virtual bool IsIntegratedAssemblerDefault() const { return false; }
2009-11-18 09:59:57 -05:00
/// IsObjCNonFragileABIDefault - Does this tool chain set
/// -fobjc-nonfragile-abi by default.
virtual bool IsObjCNonFragileABIDefault() const { return false; }
2010-02-16 04:31:36 -05:00
/// IsObjCLegacyDispatchDefault - Does this tool chain set
/// -fobjc-legacy-dispatch by default (this is only used with the non-fragile
/// ABI).
virtual bool IsObjCLegacyDispatchDefault() const { return false; }
2009-11-18 09:59:57 -05:00
/// GetDefaultStackProtectorLevel - Get the default stack protector level for
/// this tool chain (0=off, 1=on, 2=all).
virtual unsigned GetDefaultStackProtectorLevel() const { return 0; }
2009-06-02 13:58:47 -04:00
/// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
/// by default.
virtual bool IsUnwindTablesDefault() const = 0;
/// GetDefaultRelocationModel - Return the LLVM name of the default
/// relocation model for this tool chain.
virtual const char *GetDefaultRelocationModel() const = 0;
/// GetForcedPicModel - Return the LLVM name of the forced PIC model
/// for this tool chain, or 0 if this tool chain does not force a
/// particular PIC mode.
virtual const char *GetForcedPicModel() const = 0;
2010-01-01 05:34:51 -05:00
/// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
/// compile unit information.
virtual bool UseDwarfDebugFlags() const { return false; }
2010-02-16 04:31:36 -05:00
/// UseSjLjExceptions - Does this tool chain use SjLj exceptions.
virtual bool UseSjLjExceptions() const { return false; }
2009-06-02 13:58:47 -04:00
};
} // end namespace driver
} // end namespace clang
#endif