diff options
Diffstat (limited to 'include/clang/Lex/PPCallbacks.h')
-rw-r--r-- | include/clang/Lex/PPCallbacks.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h new file mode 100644 index 0000000000..def8072dac --- /dev/null +++ b/include/clang/Lex/PPCallbacks.h @@ -0,0 +1,53 @@ +//===--- PPCallbacks.h - Callbacks for Preprocessor actions -----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Chris Lattner and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the PPCallbacks interface. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_LEX_PPCALLBACKS_H +#define LLVM_CLANG_LEX_PPCALLBACKS_H + +#include "clang/Lex/DirectoryLookup.h" +#include "clang/Basic/SourceLocation.h" +#include <string> + +namespace clang { + class SourceLocation; + +/// PPCallbacks - This interface provides a way to observe the actions of the +/// preprocessor as it does its thing. Clients can define their hooks here to +/// implement preprocessor level tools. +class PPCallbacks { +public: + virtual ~PPCallbacks(); + + enum FileChangeReason { + EnterFile, ExitFile, SystemHeaderPragma, RenameFile + }; + + /// FileChanged - This callback is invoked whenever a source file is + /// entered or exited. The SourceLocation indicates the new location, and + /// EnteringFile indicates whether this is because we are entering a new + /// #include'd file (when true) or whether we're exiting one because we ran + /// off the end (when false). + virtual void FileChanged(SourceLocation Loc, FileChangeReason Reason, + DirectoryLookup::DirType FileType) { + } + + /// Ident - This callback is invoked when a #ident or #sccs directive is read. + /// + virtual void Ident(SourceLocation Loc, const std::string &str) { + } + +}; + +} // end namespace clang + +#endif |