[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 16 04:38:33 PDT 2024
vabridgers wrote:
Hello @jcsxky , here's a simplified reproducer that drives the crash from a shell script. All you need to do is make sure your clang build is in the path. I repro'd this on a RHEL7 host, just in case that details matters (but I don't think it will).
This script echos the simplified source files and the accompanying externalDefMap.txt needed to drive a CTU analysis.
# remove, regen the ctu directory and externalDefMap.txt file. This file corresponds to
# to the subsequently generated header and source files and is provided for simplicity of crash repro
rm -rf ctudir
mkdir ctudir
touch ctudir/externalDefMap.txt
echo '11:c:@F at test0# test.cpp.ast' >> ctudir/externalDefMap.txt
echo '35:c:@N at Bstrlib@S at CBString@F at CBString# bstrwrap.cpp.ast' >> ctudir/externalDefMap.txt
# remove, regen the cpp file
rm -rf test.cpp
echo '#include "bstrwrap.h"' >> test.cpp
echo 'int test0 (void) {' >> test.cpp
echo ' Bstrlib::CBString c0;' >> test.cpp
echo ' return 0;' >> test.cpp
echo '}' >> test.cpp
# remove, regen the cpp file
rm -rf bstrwrap.cpp
echo '#include "bstrwrap.h"' >> bstrwrap.cpp
echo '#include <iostream>' >> bstrwrap.cpp
echo 'Bstrlib::CBString::CBString () {' >> bstrwrap.cpp
echo '}' >> bstrwrap.cpp
# remove, regen the header file
rm -rf bstrwrap.h
echo '#include <string>' >> bstrwrap.h
echo 'namespace Bstrlib {' >> bstrwrap.h
echo 'struct CBString {' >> bstrwrap.h
echo ' CBString ();' >> bstrwrap.h
echo '};' >> bstrwrap.h
echo 'extern std::istream& getline (void);' >> bstrwrap.h
echo '}' >> bstrwrap.h
# generate the ASTs
clang bstrwrap.cpp -emit-ast -D__clang_analyzer__ -w -o ctudir/bstrwrap.cpp.ast
clang test.cpp -emit-ast -D__clang_analyzer__ -w -o ctudir/test.cpp.ast
# drive the analysis exposing the AST import crash
#clang --analyze -Xclang -analyzer-config -Xclang experimental-enable-naive-ctu-analysis=true -Xclang -analyzer-config -Xclang ctu-dir=ctudir -Xclang -analyzer-config -Xclang display-ctu-progress=true test.cpp
clang --analyze -Xclang -analyzer-config -Xclang experimental-enable-naive-ctu-analysis=true -Xclang -analyzer-config -Xclang ctu-dir=ctudir test.cpp
https://github.com/llvm/llvm-project/pull/87144
More information about the cfe-commits
mailing list