This change attempts to address
https://bugs.llvm.org/show_bug.cgi?id=48588.
In certain cases, it appears that VA_ARGS is not in PrevParamMap
before it's accessed using at(). This change simply skips injectRange()
if VA_ARGS is not found in PrevParamMap.
The crash seen is described below, the case this was discovered in was
distilled into a reproducer inserted into the LIT tests for this module.
terminate called after throwing an instance of 'std::out_of_range'
what(): map::at #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) <base>/llvm/lib/Support/Unix/Signals.inc:563:22
...
#11 std::__throw_out_of_range(char const*)
<base>/libstdc++-v3/src/c++11/functexcept.cc:82:5
#12 std::map<clang::IdentifierInfo const*,
llvm::SmallVector<clang::Token, 2u>, std::less<clang::IdentifierInfo const*>, std::allocator<std::pair<clang::IdentifierInfo const* const, llvm::SmallVector<clang::Token, 2u> > > >::at(clang::IdentifierInfo const* const&) const <base>/gcc/9.3.0/include/c++/9.3.0/bits/stl_map.h:549:10
#13 getMacroExpansionInfo((anonymous namespace)::MacroParamMap const&,
clang::SourceLocation, clang::Preprocessor const&) <base>/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:1242:66
...
Btw this lookup supposed to be successful. Always. Which suggests me that there are even more logic bug lurking there.
Without using 'at' here we wouldn't notice it, which is lucky.