diff options
Diffstat (limited to 'llvm/lib/TableGen')
-rw-r--r-- | llvm/lib/TableGen/Main.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/TableGen/TGLexer.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/TableGen/TGLexer.h | 9 | ||||
-rw-r--r-- | llvm/lib/TableGen/TGParser.h | 2 |
4 files changed, 8 insertions, 15 deletions
diff --git a/llvm/lib/TableGen/Main.cpp b/llvm/lib/TableGen/Main.cpp index 48ded6c45a4..427bd677857 100644 --- a/llvm/lib/TableGen/Main.cpp +++ b/llvm/lib/TableGen/Main.cpp @@ -73,7 +73,7 @@ static int createDependencyFile(const TGParser &Parser, const char *argv0) { EC.message() + "\n"); DepOut.os() << OutputFilename << ":"; for (const auto &Dep : Parser.getDependencies()) { - DepOut.os() << ' ' << Dep.first; + DepOut.os() << ' ' << Dep; } DepOut.os() << "\n"; DepOut.keep(); diff --git a/llvm/lib/TableGen/TGLexer.cpp b/llvm/lib/TableGen/TGLexer.cpp index da2286e41fe..425952338c6 100644 --- a/llvm/lib/TableGen/TGLexer.cpp +++ b/llvm/lib/TableGen/TGLexer.cpp @@ -379,15 +379,7 @@ bool TGLexer::LexInclude() { return true; } - DependenciesMapTy::const_iterator Found = Dependencies.find(IncludedFile); - if (Found != Dependencies.end()) { - PrintError(getLoc(), - "File '" + IncludedFile + "' has already been included."); - SrcMgr.PrintMessage(Found->second, SourceMgr::DK_Note, - "previously included here"); - return true; - } - Dependencies.insert(std::make_pair(IncludedFile, getLoc())); + Dependencies.insert(IncludedFile); // Save the line number and lex buffer of the includer. CurBuf = SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer(); CurPtr = CurBuf.begin(); diff --git a/llvm/lib/TableGen/TGLexer.h b/llvm/lib/TableGen/TGLexer.h index 266a9cd5d97..11a9bd303f5 100644 --- a/llvm/lib/TableGen/TGLexer.h +++ b/llvm/lib/TableGen/TGLexer.h @@ -19,8 +19,8 @@ #include "llvm/Support/DataTypes.h" #include "llvm/Support/SMLoc.h" #include <cassert> -#include <map> #include <memory> +#include <set> #include <string> namespace llvm { @@ -87,10 +87,11 @@ class TGLexer { unsigned CurBuffer = 0; public: - typedef std::map<std::string, SMLoc> DependenciesMapTy; + typedef std::set<std::string> DependenciesSetTy; + private: /// Dependencies - This is the list of all included files. - DependenciesMapTy Dependencies; + DependenciesSetTy Dependencies; public: TGLexer(SourceMgr &SrcMgr, ArrayRef<std::string> Macros); @@ -99,7 +100,7 @@ public: return CurCode = LexToken(CurPtr == CurBuf.begin()); } - const DependenciesMapTy &getDependencies() const { + const DependenciesSetTy &getDependencies() const { return Dependencies; } diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h index 840cd2181f2..cbe0b545d0f 100644 --- a/llvm/lib/TableGen/TGParser.h +++ b/llvm/lib/TableGen/TGParser.h @@ -129,7 +129,7 @@ public: bool TokError(const Twine &Msg) const { return Error(Lex.getLoc(), Msg); } - const TGLexer::DependenciesMapTy &getDependencies() const { + const TGLexer::DependenciesSetTy &getDependencies() const { return Lex.getDependencies(); } |