1 //===--- InputInfo.h - Input Source & Type Information ----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef CLANG_LIB_DRIVER_INPUTINFO_H_
11 #define CLANG_LIB_DRIVER_INPUTINFO_H_
13 #include "clang/Driver/Types.h"
22 /// InputInfo - Wrapper for information about an input source.
30 const char *BaseInput;
34 InputInfo(types::ID _Type, const char *_BaseInput)
35 : IsPipe(false), Type(_Type), BaseInput(_BaseInput) {
38 InputInfo(const char *Filename, types::ID _Type, const char *_BaseInput)
39 : IsPipe(false), Type(_Type), BaseInput(_BaseInput) {
40 Data.Filename = Filename;
42 InputInfo(PipedJob *Pipe, types::ID _Type, const char *_BaseInput)
43 : IsPipe(true), Type(_Type), BaseInput(_BaseInput) {
47 bool isPipe() const { return IsPipe; }
48 types::ID getType() const { return Type; }
49 const char *getBaseInput() const { return BaseInput; }
51 const char *getInputFilename() const {
52 assert(!isPipe() && "Invalid accessor.");
55 PipedJob &getPipe() const {
56 assert(isPipe() && "Invalid accessor.");
60 /// getAsString - Return a string name for this input, for
62 std::string getAsString() const {
65 else if (const char *N = getInputFilename())
66 return std::string("\"") + N + '"';
72 } // end namespace driver
73 } // end namespace clang