@@ -2009,9 +2009,24 @@ std::vector<EntityRange> FragmentCollector::FindTLMs(void) {
2009
2009
if (IsUsed (dmd.value ())) {
2010
2010
add_macro (std::move (md));
2011
2011
used_defines.emplace_back (std::move (dmd.value ()));
2012
- break ;
2013
2012
}
2014
2013
continue ;
2014
+
2015
+ // Define directives can be embedded within macro expansions. Go locate
2016
+ // those, just in case we didn't cover them above.
2017
+ } else {
2018
+ for (auto maybe_def : FindDirectivesInMacro (md)) {
2019
+ if (auto def = pasta::DefineMacroDirective::From (maybe_def)) {
2020
+
2021
+ // Unconditionally add a `#define` that is inside of another macro
2022
+ // (e.g. an expansion) even if it isn't used.
2023
+ add_macro (def.value ());
2024
+
2025
+ if (IsUsed (def.value ())) {
2026
+ used_defines.emplace_back (std::move (def.value ()));
2027
+ }
2028
+ }
2029
+ }
2015
2030
}
2016
2031
2017
2032
add_macro (md);
@@ -2021,17 +2036,6 @@ std::vector<EntityRange> FragmentCollector::FindTLMs(void) {
2021
2036
// the relevant begin-of-file markers.
2022
2037
auto ild = pasta::IncludeLikeMacroDirective::From (md);
2023
2038
if (!ild) {
2024
-
2025
- // Define directives can be embedded within macro expansions. Go locate
2026
- // those, just in case we didn't cover them above.
2027
- for (auto dir : FindDirectivesInMacro (md)) {
2028
- if (auto dmd = pasta::DefineMacroDirective::From (dir)) {
2029
- if (IsUsed (dmd.value ())) {
2030
- used_defines.emplace_back (std::move (dmd.value ()));
2031
- }
2032
- }
2033
- }
2034
-
2035
2039
continue ;
2036
2040
}
2037
2041
@@ -2940,7 +2944,6 @@ void FragmentCollector::FillPendingFragments(EntityGroupRange group_range) {
2940
2944
2941
2945
// Things like namespaces.
2942
2946
if (ShouldHideFromIndexer (decl)) {
2943
- // LOG(ERROR) << "hidden " << RawEntity(decl);
2944
2947
continue ;
2945
2948
2946
2949
// E.g. if there's something like: `typedef struct page *pgtable_t;`,
0 commit comments