summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-08-03 23:41:04 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-08-03 23:41:04 +0000
commit06f621d3496ed2549edcc763403a64812d35e2a0 (patch)
tree2ca2ae460a52030ab4b41a8e35a6a3b1948c0368 /clang/lib
parent065cabf43e015cbd3556989725a6a8c0cdfd3ec8 (diff)
downloadbcm5719-llvm-06f621d3496ed2549edcc763403a64812d35e2a0.tar.gz
bcm5719-llvm-06f621d3496ed2549edcc763403a64812d35e2a0.zip
Don't destroy MacroInfos if we find the macro definition is invalid; it'll get
destroyed on shutdown regardless. Fixes a double-delete. llvm-svn: 214675
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp12
1 files changed, 0 insertions, 12 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index da50bba598f..6b99ce6a403 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -90,13 +90,6 @@ Preprocessor::AllocateVisibilityMacroDirective(SourceLocation Loc,
return new (BP) VisibilityMacroDirective(Loc, isPublic);
}
-/// \brief Clean up a MacroInfo that was allocated but not used due to an
-/// error in the macro definition.
-void Preprocessor::ReleaseMacroInfo(MacroInfo *MI) {
- // Don't try to reuse the storage; this only happens on error paths.
- MI->~MacroInfo();
-}
-
/// \brief Read and discard all tokens remaining on the current line until
/// the tok::eod token is found.
void Preprocessor::DiscardUntilEndOfDirective() {
@@ -1902,8 +1895,6 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok,
// This is a function-like macro definition. Read the argument list.
MI->setIsFunctionLike();
if (ReadMacroDefinitionArgList(MI, LastTok)) {
- // Forget about MI.
- ReleaseMacroInfo(MI);
// Throw away the rest of the line.
if (CurPPLexer->ParsingPreprocessorDirective)
DiscardUntilEndOfDirective();
@@ -2028,7 +2019,6 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok,
continue;
} else {
Diag(Tok, diag::err_pp_stringize_not_parameter);
- ReleaseMacroInfo(MI);
// Disable __VA_ARGS__ again.
Ident__VA_ARGS__->setIsPoisoned(true);
@@ -2056,12 +2046,10 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok,
if (NumTokens != 0) {
if (MI->getReplacementToken(0).is(tok::hashhash)) {
Diag(MI->getReplacementToken(0), diag::err_paste_at_start);
- ReleaseMacroInfo(MI);
return;
}
if (MI->getReplacementToken(NumTokens-1).is(tok::hashhash)) {
Diag(MI->getReplacementToken(NumTokens-1), diag::err_paste_at_end);
- ReleaseMacroInfo(MI);
return;
}
}
OpenPOWER on IntegriCloud