mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
around everywhere
Fixes:
rdar://14585108 Code completion does not work at the beginning of the file
rdar://14592634 Code completion returns zero results at EOF in a function
without a closing brace
Swift SVN r6820
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
//===--- SourceManager.h - Manager for Source Buffers -----------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_SOURCEMANAGER_H
|
|
#define SWIFT_SOURCEMANAGER_H
|
|
|
|
#include "swift/Basic/SourceLoc.h"
|
|
#include "llvm/Support/SourceMgr.h"
|
|
|
|
namespace swift {
|
|
|
|
/// \brief This class manages and owns source buffers.
|
|
class SourceManager {
|
|
llvm::SourceMgr LLVMSourceMgr;
|
|
|
|
unsigned CodeCompletionBufferID = ~0U;
|
|
unsigned CodeCompletionOffset;
|
|
|
|
public:
|
|
SourceManager() {}
|
|
|
|
llvm::SourceMgr *operator->() { return &LLVMSourceMgr; }
|
|
const llvm::SourceMgr *operator->() const { return &LLVMSourceMgr; }
|
|
|
|
const llvm::SourceMgr &getLLVMSourceMgr() const {
|
|
return LLVMSourceMgr;
|
|
}
|
|
|
|
void setCodeCompletionPoint(unsigned BufferID, unsigned Offset) {
|
|
assert(BufferID != ~0U && "Buffer should be valid");
|
|
assert(CodeCompletionBufferID == ~0U &&
|
|
"Code completion point already set");
|
|
|
|
CodeCompletionBufferID = BufferID;
|
|
CodeCompletionOffset = Offset;
|
|
}
|
|
|
|
unsigned getCodeCompletionBufferID() const {
|
|
return CodeCompletionBufferID;
|
|
}
|
|
|
|
unsigned getCodeCompletionOffset() const {
|
|
return CodeCompletionOffset;
|
|
}
|
|
|
|
SourceLoc getCodeCompletionLoc() const;
|
|
};
|
|
|
|
} // namespace swift
|
|
|
|
#endif // LLVM_SWIFT_SOURCEMANAGER_H
|
|
|