clang
3.7.0
|
Implements # directive processing for the Preprocessor. More...
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/CodeCompletionHandler.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/ModuleLoader.h"
#include "clang/Lex/Pragma.h"
#include "llvm/ADT/APInt.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SaveAndRestore.h"
Go to the source code of this file.
Classes | |
class | clang::Preprocessor::ResetMacroExpansionHelper |
Enumerations | |
enum | MacroDiag { MD_NoWarn, MD_KeywordDef, MD_ReservedMacro } |
Enumerates possible cases of #define/#undef a reserved identifier. More... | |
Functions | |
static bool | isReservedId (StringRef Text, const LangOptions &Lang) |
Checks if the specified identifier is reserved in the specified language. This function does not check if the identifier is a keyword. More... | |
static MacroDiag | shouldWarnOnMacroDef (Preprocessor &PP, IdentifierInfo *II) |
static MacroDiag | shouldWarnOnMacroUndef (Preprocessor &PP, IdentifierInfo *II) |
static bool | GetLineValue (Token &DigitTok, unsigned &Val, unsigned DiagID, Preprocessor &PP, bool IsGNULineDirective=false) |
static bool | ReadLineMarkerFlags (bool &IsFileEntry, bool &IsFileExit, bool &IsSystemHeader, bool &IsExternCHeader, Preprocessor &PP) |
static void | EnterAnnotationToken (Preprocessor &PP, SourceLocation Begin, SourceLocation End, tok::TokenKind Kind, void *AnnotationVal) |
Push a token onto the token stream containing an annotation. More... | |
static void | diagnoseAutoModuleImport (Preprocessor &PP, SourceLocation HashLoc, Token &IncludeTok, ArrayRef< std::pair< IdentifierInfo *, SourceLocation >> Path, SourceLocation PathEnd) |
Produce a diagnostic informing the user that a #include or similar was implicitly treated as a module import. More... | |
static bool | isConfigurationPattern (Token &MacroName, MacroInfo *MI, const LangOptions &LOptions) |
Implements # directive processing for the Preprocessor.
Definition in file PPDirectives.cpp.
enum MacroDiag |
Enumerates possible cases of #define/#undef a reserved identifier.
Enumerator | |
---|---|
MD_NoWarn | |
MD_KeywordDef | |
MD_ReservedMacro |
Definition at line 92 of file PPDirectives.cpp.
|
static |
Produce a diagnostic informing the user that a #include or similar was implicitly treated as a module import.
Definition at line 1455 of file PPDirectives.cpp.
References clang::FixItHint::CreateReplacement(), clang::Preprocessor::Diag(), clang::Token::getIdentifierInfo(), clang::Preprocessor::getLangOpts(), and clang::IdentifierInfo::getPPKeywordID().
|
static |
Push a token onto the token stream containing an annotation.
Definition at line 1439 of file PPDirectives.cpp.
References clang::Preprocessor::EnterTokenStream(), clang::Token::setAnnotationEndLoc(), clang::Token::setAnnotationValue(), clang::Token::setKind(), clang::Token::setLocation(), and clang::Token::startToken().
|
static |
GetLineValue - Convert a numeric token into an unsigned value, emitting Diagnostic DiagID if it is invalid, and returning the value in Val.
Definition at line 937 of file PPDirectives.cpp.
References clang::Preprocessor::AdvanceToTokenCharacter(), clang::Preprocessor::Diag(), clang::Preprocessor::DiscardUntilEndOfDirective(), clang::Token::getLength(), clang::Token::getLocation(), clang::Preprocessor::getSpelling(), clang::isDigit(), and clang::Token::isNot().
Referenced by ReadLineMarkerFlags().
|
static |
|
static |
Checks if the specified identifier is reserved in the specified language. This function does not check if the identifier is a keyword.
Definition at line 101 of file PPDirectives.cpp.
References clang::isUppercase().
Referenced by shouldWarnOnMacroDef(), and shouldWarnOnMacroUndef().
|
static |
ReadLineMarkerFlags - Parse and validate any flags at the end of a GNU line marker directive.
Definition at line 1061 of file PPDirectives.cpp.
References clang::Preprocessor::Diag(), clang::Preprocessor::DiscardUntilEndOfDirective(), clang::SourceManager::getDecomposedExpansionLoc(), clang::PresumedLoc::getIncludeLoc(), GetLineValue(), clang::Token::getLocation(), clang::SourceManager::getPresumedLoc(), clang::Preprocessor::getSourceManager(), clang::Token::is(), clang::SourceLocation::isInvalid(), clang::PresumedLoc::isInvalid(), clang::Preprocessor::Lex(), and SM.
|
static |
Definition at line 118 of file PPDirectives.cpp.
References clang::Preprocessor::getLangOpts(), clang::IdentifierInfo::getName(), clang::IdentifierInfo::isKeyword(), isReservedId(), MD_KeywordDef, MD_NoWarn, and MD_ReservedMacro.
Referenced by clang::Preprocessor::CheckMacroName().
|
static |
Definition at line 130 of file PPDirectives.cpp.
References clang::Preprocessor::getLangOpts(), clang::IdentifierInfo::getName(), isReservedId(), MD_NoWarn, and MD_ReservedMacro.
Referenced by clang::Preprocessor::CheckMacroName().