llvm-project/clang/lib/Lex
Nathan Sidwell bf6986d99e [clang] GCC directive extension extension: Hash NNN lines
Some time back I extended GCC's '# NNN' line marker semantics.
Specifically popping to a blank filename will restore the filename to
that of the popped-to include.  Restore to line 5 of including file
(escaped BOL #'s to avoid git eliding them):

\# 5 "" 2

Added documentation for this line control extension.

This was useful in developing modules tests, but turned out to also be
useful with machine-generated source code.  Specifically, a generated
include file that itself includes fragments from elsewhere.  The
ability to pop to the generated include file -- with its full path
prefix -- is useful for diagnostic & debug purposes.  For instance
something like:

// Machine generated -- DO NOT EDIT
Type Var = {
\# 7 "encoded.dsl" 1 // push to snippet-container
{snippet, of, code}
\# 6 " 2 // Restore to machined-generated source
,
};

// user-code
...
\#include "dsl.h"
...

That pop to "" will restore the filename to '..includepath../dsl.h',
which is better than restoring to plain "dsl.h".

Differential Revision: https://reviews.llvm.org/D113425
2021-11-09 07:31:03 -08:00
..
CMakeLists.txt Add clang source minimizer that reduces source to directives 2019-06-03 22:59:17 +00:00
DependencyDirectivesSourceMinimizer.cpp [clang][deps] Keep #pragma push_macro, pop_macro and include_alias when minimizing source code. 2021-11-01 16:04:52 -04:00
HeaderMap.cpp [clang][lex] Remark on search path usage 2021-10-12 12:20:55 +02:00
HeaderSearch.cpp [clang] Use StringRef::contains (NFC) 2021-10-21 08:58:19 -07:00
Lexer.cpp Implement delimited escape sequences. 2021-09-15 09:54:49 -04:00
LiteralSupport.cpp [clang] Use StringRef::contains (NFC) 2021-10-21 08:58:19 -07:00
MacroArgs.cpp Remove cache for macro arg stringization 2019-07-30 17:58:22 +00:00
MacroInfo.cpp
ModuleMap.cpp [clang] Use llvm::reverse. NFCI. 2021-11-07 14:24:33 +01:00
PPCaching.cpp [clang] Introduce SourceLocation::[U]IntTy typedefs. 2021-07-21 10:45:46 +01:00
PPCallbacks.cpp Avoid including FileManager.h from SourceManager.h 2020-03-11 13:53:12 -07:00
PPConditionalDirectiveRecord.cpp Add support for #elifdef and #elifndef 2021-05-27 08:57:47 -04:00
PPDirectives.cpp [clang] GCC directive extension extension: Hash NNN lines 2021-11-09 07:31:03 -08:00
PPExpressions.cpp Fixed warnings in target/parser codes produced by -Wbitwise-instead-of-logicala 2021-10-03 15:04:01 +02:00
PPLexerChange.cpp [clang] Use llvm::{count,count_if,find_if,all_of,none_of} (NFC) 2021-10-25 09:14:45 -07:00
PPMacroExpansion.cpp [clang] Use llvm::erase_if (NFC) 2021-10-17 13:50:29 -07:00
Pragma.cpp [clang][modules] NFC: Propagate import `SourceLocation` into `HeaderSearch::lookupModule` 2021-10-12 09:31:51 +02:00
PreprocessingRecord.cpp Add support for #elifdef and #elifndef 2021-05-27 08:57:47 -04:00
Preprocessor.cpp [clang] Use llvm::is_contained (NFC) 2021-10-13 20:41:55 -07:00
PreprocessorLexer.cpp
ScratchBuffer.cpp SourceManager: Make LastLineNoContentCache and ContentCache::SourceLineCache mutable, NFC 2020-10-23 13:22:47 -04:00
TokenConcatenation.cpp C++2a -> C++20 in some identifiers; NFC. 2020-04-21 15:37:19 -04:00
TokenLexer.cpp [clang] Introduce SourceLocation::[U]IntTy typedefs. 2021-07-21 10:45:46 +01:00
UnicodeCharSets.h Support Unicode 14 identifiers 2021-09-16 13:21:27 -04:00