diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-03-03 01:47:37 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-03-03 01:47:37 +0000 |
| commit | d7f6b55afa3711e3540fa8d44d004a5b68d376ef (patch) | |
| tree | 6df18f4ddc75601b0d997ed2076b01c689f48d28 /llvm/utils/TableGen/FileLexer.l.cvs | |
| parent | e7b74c5da17ce37f352a2eb55740a0a7898c608f (diff) | |
| download | bcm5719-llvm-d7f6b55afa3711e3540fa8d44d004a5b68d376ef.tar.gz bcm5719-llvm-d7f6b55afa3711e3540fa8d44d004a5b68d376ef.zip | |
Regenerate
llvm-svn: 26486
Diffstat (limited to 'llvm/utils/TableGen/FileLexer.l.cvs')
| -rw-r--r-- | llvm/utils/TableGen/FileLexer.l.cvs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/utils/TableGen/FileLexer.l.cvs b/llvm/utils/TableGen/FileLexer.l.cvs index d0457eaa3d4..c561ec64c67 100644 --- a/llvm/utils/TableGen/FileLexer.l.cvs +++ b/llvm/utils/TableGen/FileLexer.l.cvs @@ -36,7 +36,7 @@ int Fileparse(); namespace llvm { // Global variable recording the location of the include directory -std::string IncludeDirectory; +std::vector<std::string> IncludeDirectories; /// ParseInt - This has to handle the special case of binary numbers 0b0101 /// @@ -74,7 +74,8 @@ std::ostream &err() { /// ParseFile - this function begins the parsing of the specified tablegen file. /// -void ParseFile(const std::string &Filename, const std::string & IncludeDir) { +void ParseFile(const std::string &Filename, + const std::vector<std::string> &IncludeDirs) { FILE *F = stdin; if (Filename != "-") { F = fopen(Filename.c_str(), "r"); @@ -90,7 +91,7 @@ void ParseFile(const std::string &Filename, const std::string & IncludeDir) { // Record the location of the include directory so that the lexer can find // it later. - IncludeDirectory = IncludeDir; + IncludeDirectories = IncludeDirs; Filein = F; Filelineno = 1; @@ -124,10 +125,13 @@ static void HandleInclude(const char *Buffer) { // If we couldn't find the file in the current directory, look for it in // the include directories. // - // NOTE: Right now, there is only one directory. We need to eventually add - // support for more. - std::string NextFilename = IncludeDirectory + "/" + Filename; - yyin = fopen(NextFilename.c_str(), "r"); + std::string NextFilename; + for (unsigned i = 0, e = IncludeDirectories.size(); i != e; ++i) { + NextFilename = IncludeDirectories[i] + "/" + Filename; + if (yyin = fopen(NextFilename.c_str(), "r")) + break; + } + if (yyin == 0) { err() << "Could not find include file '" << Filename << "'!\n"; exit(1); |

