]> granicus.if.org Git - clang/commitdiff
remove an unneeded const_cast.
authorChris Lattner <sabre@nondot.org>
Fri, 16 Jan 2009 07:02:14 +0000 (07:02 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Jan 2009 07:02:14 +0000 (07:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62311 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Preprocessor.cpp

index c1d30573cda7031e91630e78644e2f69af3828cc..f7c38e773a59511afad2198430956071a4ea79cf 100644 (file)
@@ -260,15 +260,13 @@ unsigned Preprocessor::getSpelling(const Token &Tok,
       // getting token spellings in the order of tokens, and thus can update
       // its internal state so that it can quickly fetch spellings from the PTH
       // file.
-      Len =
-        const_cast<PTHLexer*>(CurPTHLexer.get())->getSpelling(Tok.getLocation(),
-                                                              Buffer);      
+      Len = CurPTHLexer.get()->getSpelling(Tok.getLocation(), Buffer);      
     }
     else {
-      SourceLocation sloc = SourceMgr.getSpellingLoc(Tok.getLocation());
-      unsigned fid = SourceMgr.getCanonicalFileID(sloc);
-      unsigned fpos = SourceMgr.getFullFilePos(sloc);      
-      Len = PTH->getSpelling(fid, fpos, Buffer);      
+      SourceLocation SLoc = SourceMgr.getSpellingLoc(Tok.getLocation());
+      unsigned FID = SourceMgr.getCanonicalFileID(SLoc);
+      unsigned FPos = SourceMgr.getFullFilePos(SLoc);      
+      Len = PTH->getSpelling(FID, FPos, Buffer);      
     }
 
     // Did we find a spelling?  If so return its length.  Otherwise fall