Fix a use-after-free found in libclang when doing code completion. The
authorChandler Carruth <chandlerc@gmail.com>
Sun, 18 Aug 2013 07:20:52 +0000 (07:20 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 18 Aug 2013 07:20:52 +0000 (07:20 +0000)
commit7deaae76ec16d910fb9a9d676541024dfd727288
treed272a2878fb46e400dc8e9b72389a5ccee0af007
parent5043815a60aa4cf7f8e988679bc762c84936b762
Fix a use-after-free found in libclang when doing code completion. The
loop processing the candidates can cause new declerations to be added to
the context, invalidating lookup_result. To avoid that, make a copy of
the list of declarations to iterate over.

I don't have a way to check in a test case for this as it involves
a giant pile of source code and a generated PCH file used to accelerate
code completion, all of this running under ASan.

llvm-svn: 188623
clang/lib/Sema/SemaLookup.cpp