Go to the documentation of this file.
13 #ifndef LLVM_CLANG_LEX_PRAGMA_H
14 #define LLVM_CLANG_LEX_PRAGMA_H
18 #include "llvm/ADT/StringMap.h"
19 #include "llvm/ADT/StringRef.h"
24 class PragmaNamespace;
73 StringRef
getName()
const {
return Name; }
75 Token &FirstToken) = 0;
89 Token &FirstToken)
override;
99 llvm::StringMap<std::unique_ptr<PragmaHandler>> Handlers;
109 bool IgnoreNull =
true)
const;
118 bool IsEmpty()
const {
return Handlers.empty(); }
121 Token &Tok)
override;
128 #endif // LLVM_CLANG_LEX_PRAGMA_H
PragmaIntroducerKind
Describes how the pragma was introduced, e.g., with #pragma, _Pragma, or __pragma.
@ PIK_HashPragma
The pragma was introduced via #pragma.
Encodes a location in the source.
PragmaNamespace * getIfNamespace() override
getIfNamespace - If this is a namespace, return it.
Token - This structure provides full information about a lexed token.
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer, Token &FirstToken) override
@ PIK___pragma
The pragma was introduced via the Microsoft __pragma(token-string).
PragmaHandler(StringRef name)
void RemovePragmaHandler(PragmaHandler *Handler)
RemovePragmaHandler - Remove the given handler from the namespace.
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer, Token &Tok) override
virtual PragmaNamespace * getIfNamespace()
getIfNamespace - If this is a namespace, return it.
PragmaIntroducerKind Kind
StringRef getName() const
PragmaNamespace(StringRef Name)
Describes how and where the pragma was introduced.
PragmaHandler - Instances of this interface defined to handle the various pragmas that the language f...
void AddPragma(PragmaHandler *Handler)
AddPragma - Add a pragma to this namespace.
EmptyPragmaHandler - A pragma handler which takes no action, which can be used to ignore particular p...
EmptyPragmaHandler(StringRef Name=StringRef())
virtual void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer, Token &FirstToken)=0
PragmaNamespace - This PragmaHandler subdivides the namespace of pragmas, allowing hierarchical pragm...
@ PIK__Pragma
The pragma was introduced via the C99 _Pragma(string-literal).
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
PragmaHandler * FindHandler(StringRef Name, bool IgnoreNull=true) const
FindHandler - Check to see if there is already a handler for the specified name.