aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-31 07:19:59 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-31 07:19:59 +0000
commit332cb9be88fd2d1b294a2fbc299c354e93be673c (patch)
tree899e4df1c1786eff80f9d5332c2e186f76f243e0 /include
parente70984629f3accf7e1e7187d06bd653dc8e315f2 (diff)
Have the ASTUnit associate the local declarations that get parsed with the file
that contains them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Frontend/ASTUnit.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 80ae8ef36e..b0e7bb64bf 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -126,6 +126,14 @@ private:
// source. In the long term we should make the Index library use efficient and
// more scalable search mechanisms.
std::vector<Decl*> TopLevelDecls;
+
+ /// \brief Sorted (by file offset) vector of pairs of file offset/Decl.
+ typedef SmallVector<std::pair<unsigned, Decl *>, 64> LocDeclsTy;
+ typedef llvm::DenseMap<FileID, LocDeclsTy *> FileDeclsTy;
+
+ /// \brief Map from FileID to the file-level declarations that it contains.
+ /// The files and decls are only local (and non-preamble) ones.
+ FileDeclsTy FileDecls;
/// The name of the original source file used to generate this ASTUnit.
std::string OriginalSourceFile;
@@ -264,6 +272,8 @@ private:
const SmallVectorImpl<StoredDiagnostic> &Diags,
SmallVectorImpl<StoredDiagnostic> &Out);
+ void clearFileLevelDecls();
+
public:
/// \brief A cached code-completion result, which may be introduced in one of
/// many different contexts.
@@ -505,6 +515,9 @@ public:
TopLevelDecls.push_back(D);
}
+ /// \brief Add a new local file-level declaration.
+ void addFileLevelDecl(Decl *D);
+
/// \brief Add a new top-level declaration, identified by its ID in
/// the precompiled preamble.
void addTopLevelDeclFromPreamble(serialization::DeclID D) {