#include <cassert>
#include "llvm/Bitcode/SerializationFwd.h"
+#include <utility>
namespace llvm {
class MemoryBuffer;
class FullSourceLoc : public SourceLocation {
SourceManager* SrcMgr;
public:
- // Creates a FullSourceLoc where isValid() returns false.
+ /// Creates a FullSourceLoc where isValid() returns false.
explicit FullSourceLoc() : SrcMgr((SourceManager*) 0) {}
explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM)
const llvm::MemoryBuffer* getBuffer() const;
+ /// getBufferData - Return a pointer to the start and end of the source buffer
+ /// data for the specified FileID.
+ std::pair<const char*, const char*> getBufferData() const;
+
bool isInSystemHeader() const;
/// Prints information about this FullSourceLoc to stderr. Useful for
#include "clang/Basic/SourceManager.h"
#include "llvm/Bitcode/Serialize.h"
#include "llvm/Bitcode/Deserialize.h"
+#include "llvm/Support/MemoryBuffer.h"
+
using namespace clang;
void SourceLocation::Emit(llvm::Serializer& S) const {
return SrcMgr->getBuffer(SrcMgr->getFileID(*this));
}
+std::pair<const char*, const char*> FullSourceLoc::getBufferData() const {
+ const llvm::MemoryBuffer *Buf = getBuffer();
+ return std::make_pair(Buf->getBufferStart(), Buf->getBufferEnd());
+}