In-depth study of Clang (vi) Clang lexer code reading notes Preprocesser

Source: Internet
Author: User

Clang/include/clang/lex/preprocesser.h This file is a header file that contains the definition of the clang::P Reprocesser class. It is a preprocessing header file for the Class C language (c, C + +, Object C). That is, the preprocessing of the Class C language will use the code here.
00082//\brief Context in which macro name was used.00083 enum Macrouse {00084   mu_other  = 0,  //other than #d  Efine or #undef00085   mu_define = 1,  //Macro name specified in #define00086   mu_undef  = 2   //Macro name specified in #undef00087};
This enumeration is simple enough to determine which macros are used by the enumeration values. In addition to define and undef, the others are categorized below the Mu_other category.
00089//\ Brief engages in a tight little dance with the lexer to efficiently00090//preprocess tokens.00091///00092//Lexers K Now only on tokens within a single source file, and don ' t00093//know anything about preprocessor-level issues like T He \ #include stack,00094//token expansion, etc.00095 class Preprocessor:public refcountedbase<preprocessor> {00       096 intrusiverefcntptr<preprocessoroptions> ppopts;00097 diagnosticsengine *Diags;00098 LangOptions &langopts;00099 Const Targetinfo *target;00100 filemanager &filemgr;00101 sourcemanager &S ourcemgr;00102 std::unique_ptr<scratchbuffer> scratchbuf;00103 headersearch &HeaderInfo;00104 ModuleL Oader &themoduleloader; 
Here you can see the definition of the preprocessor class, which is the subclass of the template class refcountedbase<preprocessor>. At the same time you can look at several member variables of these classes, diagnosticsengine-diagnostic engine, langoptions-received compilation options, targetinfo-storage target information, filemanager-File Manager, sourcemanager-source Manager, Moduleloader-module loader.
00118//Identifiers for BUILTIN macros and other builtins.00119 identifierinfo *ident__line__, *ident__file__;   __line__, __file__00120 identifierinfo *ident__date__, *ident__time__;          __date__, __time__00121 identifierinfo *ident__include_level__;              __include_level__00122 Identifierinfo *ident__base_file__;              __base_file__00123 Identifierinfo *ident__timestamp__;                __timestamp__00124 Identifierinfo *ident__counter__;    __counter__00125 Identifierinfo *ident_pragma, *ident__pragma;               _pragma, __pragma00126 identifierinfo *ident__identifier;                __identifier00127 Identifierinfo *ident__va_args__;              __va_args__00128 Identifierinfo *ident__has_feature;            __has_feature00129 Identifierinfo *ident__has_extension;              __has_extension00130 Identifierinfo *ident__has_builtin;  __has_builtin00131 Identifierinfo *ident__has_attribute;          __has_attribute00132 Identifierinfo *ident__has_include;         __has_include00133 Identifierinfo *ident__has_include_next;              __has_include_next00134 Identifierinfo *ident__has_warning;            __has_warning00135 Identifierinfo *ident__is_identifier;          __is_identifier00136 Identifierinfo *ident__building_module;                 __building_module00137 Identifierinfo *ident__module__;        __module__00138 Identifierinfo *ident__has_cpp_attribute; __has_cpp_attribute
In addition, the Preprocesser class contains Nechanhong and other built-in identifiers that are saved using the Identifierinfo pointer.



In-depth study of Clang (vi) Clang lexer code reading notes Preprocesser

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.