PrintTransforms(raw_ostream &OS)
: Ctx(0), OS(OS) { }
- virtual void start(ASTContext &ctx) { Ctx = &ctx; }
- virtual void finish() { Ctx = 0; }
+ void start(ASTContext &ctx) override { Ctx = &ctx; }
+ void finish() override { Ctx = 0; }
- virtual void insert(SourceLocation loc, StringRef text) {
+ void insert(SourceLocation loc, StringRef text) override {
assert(Ctx);
OS << "Insert: ";
printSourceLocation(loc, *Ctx, OS);
OS << " \"" << text << "\"\n";
}
- virtual void remove(CharSourceRange range) {
+ void remove(CharSourceRange range) override {
assert(Ctx);
OS << "Remove: ";
printSourceRange(range, *Ctx, OS);
FixWhatYouCan = ::FixWhatYouCan;
}
- std::string RewriteFilename(const std::string& filename, int &fd) {
+ std::string RewriteFilename(const std::string& filename, int &fd) override {
assert(llvm::sys::path::is_absolute(filename) &&
"clang-fixit expects absolute paths only.");
: clang::FixItRewriter(Diags, SourceMgr, LangOpts, FixItOpts) {
}
- virtual bool IncludeInDiagnosticCounts() const { return false; }
+ bool IncludeInDiagnosticCounts() const override { return false; }
};
/// \brief Subclasses \c clang::FixItAction so that we can install the custom
/// \c FixItRewriter.
class FixItAction : public clang::FixItAction {
public:
- virtual bool BeginSourceFileAction(clang::CompilerInstance& CI,
- StringRef Filename) {
+ bool BeginSourceFileAction(clang::CompilerInstance& CI,
+ StringRef Filename) override {
FixItOpts.reset(new FixItOptions);
Rewriter.reset(new FixItRewriter(CI.getDiagnostics(), CI.getSourceManager(),
CI.getLangOpts(), FixItOpts.get()));
public:\
CLSNAME() : DiagTool(NAME, DESC) {}\
virtual ~CLSNAME() {}\
- virtual int run(unsigned argc, char *argv[], llvm::raw_ostream &out);\
+ int run(unsigned argc, char *argv[], llvm::raw_ostream &out) override;\
};\
diagtool::RegisterDiagTool<CLSNAME> Register##CLSNAME;\
}
AllocatedResults(Results), CCTUInfo(Results.CodeCompletionAllocator),
TU(TranslationUnit) { }
~CaptureCompletionResults() { Finish(); }
-
- virtual void ProcessCodeCompleteResults(Sema &S,
- CodeCompletionContext Context,
- CodeCompletionResult *Results,
- unsigned NumResults) {
+
+ void ProcessCodeCompleteResults(Sema &S,
+ CodeCompletionContext Context,
+ CodeCompletionResult *Results,
+ unsigned NumResults) override {
StoredResults.reserve(StoredResults.size() + NumResults);
for (unsigned I = 0; I != NumResults; ++I) {
CodeCompletionString *StoredCompletion
AllocatedResults.ContainerIsIncomplete = 1;
}
}
-
- virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
- OverloadCandidate *Candidates,
- unsigned NumCandidates) {
+
+ void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
+ OverloadCandidate *Candidates,
+ unsigned NumCandidates) override {
StoredResults.reserve(StoredResults.size() + NumCandidates);
for (unsigned I = 0; I != NumCandidates; ++I) {
CodeCompletionString *StoredCompletion
StoredResults.push_back(R);
}
}
-
- virtual CodeCompletionAllocator &getAllocator() {
+
+ CodeCompletionAllocator &getAllocator() override {
return *AllocatedResults.CodeCompletionAllocator;
}
- virtual CodeCompletionTUInfo &getCodeCompletionTUInfo() { return CCTUInfo; }
-
+ CodeCompletionTUInfo &getCodeCompletionTUInfo() override { return CCTUInfo;}
+
private:
void Finish() {
AllocatedResults.Results = new CXCompletionResult [StoredResults.size()];
Message(Msg), Loc(L) {}
virtual ~CXDiagnosticCustomNoteImpl() {}
-
- CXDiagnosticSeverity getSeverity() const {
+
+ CXDiagnosticSeverity getSeverity() const override {
return CXDiagnostic_Note;
}
-
- CXSourceLocation getLocation() const {
+
+ CXSourceLocation getLocation() const override {
return Loc;
}
-
- CXString getSpelling() const {
+
+ CXString getSpelling() const override {
return cxstring::createRef(Message.c_str());
}
-
- CXString getDiagnosticOption(CXString *Disable) const {
+
+ CXString getDiagnosticOption(CXString *Disable) const override {
if (Disable)
*Disable = cxstring::createEmpty();
return cxstring::createEmpty();
}
-
- unsigned getCategory() const { return 0; }
- CXString getCategoryText() const { return cxstring::createEmpty(); }
- unsigned getNumRanges() const { return 0; }
- CXSourceRange getRange(unsigned Range) const { return clang_getNullRange(); }
- unsigned getNumFixIts() const { return 0; }
- CXString getFixIt(unsigned FixIt, CXSourceRange *ReplacementRange) const {
+ unsigned getCategory() const override { return 0; }
+ CXString getCategoryText() const override { return cxstring::createEmpty(); }
+
+ unsigned getNumRanges() const override { return 0; }
+ CXSourceRange getRange(unsigned Range) const override {
+ return clang_getNullRange();
+ }
+ unsigned getNumFixIts() const override { return 0; }
+ CXString getFixIt(unsigned FixIt,
+ CXSourceRange *ReplacementRange) const override {
if (ReplacementRange)
*ReplacementRange = clang_getNullRange();
return cxstring::createEmpty();
virtual ~CXDiagnosticRenderer() {}
- virtual void beginDiagnostic(DiagOrStoredDiag D,
- DiagnosticsEngine::Level Level) {
-
+ void beginDiagnostic(DiagOrStoredDiag D,
+ DiagnosticsEngine::Level Level) override {
+
const StoredDiagnostic *SD = D.dyn_cast<const StoredDiagnostic*>();
if (!SD)
return;
if (Level != DiagnosticsEngine::Note)
CurrentSet = &CD->getChildDiagnostics();
}
-
- virtual void emitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc,
- DiagnosticsEngine::Level Level,
- StringRef Message,
- ArrayRef<CharSourceRange> Ranges,
- const SourceManager *SM,
- DiagOrStoredDiag D) {
+
+ void emitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc,
+ DiagnosticsEngine::Level Level,
+ StringRef Message,
+ ArrayRef<CharSourceRange> Ranges,
+ const SourceManager *SM,
+ DiagOrStoredDiag D) override {
if (!D.isNull())
return;
CXDiagnosticImpl *CD = new CXDiagnosticCustomNoteImpl(Message, L);
CurrentSet->appendDiagnostic(CD);
}
-
- virtual void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
- DiagnosticsEngine::Level Level,
- ArrayRef<CharSourceRange> Ranges,
- const SourceManager &SM) {}
-
- virtual void emitCodeContext(SourceLocation Loc,
- DiagnosticsEngine::Level Level,
- SmallVectorImpl<CharSourceRange>& Ranges,
- ArrayRef<FixItHint> Hints,
- const SourceManager &SM) {}
-
- virtual void emitNote(SourceLocation Loc, StringRef Message,
- const SourceManager *SM) {
+
+ void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
+ DiagnosticsEngine::Level Level,
+ ArrayRef<CharSourceRange> Ranges,
+ const SourceManager &SM) override {}
+
+ void emitCodeContext(SourceLocation Loc,
+ DiagnosticsEngine::Level Level,
+ SmallVectorImpl<CharSourceRange>& Ranges,
+ ArrayRef<FixItHint> Hints,
+ const SourceManager &SM) override {}
+
+ void emitNote(SourceLocation Loc, StringRef Message,
+ const SourceManager *SM) override {
CXSourceLocation L;
if (SM)
L = translateSourceLocation(*SM, LangOpts, Loc);
virtual ~CXStoredDiagnostic() {}
/// \brief Return the severity of the diagnostic.
- virtual CXDiagnosticSeverity getSeverity() const;
-
+ CXDiagnosticSeverity getSeverity() const override;
+
/// \brief Return the location of the diagnostic.
- virtual CXSourceLocation getLocation() const;
+ CXSourceLocation getLocation() const override;
/// \brief Return the spelling of the diagnostic.
- virtual CXString getSpelling() const;
+ CXString getSpelling() const override;
/// \brief Return the text for the diagnostic option.
- virtual CXString getDiagnosticOption(CXString *Disable) const;
-
+ CXString getDiagnosticOption(CXString *Disable) const override;
+
/// \brief Return the category of the diagnostic.
- virtual unsigned getCategory() const;
-
+ unsigned getCategory() const override;
+
/// \brief Return the category string of the diagnostic.
- virtual CXString getCategoryText() const;
+ CXString getCategoryText() const override;
/// \brief Return the number of source ranges for the diagnostic.
- virtual unsigned getNumRanges() const;
-
+ unsigned getNumRanges() const override;
+
/// \brief Return the source ranges for the diagnostic.
- virtual CXSourceRange getRange(unsigned Range) const;
+ CXSourceRange getRange(unsigned Range) const override;
/// \brief Return the number of FixIts.
- virtual unsigned getNumFixIts() const;
+ unsigned getNumFixIts() const override;
/// \brief Return the FixIt information (source range and inserted text).
- virtual CXString getFixIt(unsigned FixIt,
- CXSourceRange *ReplacementRange) const;
+ CXString getFixIt(unsigned FixIt,
+ CXSourceRange *ReplacementRange) const override;
static bool classof(const CXDiagnosticImpl *D) {
return D->getKind() == StoredDiagnosticKind;
virtual ~CXLoadedDiagnostic();
/// \brief Return the severity of the diagnostic.
- virtual CXDiagnosticSeverity getSeverity() const;
-
+ CXDiagnosticSeverity getSeverity() const override;
+
/// \brief Return the location of the diagnostic.
- virtual CXSourceLocation getLocation() const;
-
+ CXSourceLocation getLocation() const override;
+
/// \brief Return the spelling of the diagnostic.
- virtual CXString getSpelling() const;
-
+ CXString getSpelling() const override;
+
/// \brief Return the text for the diagnostic option.
- virtual CXString getDiagnosticOption(CXString *Disable) const;
-
+ CXString getDiagnosticOption(CXString *Disable) const override;
+
/// \brief Return the category of the diagnostic.
- virtual unsigned getCategory() const;
-
+ unsigned getCategory() const override;
+
/// \brief Return the category string of the diagnostic.
- virtual CXString getCategoryText() const;
-
+ CXString getCategoryText() const override;
+
/// \brief Return the number of source ranges for the diagnostic.
- virtual unsigned getNumRanges() const;
-
+ unsigned getNumRanges() const override;
+
/// \brief Return the source ranges for the diagnostic.
- virtual CXSourceRange getRange(unsigned Range) const;
-
+ CXSourceRange getRange(unsigned Range) const override;
+
/// \brief Return the number of FixIts.
- virtual unsigned getNumFixIts() const;
-
+ unsigned getNumFixIts() const override;
+
/// \brief Return the FixIt information (source range and inserted text).
- virtual CXString getFixIt(unsigned FixIt,
- CXSourceRange *ReplacementRange) const;
-
+ CXString getFixIt(unsigned FixIt,
+ CXSourceRange *ReplacementRange) const override;
+
static bool classof(const CXDiagnosticImpl *D) {
return D->getKind() == LoadedDiagnosticKind;
}
IndexPPCallbacks(Preprocessor &PP, IndexingContext &indexCtx)
: PP(PP), IndexCtx(indexCtx), IsMainFileEntered(false) { }
- virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason,
- SrcMgr::CharacteristicKind FileType, FileID PrevFID) {
+ void FileChanged(SourceLocation Loc, FileChangeReason Reason,
+ SrcMgr::CharacteristicKind FileType, FileID PrevFID) override {
if (IsMainFileEntered)
return;
}
}
- virtual void InclusionDirective(SourceLocation HashLoc,
- const Token &IncludeTok,
- StringRef FileName,
- bool IsAngled,
- CharSourceRange FilenameRange,
- const FileEntry *File,
- StringRef SearchPath,
- StringRef RelativePath,
- const Module *Imported) {
+ void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
+ StringRef FileName, bool IsAngled,
+ CharSourceRange FilenameRange, const FileEntry *File,
+ StringRef SearchPath, StringRef RelativePath,
+ const Module *Imported) override {
bool isImport = (IncludeTok.is(tok::identifier) &&
IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import);
IndexCtx.ppIncludedFile(HashLoc, FileName, File, isImport, IsAngled,
}
/// MacroDefined - This hook is called whenever a macro definition is seen.
- virtual void MacroDefined(const Token &Id, const MacroDirective *MD) {
- }
+ void MacroDefined(const Token &Id, const MacroDirective *MD) override {}
/// MacroUndefined - This hook is called whenever a macro #undef is seen.
/// MI is released immediately following this callback.
- virtual void MacroUndefined(const Token &MacroNameTok,
- const MacroDirective *MD) {
- }
+ void MacroUndefined(const Token &MacroNameTok,
+ const MacroDirective *MD) override {}
/// MacroExpands - This is called by when a macro invocation is found.
- virtual void MacroExpands(const Token &MacroNameTok, const MacroDirective *MD,
- SourceRange Range, const MacroArgs *Args) {
- }
+ void MacroExpands(const Token &MacroNameTok, const MacroDirective *MD,
+ SourceRange Range, const MacroArgs *Args) override {}
/// SourceRangeSkipped - This hook is called when a source range is skipped.
/// \param Range The SourceRange that was skipped. The range begins at the
/// #if/#else directive and ends after the #endif/#else directive.
- virtual void SourceRangeSkipped(SourceRange Range) {
- }
+ void SourceRangeSkipped(SourceRange Range) override {}
};
//===----------------------------------------------------------------------===//
// ASTConsumer Implementation
- virtual void Initialize(ASTContext &Context) {
+ void Initialize(ASTContext &Context) override {
IndexCtx.setASTContext(Context);
IndexCtx.startedTranslationUnit();
}
- virtual void HandleTranslationUnit(ASTContext &Ctx) {
+ void HandleTranslationUnit(ASTContext &Ctx) override {
if (SKCtrl)
SKCtrl->finished();
}
- virtual bool HandleTopLevelDecl(DeclGroupRef DG) {
+ bool HandleTopLevelDecl(DeclGroupRef DG) override {
IndexCtx.indexDeclGroupRef(DG);
return !IndexCtx.shouldAbort();
}
/// \brief Handle the specified top-level declaration that occurred inside
/// and ObjC container.
- virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) {
+ void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override {
// They will be handled after the interface is seen first.
IndexCtx.addTUDeclInObjCContainer(D);
}
/// \brief This is called by the AST reader when deserializing things.
/// The default implementation forwards to HandleTopLevelDecl but we don't
/// care about them when indexing, so have an empty definition.
- virtual void HandleInterestingDecl(DeclGroupRef D) {}
+ void HandleInterestingDecl(DeclGroupRef D) override {}
- virtual void HandleTagDeclDefinition(TagDecl *D) {
+ void HandleTagDeclDefinition(TagDecl *D) override {
if (!IndexCtx.shouldIndexImplicitTemplateInsts())
return;
IndexCtx.indexDecl(D);
}
- virtual void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) {
+ void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override {
if (!IndexCtx.shouldIndexImplicitTemplateInsts())
return;
IndexCtx.indexDecl(D);
}
- virtual bool shouldSkipFunctionBody(Decl *D) {
+ bool shouldSkipFunctionBody(Decl *D) override {
if (!SKCtrl) {
// Always skip bodies.
return true;
SmallVector<StoredDiagnostic, 4> Errors;
public:
- virtual void HandleDiagnostic(DiagnosticsEngine::Level level,
- const Diagnostic &Info) {
+ void HandleDiagnostic(DiagnosticsEngine::Level level,
+ const Diagnostic &Info) override {
if (level >= DiagnosticsEngine::Error)
Errors.push_back(StoredDiagnostic(level, Info));
}
: IndexCtx(clientData, indexCallbacks, indexOptions, cxTU),
CXTU(cxTU), SKData(skData) { }
- virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
+ ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) override {
PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
if (!PPOpts.ImplicitPCHInclude.empty()) {
return new IndexingConsumer(IndexCtx, SKCtrl.get());
}
- virtual void EndSourceFileAction() {
+ void EndSourceFileAction() override {
indexDiagnostics(CXTU, IndexCtx);
}
- virtual TranslationUnitKind getTranslationUnitKind() {
+ TranslationUnitKind getTranslationUnitKind() override {
if (IndexCtx.shouldIndexImplicitTemplateInsts())
return TU_Complete;
else
return TU_Prefix;
}
- virtual bool hasCodeCompletionSupport() const { return false; }
+ bool hasCodeCompletionSupport() const override { return false; }
};
//===----------------------------------------------------------------------===//