summaryrefslogtreecommitdiff
path: root/lib/TableGen/TGLexer.h
diff options
context:
space:
mode:
authorSean Silva <silvas@purdue.edu>2013-02-07 04:30:39 +0000
committerSean Silva <silvas@purdue.edu>2013-02-07 04:30:39 +0000
commita170f520a990a50c35f72d81b4415dc4c3ec50de (patch)
tree084dfdbf7d3e80652163e3fa993cd57aff148c5c /lib/TableGen/TGLexer.h
parent65c46b0cff2a7bcefff9b58895cdf8d710e3b6f7 (diff)
downloadllvm-a170f520a990a50c35f72d81b4415dc4c3ec50de.tar.gz
llvm-a170f520a990a50c35f72d81b4415dc4c3ec50de.tar.bz2
llvm-a170f520a990a50c35f72d81b4415dc4c3ec50de.tar.xz
tblgen: Diagnose duplicate includes.
A double inclusion will pretty much always be an error in TableGen, so there's no point going on just to die with "def already defined" or whatnot. I'm not too thrilled about the "public: ... private: ..." to expose the DependenciesMapTy, but I really didn't see a better way to keep that type centralized. It's a smell that indicates that some refactoring is needed to make this code more loosely coupled. This should avoid all bugs of the same nature as PR15189. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174582 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/TableGen/TGLexer.h')
-rw-r--r--lib/TableGen/TGLexer.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/TableGen/TGLexer.h b/lib/TableGen/TGLexer.h
index a0818f9db7..d1bd70d2ec 100644
--- a/lib/TableGen/TGLexer.h
+++ b/lib/TableGen/TGLexer.h
@@ -15,9 +15,10 @@
#define TGLEXER_H
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/SMLoc.h"
#include <cassert>
+#include <map>
#include <string>
-#include <vector>
namespace llvm {
class MemoryBuffer;
@@ -73,9 +74,13 @@ class TGLexer {
/// CurBuffer - This is the current buffer index we're lexing from as managed
/// by the SourceMgr object.
int CurBuffer;
+
+public:
+ typedef std::map<std::string, SMLoc> DependenciesMapTy;
+private:
/// Dependencies - This is the list of all included files.
- std::vector<std::string> Dependencies;
-
+ DependenciesMapTy Dependencies;
+
public:
TGLexer(SourceMgr &SrcMgr);
~TGLexer() {}
@@ -84,7 +89,7 @@ public:
return CurCode = LexToken();
}
- const std::vector<std::string> &getDependencies() const {
+ const DependenciesMapTy &getDependencies() const {
return Dependencies;
}