llvm-capstone/clang/lib/Lex/CMakeLists.txt
Alex Lorenz 6e2d36b60b Add clang source minimizer that reduces source to directives
that might affect the dependency list for a compilation

This commit introduces a dependency directives source minimizer to clang
that minimizes header and source files to the minimum necessary preprocessor
directives for evaluating includes. It reduces the source down to #define, #include,

The source minimizer works by lexing the input with a custom fast lexer that recognizes
the preprocessor directives it cares about, and emitting those directives in the minimized source.
It ignores source code, comments, and normalizes whitespace. It gives up and fails if seems
any directives that it doesn't recognize as valid (e.g. #define 0).

In addition to the source minimizer this patch adds a
-print-dependency-directives-minimized-source CC1 option that allows you to invoke the minimizer
from clang directly.

Differential Revision: https://reviews.llvm.org/D55463

llvm-svn: 362459
2019-06-03 22:59:17 +00:00

32 lines
590 B
CMake

# TODO: Add -maltivec when ARCH is PowerPC.
set(LLVM_LINK_COMPONENTS support)
add_clang_library(clangLex
DependencyDirectivesSourceMinimizer.cpp
HeaderMap.cpp
HeaderSearch.cpp
Lexer.cpp
LiteralSupport.cpp
MacroArgs.cpp
MacroInfo.cpp
ModuleMap.cpp
PPCaching.cpp
PPCallbacks.cpp
PPConditionalDirectiveRecord.cpp
PPDirectives.cpp
PPExpressions.cpp
PPLexerChange.cpp
PPMacroExpansion.cpp
Pragma.cpp
PreprocessingRecord.cpp
Preprocessor.cpp
PreprocessorLexer.cpp
ScratchBuffer.cpp
TokenConcatenation.cpp
TokenLexer.cpp
LINK_LIBS
clangBasic
)