diff options
author | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 056abd2059c65a3e908193aeae16fad98017437c (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /lib/Lex/Pragma.cpp | |
parent | cc73504950eb7b5dff2dded9bedd67bc36d64641 (diff) | |
download | FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz |
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'lib/Lex/Pragma.cpp')
-rw-r--r-- | lib/Lex/Pragma.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index c9cc4ad..e7e6c37 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -43,7 +43,6 @@ void EmptyPragmaHandler::HandlePragma(Preprocessor &PP, // PragmaNamespace Implementation. //===----------------------------------------------------------------------===// - PragmaNamespace::~PragmaNamespace() { for (llvm::StringMap<PragmaHandler*>::iterator I = Handlers.begin(), E = Handlers.end(); I != E; ++I) @@ -251,7 +250,7 @@ void Preprocessor::Handle_Pragma(Token &Tok) { // where we can lex it. Token TmpTok; TmpTok.startToken(); - CreateString(&StrVal[0], StrVal.size(), TmpTok); + CreateString(StrVal, TmpTok); SourceLocation TokLoc = TmpTok.getLocation(); // Make and enter a lexer object so that we lex and expand the tokens just @@ -683,7 +682,7 @@ IdentifierInfo *Preprocessor::ParsePragmaPushOrPopMacro(Token &Tok) { Token MacroTok; MacroTok.startToken(); MacroTok.setKind(tok::raw_identifier); - CreateString(&StrVal[1], StrVal.size() - 2, MacroTok); + CreateString(StringRef(&StrVal[1], StrVal.size() - 2), MacroTok); // Get the IdentifierInfo of MacroToPushTok. return LookUpIdentifierInfo(MacroTok); @@ -733,19 +732,22 @@ void Preprocessor::HandlePragmaPopMacro(Token &PopMacroTok) { llvm::DenseMap<IdentifierInfo*, std::vector<MacroInfo*> >::iterator iter = PragmaPushMacroInfo.find(IdentInfo); if (iter != PragmaPushMacroInfo.end()) { - // Release the MacroInfo currently associated with IdentInfo. - MacroInfo *CurrentMI = getMacroInfo(IdentInfo); - if (CurrentMI) { + // Forget the MacroInfo currently associated with IdentInfo. + if (MacroInfo *CurrentMI = getMacroInfo(IdentInfo)) { if (CurrentMI->isWarnIfUnused()) WarnUnusedMacroLocs.erase(CurrentMI->getDefinitionLoc()); - ReleaseMacroInfo(CurrentMI); + UndefineMacro(IdentInfo, CurrentMI, MessageLoc); } // Get the MacroInfo we want to reinstall. MacroInfo *MacroToReInstall = iter->second.back(); - // Reinstall the previously pushed macro. - setMacroInfo(IdentInfo, MacroToReInstall); + if (MacroToReInstall) { + // Reinstall the previously pushed macro. + setMacroInfo(IdentInfo, MacroToReInstall); + } else if (IdentInfo->hasMacroDefinition()) { + clearMacroInfo(IdentInfo); + } // Pop PragmaPushMacroInfo stack. iter->second.pop_back(); @@ -1009,7 +1011,7 @@ struct PragmaDebugHandler : public PragmaHandler { if (II->isStr("assert")) { llvm_unreachable("This is an assertion!"); } else if (II->isStr("crash")) { - *(volatile int*) 0x11 = 0; + LLVM_BUILTIN_TRAP; } else if (II->isStr("parser_crash")) { Token Crasher; Crasher.setKind(tok::annot_pragma_parser_crash); |