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_
20 /// InputInfo - Wrapper for information about an input source.
28 const char *BaseInput;
32 InputInfo(types::ID _Type, const char *_BaseInput)
33 : IsPipe(false), Type(_Type), BaseInput(_BaseInput) {
36 InputInfo(const char *Filename, types::ID _Type, const char *_BaseInput)
37 : IsPipe(false), Type(_Type), BaseInput(_BaseInput) {
38 Data.Filename = Filename;
40 InputInfo(PipedJob *Pipe, types::ID _Type, const char *_BaseInput)
41 : IsPipe(true), Type(_Type), BaseInput(_BaseInput) {
45 bool isPipe() const { return IsPipe; }
46 types::ID getType() const { return Type; }
47 const char *getBaseInput() const { return BaseInput; }
49 const char *getInputFilename() const {
50 assert(!isPipe() && "Invalid accessor.");
53 PipedJob &getPipe() const {
54 assert(isPipe() && "Invalid accessor.");
58 /// getAsString - Return a string name for this input, for
60 std::string getAsString() const {
63 else if (const char *N = getInputFilename())
64 return std::string("\"") + N + '"';
70 } // end namespace driver
71 } // end namespace clang