Improvements on Macro removal.

This commit is contained in:
CristinaCristescu 2013-10-31 10:54:38 +01:00 committed by sftnight
parent 5eb9f3ee5c
commit 5d42bd5e8c
3 changed files with 4 additions and 12 deletions

View File

@ -80,6 +80,8 @@ namespace cling {
/// call sequence that originally occurred in clang.
///
struct MacroDecl {
// We need to store both the IdentifierInfo and the MacroDirective
// because the Preprocessor stores the macros in a DenseMap<II, MD>.
clang::IdentifierInfo* m_II;
const clang::MacroDirective* m_MD;
MacroDecl(clang::IdentifierInfo* II, const clang::MacroDirective* MD)
@ -411,9 +413,6 @@ namespace cling {
///\brief Appends teh declaration of a macro.
void append(MacroDecl MDE);
///\brief Appends teh declaration of a macro.
void forceAppend(MacroDecl MDE);
///\brief Clears all declarations in the transaction.
///

View File

@ -788,7 +788,8 @@ namespace cling {
PP.removeMacro(MacroD.m_II, MacroD.m_MD);
// ExistsInPP
// true true -> true // In the context and can delete
// true true -> true // In the Preprocessor Macros
// and can delete
// false true -> assert // Not in the Preprocessor Macros
// but can delete ?
assert(!ExistsInPP && \

View File

@ -178,14 +178,6 @@ namespace cling {
assert(!MDE.m_MD && "Appending null MacroDirective?!");
assert(getState() == kCollecting
&& "Cannot append declarations in current state.");
forceAppend(MDE);
}
void Transaction::forceAppend(MacroDecl MDE) {
assert(!MDE.m_II && "Appending null IdentifierInfo?!");
assert(!MDE.m_MD && "Appending null MacroDirective?!");
assert(getState() == kCollecting
&& "Cannot append declarations in current state.");
#ifndef NDEBUG
// Check for duplicates
for (size_t i = 0, e = m_MacroDeclQueue.size(); i < e; ++i) {