[cfe-commits] r155923 - /cfe/trunk/lib/Frontend/CompilerInstance.cpp

David Blaikie dblaikie at gmail.com
Tue May 1 11:16:44 PDT 2012


On Tue, May 1, 2012 at 10:56 AM, Ted Kremenek <kremenek at apple.com> wrote:
> Author: kremenek
> Date: Tue May  1 12:56:57 2012
> New Revision: 155923
>
> URL: http://llvm.org/viewvc/llvm-project?rev=155923&view=rev
> Log:
> Remove dead code found by static analyzer.
>
> Modified:
>    cfe/trunk/lib/Frontend/CompilerInstance.cpp
>
> Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=155923&r1=155922&r2=155923&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Tue May  1 12:56:57 2012
> @@ -861,11 +861,6 @@
>   // Determine what file we're searching from.
>   SourceManager &SourceMgr = getSourceManager();
>   SourceLocation ExpandedImportLoc = SourceMgr.getExpansionLoc(ImportLoc);
> -  const FileEntry *CurFile
> -    = SourceMgr.getFileEntryForID(SourceMgr.getFileID(ExpandedImportLoc));
> -  if (!CurFile)
> -    CurFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());

Would it be practical for Clang to have a warning that caught this (at
least incrementally) - the assignment inside the conditional is dead -
nothing after it reads CurFile, so it would be nice if we warned. (&
then the user would probably be able to see that the rest of this was
silly too)

> -
>   StringRef ModuleName = Path[0].first->getName();
>   SourceLocation ModuleNameLoc = Path[0].second;
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list