summaryrefslogtreecommitdiff
path: root/include/clang/Index
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Index')
-rw-r--r--include/clang/Index/ASTLocation.h6
-rw-r--r--include/clang/Index/Indexer.h13
-rw-r--r--include/clang/Index/Utils.h6
3 files changed, 8 insertions, 17 deletions
diff --git a/include/clang/Index/ASTLocation.h b/include/clang/Index/ASTLocation.h
index 9620ec5dbd4fd..fc18dae1a20c8 100644
--- a/include/clang/Index/ASTLocation.h
+++ b/include/clang/Index/ASTLocation.h
@@ -91,7 +91,7 @@ public:
ASTLocation(const Decl *parentDecl, TypeLoc tyLoc)
: ParentDecl(const_cast<Decl*>(parentDecl), N_Type) {
if (tyLoc) {
- Ty.TyPtr = tyLoc.getSourceType().getAsOpaquePtr();
+ Ty.TyPtr = tyLoc.getType().getAsOpaquePtr();
Ty.Data = tyLoc.getOpaqueData();
} else
ParentDecl.setPointer(0);
@@ -124,8 +124,8 @@ public:
return TypeLoc(QualType::getFromOpaquePtr(Ty.TyPtr), Ty.Data);
}
- Decl *dyn_AsDecl() const { return getKind() == N_Decl ? D : 0; }
- Stmt *dyn_AsStmt() const { return getKind() == N_Stmt ? Stm : 0; }
+ Decl *dyn_AsDecl() const { return isValid() && getKind() == N_Decl ? D : 0; }
+ Stmt *dyn_AsStmt() const { return isValid() && getKind() == N_Stmt ? Stm : 0; }
NamedRef dyn_AsNamedRef() const {
return getKind() == N_Type ? AsNamedRef() : NamedRef();
}
diff --git a/include/clang/Index/Indexer.h b/include/clang/Index/Indexer.h
index 8b1d2dd38bff8..361e729feab2d 100644
--- a/include/clang/Index/Indexer.h
+++ b/include/clang/Index/Indexer.h
@@ -14,13 +14,11 @@
#ifndef LLVM_CLANG_INDEX_INDEXER_H
#define LLVM_CLANG_INDEX_INDEXER_H
-#include "clang/Frontend/TextDiagnosticBuffer.h"
#include "clang/Index/IndexProvider.h"
#include "clang/Index/Entity.h"
#include "clang/Index/GlobalSelector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/DenseMap.h"
-#include "clang/Basic/FileManager.h"
#include <map>
namespace clang {
@@ -39,16 +37,10 @@ public:
typedef std::map<GlobalSelector, TUSetTy> SelMapTy;
explicit Indexer(Program &prog) :
- Prog(prog), Diags(&DiagClient) { }
+ Prog(prog) { }
Program &getProgram() const { return Prog; }
- Diagnostic &getDiagnostics() { return Diags; }
- const Diagnostic &getDiagnostics() const { return Diags; }
-
- FileManager &getFileManager() { return FileMgr; }
- const FileManager &getFileManager() const { return FileMgr; }
-
/// \brief Find all Entities and map them to the given translation unit.
void IndexAST(TranslationUnit *TU);
@@ -59,9 +51,6 @@ public:
private:
Program &Prog;
- TextDiagnosticBuffer DiagClient;
- Diagnostic Diags;
- FileManager FileMgr;
MapTy Map;
CtxTUMapTy CtxTUMap;
diff --git a/include/clang/Index/Utils.h b/include/clang/Index/Utils.h
index e78ef8a155630..36cf56dea203e 100644
--- a/include/clang/Index/Utils.h
+++ b/include/clang/Index/Utils.h
@@ -18,7 +18,8 @@
namespace clang {
class ASTContext;
class SourceLocation;
-
+ class Decl;
+
namespace idx {
class ASTLocation;
@@ -26,7 +27,8 @@ namespace idx {
///
/// \returns the resolved ASTLocation or an invalid ASTLocation if the source
/// location could not be resolved.
-ASTLocation ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc);
+ASTLocation ResolveLocationInAST(ASTContext &Ctx, SourceLocation Loc,
+ Decl *RelativeToDecl = 0);
} // end namespace idx