Thrift: Fix a bug in local reflection generation.
authorDavid Reiss <dreiss@apache.org>
Fri, 8 Feb 2008 21:58:06 +0000 (21:58 +0000)
committerDavid Reiss <dreiss@apache.org>
Fri, 8 Feb 2008 21:58:06 +0000 (21:58 +0000)
commit3c5d2fd9a87f3bdb07aac7afa2c50e5e90d88fa8
treec25991c794c7d882faa6ced9af0534d39de7562b
parent0c90f6f8af1d64ec9272bb2f6092336f3d0b8df8
Thrift: Fix a bug in local reflection generation.

Summary:
The problem was that in generate_local_reflection, we refused to
generate reflections for types defined in another program, including enums.
But in local_reflection_name, we treated enums like base types,
assuming that their reflections were always defined in this program.
One solution would be to treat enums like base types everywhere, and always
generate their reflections in the program where they were being used.
But this change takes the opposite approach.  We now always
generate fingerprints for enums in the program in which they are defined,
even if they are not used there.

Reviewed By: mcslee

Test Plan:
Got the following files to build and link correctly with -dense.

dreiss@dreiss-vmware:reflection:thrift/test$ tail test[12].thrift
==> test1.thrift <==
enum foo { bar }

==> test2.thrift <==
include "test1.thrift"
struct baz {
  1: test1.foo qux
}

Revert Plan: ok

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665468 13f79535-47bb-0310-9956-ffa450edef68
compiler/cpp/src/generate/t_cpp_generator.cc
compiler/cpp/src/main.cc