[all-commits] [llvm/llvm-project] be0d79: [analyzer][MacroExpansion] Fix a crash where multi...
Kristóf Umann via All-commits
all-commits at lists.llvm.org
Fri Sep 11 05:08:24 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: be0d79f32930fe780dc89ba96dac0ba163f7ec50
https://github.com/llvm/llvm-project/commit/be0d79f32930fe780dc89ba96dac0ba163f7ec50
Author: Kristóf Umann <dkszelethus at gmail.com>
Date: 2020-09-11 (Fri, 11 Sep 2020)
Changed paths:
M clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
M clang/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
M clang/test/Analysis/plist-macros-with-expansion.cpp
Log Message:
-----------
[analyzer][MacroExpansion] Fix a crash where multiple parameters resolved to __VA_ARGS__
In short, macro expansions handled the case where a variadic parameter mapped to
multiple arguments, but not the other way around. An internal ticket was
submitted that demonstrated that we fail an assertion. Macro expansion so far
worked by lexing the source code token-by-token and using the Preprocessor to
turn these tokens into identifiers or just get their proper spelling, but what
this counter intuitively doesn't do, is actually expand these macros, so we have
to do the heavy lifting -- in this case, figure out what __VA_ARGS__ expands
into. Since this case can only occur in a nested macro, the information we
gathered from the containing macro does contain this information. If a parameter
resolves to __VA_ARGS__, we need to temporarily stop getting our tokens from the
lexer, and get the tokens from what __VA_ARGS__ maps to.
Differential Revision: https://reviews.llvm.org/D86135
More information about the All-commits
mailing list