aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-09-09 09:54:47 +0200
committerRaphael Isemann <teemperor@gmail.com>2020-09-09 10:05:57 +0200
commit32c8da41dc0cb99651823a1a21130c2cbdf688e1 (patch)
tree1e3a8583c7396488c8f874d67eddf1720e39cdae /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent5106a8b8f8d0d3dd6c3fc0554f05402d8d9177ef (diff)
downloadllvm-32c8da41dc0cb99651823a1a21130c2cbdf688e1.zip
llvm-32c8da41dc0cb99651823a1a21130c2cbdf688e1.tar.gz
llvm-32c8da41dc0cb99651823a1a21130c2cbdf688e1.tar.bz2
[lldb] Don't infinite loop in SemaSourceWithPriorities::CompleteType when trying to complete a forward decl
SemaSourceWithPriorities is a special SemaSource that wraps our normal LLDB ExternalASTSource and the ASTReader (which is used for the C++ module loading). It's only active when the `import-std-module` setting is turned on. The `CompleteType` function there in `SemaSourceWithPriorities` is looping over all ExternalASTSources and asks each to complete the type. However, that loop is in another loop that keeps doing that until the type is complete. If that function is ever called on a type that is a forward decl then that causes LLDB to go into an infinite loop. I remember I added that second loop and the comment because I thought I saw a similar pattern in some other Clang code, but after some grepping I can't find that code anywhere and it seems the rest of the code base only calls CompleteType once (It would also be kinda silly to have calling it multiple times). So it seems that's just a silly mistake. The is implicitly tested by importing `std::pair`, but I also added a simpler dedicated test that creates a dummy libc++ module with some forward declarations and then imports them into the scratch AST context. At some point the ASTImporter will check if one of the forward decls could be completed by the ExternalASTSource, which will cause the `SemaSourceWithPriorities` to go into an infinite loop once it receives the `CompleteType` call. Reviewed By: shafik Differential Revision: https://reviews.llvm.org/D87289
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions