diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-05 18:37:06 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-05 18:37:06 +0000 |
commit | 9b3932c0bc1e4b625fab1a79b0f5094f68efaf59 (patch) | |
tree | 62b0cbbe8e537a601a313f94d8b3e694ae4ea635 /clang/tools/libclang | |
parent | e929899a3ff9c7984568d1b8785b56437784bd33 (diff) | |
download | bcm5719-llvm-9b3932c0bc1e4b625fab1a79b0f5094f68efaf59.tar.gz bcm5719-llvm-9b3932c0bc1e4b625fab1a79b0f5094f68efaf59.zip |
Fix a marvelous chained AST writing bug, where we end up with the
following amusing sequence:
- AST writing schedules writing a type X* that it had never seen
before
- AST writing starts writing another declaration, ends up
deserializing X* from a prior AST file. Now we have two type IDs for
the same type!
- AST writer tries to write X*. It only has the lower-numbered ID
from the the prior AST file, so references to the higher-numbered ID
that was scheduled for writing go off into lalaland.
To fix this, keep the higher-numbered ID so we end up writing the type
twice. Since this issue occurs so rarely, and type records are
generally rather small, I deemed this better than the alternative: to
keep a separate mapping from the higher-numbered IDs to the
lower-numbered IDs, which we would end up having to check whenever we
want to deserialize any type.
Fixes <rdar://problem/8511624>, I think.
llvm-svn: 115647
Diffstat (limited to 'clang/tools/libclang')
-rw-r--r-- | clang/tools/libclang/CIndexUSRs.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/tools/libclang/CIndexUSRs.cpp b/clang/tools/libclang/CIndexUSRs.cpp index d7135b94be9..e22980df394 100644 --- a/clang/tools/libclang/CIndexUSRs.cpp +++ b/clang/tools/libclang/CIndexUSRs.cpp @@ -699,7 +699,8 @@ void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { break; case TemplateArgument::Declaration: - Visit(Arg.getAsDecl()); + if (Decl *D = Arg.getAsDecl()) + Visit(D); break; case TemplateArgument::Template: |