forked from OSchip/llvm-project
parent
374934cb8a
commit
66f5ab26e3
|
@ -408,6 +408,11 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
|
|||
public:
|
||||
MacroState() : MacroState(nullptr) {}
|
||||
MacroState(MacroDirective *MD) : State(MD) {}
|
||||
void destroy() {
|
||||
if (auto *Info = State.dyn_cast<ModuleMacroInfo*>())
|
||||
Info->~ModuleMacroInfo();
|
||||
State = (MacroDirective*)nullptr;
|
||||
}
|
||||
MacroDirective *getLatest() const {
|
||||
if (auto *Info = State.dyn_cast<ModuleMacroInfo*>())
|
||||
return Info->MD;
|
||||
|
|
|
@ -142,6 +142,9 @@ Preprocessor::Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts,
|
|||
Preprocessor::~Preprocessor() {
|
||||
assert(BacktrackPositions.empty() && "EnableBacktrack/Backtrack imbalance!");
|
||||
|
||||
for (auto &Macro : Macros)
|
||||
Macro.second.destroy();
|
||||
|
||||
IncludeMacroStack.clear();
|
||||
|
||||
// Destroy any macro definitions.
|
||||
|
|
Loading…
Reference in New Issue