/// FullSourceLoc - A SourceLocation and its associated SourceManager. Useful
/// for argument passing to functions that expect both objects.
class FullSourceLoc : public SourceLocation {
- SourceManager* SrcMgr;
+ const SourceManager *SrcMgr;
public:
/// Creates a FullSourceLoc where isValid() returns false.
- explicit FullSourceLoc() : SrcMgr((SourceManager*) 0) {}
+ explicit FullSourceLoc() : SrcMgr(0) {}
- explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM)
+ explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM)
: SourceLocation(Loc), SrcMgr(&SM) {}
- SourceManager &getManager() {
- assert(SrcMgr && "SourceManager is NULL.");
- return *SrcMgr;
- }
-
const SourceManager &getManager() const {
assert(SrcMgr && "SourceManager is NULL.");
return *SrcMgr;
void EmitCaretDiagnostic(SourceLocation Loc,
SourceRange *Ranges, unsigned NumRanges,
- SourceManager &SM,
+ const SourceManager &SM,
const FixItHint *Hints,
unsigned NumHints,
unsigned Columns);
}
const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag,
- const SourceManager &sm,
+ const SourceManager &SM,
SourceLocation Loc,
bool *Invalid) const {
if (Invalid)
// Lazily create the Buffer for ContentCaches that wrap files.
if (!Buffer.getPointer() && Entry) {
- // FIXME:
- SourceManager &SM = const_cast<SourceManager &>(sm);
-
std::string ErrorStr;
struct stat FileInfo;
Buffer.setPointer(MemoryBuffer::getFile(Entry->getName(), &ErrorStr,