r201825 - Revert the removal of PPCallbacks::PragmaComment() in r201821
Reid Kleckner
reid at kleckner.net
Thu Feb 20 15:37:46 PST 2014
Author: rnk
Date: Thu Feb 20 17:37:45 2014
New Revision: 201825
URL: http://llvm.org/viewvc/llvm-project?rev=201825&view=rev
Log:
Revert the removal of PPCallbacks::PragmaComment() in r201821
The pp-trace clang tool was using it successfully. We can still delete
the callbacks in Frontend/PrintPreprocessedOutput.cpp because they were
effectively dead.
Modified:
cfe/trunk/include/clang/Lex/PPCallbacks.h
cfe/trunk/lib/Parse/ParsePragma.cpp
Modified: cfe/trunk/include/clang/Lex/PPCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PPCallbacks.h?rev=201825&r1=201824&r2=201825&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PPCallbacks.h (original)
+++ cfe/trunk/include/clang/Lex/PPCallbacks.h Thu Feb 20 17:37:45 2014
@@ -161,6 +161,18 @@ public:
PragmaIntroducerKind Introducer) {
}
+ /// \brief Callback invoked when a \#pragma comment directive is read.
+ virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,
+ const std::string &Str) {
+ }
+
+ /// \brief Callback invoked when a \#pragma detect_mismatch directive is
+ /// read.
+ virtual void PragmaDetectMismatch(SourceLocation Loc,
+ const std::string &Name,
+ const std::string &Value) {
+ }
+
/// \brief Callback invoked when a \#pragma clang __debug directive is read.
/// \param Loc The location of the debug directive.
/// \param DebugType The identifier following __debug.
@@ -375,6 +387,19 @@ public:
Second->Ident(Loc, str);
}
+ virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind,
+ const std::string &Str) {
+ First->PragmaComment(Loc, Kind, Str);
+ Second->PragmaComment(Loc, Kind, Str);
+ }
+
+ virtual void PragmaDetectMismatch(SourceLocation Loc,
+ const std::string &Name,
+ const std::string &Value) {
+ First->PragmaDetectMismatch(Loc, Name, Value);
+ Second->PragmaDetectMismatch(Loc, Name, Value);
+ }
+
virtual void PragmaMessage(SourceLocation Loc, StringRef Namespace,
PragmaMessageKind Kind, StringRef Str) {
First->PragmaMessage(Loc, Namespace, Kind, Str);
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=201825&r1=201824&r2=201825&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Thu Feb 20 17:37:45 2014
@@ -1253,6 +1253,11 @@ void PragmaDetectMismatchHandler::Handle
return;
}
+ // If the pragma is lexically sound, notify any interested PPCallbacks.
+ if (PP.getPPCallbacks())
+ PP.getPPCallbacks()->PragmaDetectMismatch(CommentLoc, NameString,
+ ValueString);
+
Actions.ActOnPragmaDetectMismatch(NameString, ValueString);
}
@@ -1323,5 +1328,9 @@ void PragmaCommentHandler::HandlePragma(
return;
}
+ // If the pragma is lexically sound, notify any interested PPCallbacks.
+ if (PP.getPPCallbacks())
+ PP.getPPCallbacks()->PragmaComment(CommentLoc, II, ArgumentString);
+
Actions.ActOnPragmaMSComment(Kind, ArgumentString);
}
More information about the cfe-commits
mailing list