IntrusiveRefCntPtr<ASTReader> getASTReader() const;
- StringRef getOriginalSourceFileName() {
+ StringRef getOriginalSourceFileName() const {
return OriginalSourceFile;
}
/// \brief If \p Loc is a loaded location from the preamble, returns
/// the corresponding local location of the main file, otherwise it returns
/// \p Loc.
- SourceLocation mapLocationFromPreamble(SourceLocation Loc);
+ SourceLocation mapLocationFromPreamble(SourceLocation Loc) const;
/// \brief If \p Loc is a local location of the main file but inside the
/// preamble chunk, returns the corresponding loaded location from the
/// preamble, otherwise it returns \p Loc.
- SourceLocation mapLocationToPreamble(SourceLocation Loc);
+ SourceLocation mapLocationToPreamble(SourceLocation Loc) const;
- bool isInPreambleFileID(SourceLocation Loc);
- bool isInMainFileID(SourceLocation Loc);
- SourceLocation getStartOfMainFileID();
- SourceLocation getEndOfPreambleFileID();
+ bool isInPreambleFileID(SourceLocation Loc) const;
+ bool isInMainFileID(SourceLocation Loc) const;
+ SourceLocation getStartOfMainFileID() const;
+ SourceLocation getEndOfPreambleFileID() const;
/// \see mapLocationFromPreamble.
- SourceRange mapRangeFromPreamble(SourceRange R) {
+ SourceRange mapRangeFromPreamble(SourceRange R) const {
return SourceRange(mapLocationFromPreamble(R.getBegin()),
mapLocationFromPreamble(R.getEnd()));
}
/// \see mapLocationToPreamble.
- SourceRange mapRangeToPreamble(SourceRange R) {
+ SourceRange mapRangeToPreamble(SourceRange R) const {
return SourceRange(mapLocationToPreamble(R.getBegin()),
mapLocationToPreamble(R.getEnd()));
}
/// \brief Returns true if the ASTUnit was constructed from a serialized
/// module file.
- bool isModuleFile();
+ bool isModuleFile() const;
std::unique_ptr<llvm::MemoryBuffer>
getBufferForFile(StringRef Filename, std::string *ErrorStr = nullptr);
/// \brief If \arg Loc is a loaded location from the preamble, returns
/// the corresponding local location of the main file, otherwise it returns
/// \arg Loc.
-SourceLocation ASTUnit::mapLocationFromPreamble(SourceLocation Loc) {
+SourceLocation ASTUnit::mapLocationFromPreamble(SourceLocation Loc) const {
FileID PreambleID;
if (SourceMgr)
PreambleID = SourceMgr->getPreambleFileID();
/// \brief If \arg Loc is a local location of the main file but inside the
/// preamble chunk, returns the corresponding loaded location from the
/// preamble, otherwise it returns \arg Loc.
-SourceLocation ASTUnit::mapLocationToPreamble(SourceLocation Loc) {
+SourceLocation ASTUnit::mapLocationToPreamble(SourceLocation Loc) const {
FileID PreambleID;
if (SourceMgr)
PreambleID = SourceMgr->getPreambleFileID();
return Loc;
}
-bool ASTUnit::isInPreambleFileID(SourceLocation Loc) {
+bool ASTUnit::isInPreambleFileID(SourceLocation Loc) const {
FileID FID;
if (SourceMgr)
FID = SourceMgr->getPreambleFileID();
return SourceMgr->isInFileID(Loc, FID);
}
-bool ASTUnit::isInMainFileID(SourceLocation Loc) {
+bool ASTUnit::isInMainFileID(SourceLocation Loc) const {
FileID FID;
if (SourceMgr)
FID = SourceMgr->getMainFileID();
return SourceMgr->isInFileID(Loc, FID);
}
-SourceLocation ASTUnit::getEndOfPreambleFileID() {
+SourceLocation ASTUnit::getEndOfPreambleFileID() const {
FileID FID;
if (SourceMgr)
FID = SourceMgr->getPreambleFileID();
return SourceMgr->getLocForEndOfFile(FID);
}
-SourceLocation ASTUnit::getStartOfMainFileID() {
+SourceLocation ASTUnit::getStartOfMainFileID() const {
FileID FID;
if (SourceMgr)
FID = SourceMgr->getMainFileID();
return nullptr;
}
-bool ASTUnit::isModuleFile() {
+bool ASTUnit::isModuleFile() const {
return isMainFileAST() && getLangOpts().isCompilingModule();
}