[cfe-commits] r38636 - /cfe/cfe/trunk/Lex/Pragma.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:23:24 PDT 2007


Author: sabre
Date: Wed Jul 11 11:23:24 2007
New Revision: 38636

URL: http://llvm.org/viewvc/llvm-project?rev=38636&view=rev
Log:
Move a PragmaNamespace method out of line.

Modified:
    cfe/cfe/trunk/Lex/Pragma.cpp

Modified: cfe/cfe/trunk/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Pragma.cpp?rev=38636&r1=38635&r2=38636&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Pragma.cpp (original)
+++ cfe/cfe/trunk/Lex/Pragma.cpp Wed Jul 11 11:23:24 2007
@@ -25,6 +25,33 @@
 PragmaHandler::~PragmaHandler() {
 }
 
+//===----------------------------------------------------------------------===//
+// PragmaNamespace Implementation.
+//===----------------------------------------------------------------------===//
+
+
+PragmaNamespace::~PragmaNamespace() {
+  for (unsigned i = 0, e = Handlers.size(); i != e; ++i)
+    delete Handlers[i];
+}
+
+/// FindHandler - Check to see if there is already a handler for the
+/// specified name.  If not, return the handler for the null identifier if it
+/// exists, otherwise return null.  If IgnoreNull is true (the default) then
+/// the null handler isn't returned on failure to match.
+PragmaHandler *PragmaNamespace::FindHandler(const IdentifierTokenInfo *Name,
+                                            bool IgnoreNull) const {
+  PragmaHandler *NullHandler = 0;
+  for (unsigned i = 0, e = Handlers.size(); i != e; ++i) {
+    if (Handlers[i]->getName() == Name) 
+      return Handlers[i];
+    
+    if (Handlers[i]->getName() == 0)
+      NullHandler = Handlers[i];
+  }
+  return IgnoreNull ? 0 : NullHandler;
+}
+
 void PragmaNamespace::HandlePragma(Preprocessor &PP, LexerToken &Tok) {
   // Read the 'namespace' that the directive is in, e.g. STDC.  Do not macro
   // expand it, the user can have a STDC #define, that should not affect this.
@@ -38,12 +65,6 @@
   Handler->HandlePragma(PP, Tok);
 }
 
-PragmaNamespace::~PragmaNamespace() {
-  for (unsigned i = 0, e = Handlers.size(); i != e; ++i)
-    delete Handlers[i];
-}
-
-
 //===----------------------------------------------------------------------===//
 // Preprocessor Pragma Directive Handling.
 //===----------------------------------------------------------------------===//





More information about the cfe-commits mailing list