clang
3.7.0
|
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/Attributes.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/CodeCompletionHandler.h"
#include "clang/Lex/ExternalPreprocessorSource.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/MacroArgs.h"
#include "clang/Lex/MacroInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdio>
#include <ctime>
Go to the source code of this file.
Enumerations | |
enum | Bracket { Brace, Paren } |
enum Bracket |
Enumerator | |
---|---|
Brace | |
Paren |
Definition at line 570 of file PPMacroExpansion.cpp.
|
static |
CheckMatchedBrackets - Returns true if the braces and parentheses in the token vector are properly nested.
Definition at line 577 of file PPMacroExpansion.cpp.
Referenced by GenerateNewArgTokens().
|
static |
ComputeDATE_TIME - Compute the current time, enter it into the specified scratch buffer, then return DATELoc/TIMELoc locations with the position of the identifier tokens inserted.
Definition at line 1008 of file PPMacroExpansion.cpp.
References clang::Preprocessor::CreateString(), clang::Token::getLocation(), and clang::Token::startToken().
|
static |
Process __building_module(identifier) expression.
Definition at line 1408 of file PPMacroExpansion.cpp.
References clang::LangOptions::CurrentModule, clang::Preprocessor::Diag(), clang::Token::getIdentifierInfo(), clang::Preprocessor::getLangOpts(), clang::Token::getLocation(), clang::IdentifierInfo::getName(), clang::Token::isNot(), clang::Preprocessor::LexNonComment(), and clang::Result.
|
static |
EvaluateHasInclude - Process a '__has_include("path")' expression. Returns true if successful.
Definition at line 1371 of file PPMacroExpansion.cpp.
References EvaluateHasIncludeCommon().
|
static |
EvaluateHasIncludeCommon - Process a '__has_include("path")' or '__has_include_next("path")' expression. Returns true if successful.
Definition at line 1261 of file PPMacroExpansion.cpp.
References clang::Preprocessor::ConcatenateIncludeName(), clang::Preprocessor::Diag(), clang::Preprocessor::getCurrentLexer(), clang::Preprocessor::GetIncludeFilenameSpelling(), clang::Token::getKind(), clang::Token::getLocation(), clang::Preprocessor::getLocForEndOfToken(), clang::IdentifierInfo::getName(), clang::Preprocessor::getSpelling(), clang::Token::is(), clang::Token::isNot(), clang::Preprocessor::isParsingIfOrElifDirective(), clang::Preprocessor::Lex(), clang::PreprocessorLexer::LexIncludeFilename(), clang::Preprocessor::LexNonComment(), clang::Preprocessor::LookupFile(), clang::Token::setIdentifierInfo(), and clang::Token::setKind().
Referenced by EvaluateHasInclude(), and EvaluateHasIncludeNext().
|
static |
EvaluateHasIncludeNext - Process '__has_include_next("path")' expression. Returns true if successful.
Definition at line 1378 of file PPMacroExpansion.cpp.
References clang::Preprocessor::Diag(), EvaluateHasIncludeCommon(), clang::Preprocessor::GetCurDirLookup(), clang::Preprocessor::getCurrentLexer(), clang::Preprocessor::getCurrentSubmodule(), clang::PreprocessorLexer::getFileEntry(), and clang::Preprocessor::isInPrimaryFile().
|
static |
GenerateNewArgTokens - Returns true if OldTokens can be converted to a new vector of tokens in NewTokens. The new number of arguments will be placed in NumArgs and the ranges which need to surrounded in parentheses will be in ParenHints. Returns false if the token stream cannot be changed. If this is because of an initializer list starting a macro argument, the range of those initializer lists will be place in InitLists.
Definition at line 608 of file PPMacroExpansion.cpp.
References CheckMatchedBrackets(), clang::comments::tok::eof, clang::Preprocessor::getLocForEndOfToken(), clang::Token::setKind(), clang::Token::setLength(), clang::Token::setLocation(), and clang::Token::startToken().
|
static |
HasExtension - Return true if we recognize and implement the feature specified by the identifier, either as an extension or a standard language feature.
Definition at line 1211 of file PPMacroExpansion.cpp.
References clang::diag::Error, clang::Preprocessor::getDiagnostics(), clang::DiagnosticsEngine::getExtensionHandlingBehavior(), clang::Preprocessor::getLangOpts(), clang::IdentifierInfo::getName(), clang::Preprocessor::getTargetInfo(), HasFeature(), and clang::TargetInfo::isTLSSupported().
|
static |
HasFeature - Return true if we recognize and implement the feature specified by the identifier as a standard language feature.
Definition at line 1043 of file PPMacroExpansion.cpp.
References clang::Preprocessor::getLangOpts(), clang::IdentifierInfo::getName(), clang::Preprocessor::getTargetInfo(), clang::SanitizerSet::has(), clang::SanitizerSet::hasOneOf(), clang::ObjCRuntime::hasWeakClassImport(), clang::ObjCRuntime::isNonFragile(), clang::TargetInfo::isTLSSupported(), clang::LangOptions::ObjCRuntime, and clang::LangOptions::Sanitize.
Referenced by HasExtension(), and hasFeature().
|
static |
isTrivialSingleTokenExpansion - Return true if MI, which has a single token in its expansion, currently expands to that token literally.
Definition at line 338 of file PPMacroExpansion.cpp.
References clang::MacroInfo::arg_begin(), clang::MacroInfo::arg_end(), clang::Preprocessor::getExternalSource(), clang::Token::getIdentifierInfo(), clang::Preprocessor::getMacroInfo(), clang::MacroInfo::getReplacementToken(), clang::MacroInfo::isObjectLike(), clang::IdentifierInfo::isOutOfDate(), and clang::ExternalPreprocessorSource::updateOutOfDateIdentifier().
|
static |
RegisterBuiltinMacro - Register the specified identifier in the identifier table and mark it as a builtin macro to be expanded.
Definition at line 267 of file PPMacroExpansion.cpp.
References clang::Preprocessor::AllocateMacroInfo(), clang::Preprocessor::appendDefMacroDirective(), clang::Preprocessor::getIdentifierInfo(), and clang::MacroInfo::setIsBuiltinMacro().