class SourceRange;
namespace idx {
+ class TranslationUnit;
/// \brief Represents a Decl or a Stmt and its immediate Decl parent. It's
/// immutable.
void print(llvm::raw_ostream &OS) const;
};
+/// \brief Like ASTLocation but also contains the TranslationUnit that the
+/// ASTLocation originated from.
+class TULocation : public ASTLocation {
+ TranslationUnit *TU;
+
+public:
+ TULocation(TranslationUnit *tu, ASTLocation astLoc)
+ : ASTLocation(astLoc), TU(tu) {
+ assert(tu && "Passed null translation unit");
+ }
+
+ TranslationUnit *getTU() const { return TU; }
+};
+
} // namespace idx
} // namespace clang
namespace idx {
class Entity;
class TranslationUnit;
+ class TULocation;
/// \brief Abstract interface for receiving Entities.
class EntityHandler {
virtual void Handle(TranslationUnit *TU) = 0;
};
+/// \brief Abstract interface for receiving TULocations.
+class TULocationHandler {
+public:
+ typedef TULocation receiving_type;
+
+ virtual ~TULocationHandler();
+ virtual void Handle(TULocation TULoc) = 0;
+};
+
/// \brief Helper for the Handler classes. Stores the objects into a vector.
/// example:
/// @code
// Out-of-line to give the virtual tables a home.
EntityHandler::~EntityHandler() { }
TranslationUnitHandler::~TranslationUnitHandler() { }
+TULocationHandler::~TULocationHandler() { }