[cfe-commits] r38610 - /cfe/cfe/trunk/Lex/Preprocessor.cpp

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


Author: sabre
Date: Wed Jul 11 11:23:10 2007
New Revision: 38610

URL: http://llvm.org/viewvc/llvm-project?rev=38610&view=rev
Log:
Fix some minor issues with _Pragma

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

Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=38610&r1=38609&r2=38610&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:23:10 2007
@@ -1563,13 +1563,11 @@
     return;
   }
   
-  // FIXME: implement the _Pragma thing.
-  assert(CurLexer && "Cannot have a pragma in a macro expansion yet!");
+  // Get the current file lexer we're looking at.  Ignore _Pragma 'files' etc.
+  unsigned FileID = getCurrentFileLexer()->getCurFileID();
   
   // Mark the file as a once-only file now.
-  const FileEntry *File = 
-    SourceMgr.getFileEntryForFileID(CurLexer->getCurFileID());
-  getFileInfo(File).isImport = true;
+  getFileInfo(SourceMgr.getFileEntryForFileID(FileID)).isImport = true;
 }
 
 /// HandlePragmaPoison - Handle #pragma GCC poison.  PoisonTok is the 'poison'.
@@ -1621,15 +1619,17 @@
     return;
   }
   
+  // Get the current file lexer we're looking at.  Ignore _Pragma 'files' etc.
+  Lexer *TheLexer = getCurrentFileLexer();
+  
   // Mark the file as a system header.
   const FileEntry *File = 
-    SourceMgr.getFileEntryForFileID(CurLexer->getCurFileID());
+    SourceMgr.getFileEntryForFileID(TheLexer->getCurFileID());
   getFileInfo(File).DirInfo = DirectoryLookup::SystemHeaderDir;
   
-  
   // Notify the client, if desired, that we are in a new source file.
   if (FileChangeHandler)
-    FileChangeHandler(CurLexer->getSourceLocation(CurLexer->BufferPtr),
+    FileChangeHandler(TheLexer->getSourceLocation(TheLexer->BufferPtr),
                       SystemHeaderPragma, DirectoryLookup::SystemHeaderDir);
 }
 
@@ -1655,9 +1655,8 @@
   if (File == 0)
     return Diag(FilenameTok, diag::err_pp_file_not_found);
   
-  Lexer *TheLexer = getCurrentFileLexer();
-  const FileEntry *CurFile =
-    SourceMgr.getFileEntryForFileID(TheLexer->getCurFileID());
+  unsigned FileID = getCurrentFileLexer()->getCurFileID();
+  const FileEntry *CurFile = SourceMgr.getFileEntryForFileID(FileID);
 
   // If this file is older than the file it depends on, emit a diagnostic.
   if (CurFile && CurFile->getModificationTime() < File->getModificationTime()) {





More information about the cfe-commits mailing list