[cfe-dev] Small code problems in SemaTemplateDeduction.cpp and ASTContext.cpp

Nico Weber thakis at chromium.org
Thu Aug 4 12:46:42 PDT 2011


On Thu, Aug 4, 2011 at 12:10 PM, Lockal S <lockalsash at gmail.com> wrote:
> Few days ago Andrey Karpov analyzed Clang and LLVM code using statical analisys
> tool for Visual Studio his company developed. He wrote a big article in russian
> on http://habrahabr.ru/blogs/compilers/125626/ for advertising purposes.
>
> I have wrote to llvmdev list about llvm-related bugs.
> However few problems are Clang-related:
>
> clang/lib/Sema/SemaTemplateDeduction.cpp:3239
>  if ((P->isPointerType() && A->isPointerType()) ||
>     (P->isMemberPointerType() && P->isMemberPointerType()))
>
> Note the identical sub-expressions 'P->isMemberPointerType()' to the left and
> to the right of the '&&' operator. Probably the second one should be
> A->isMemberPointerType().

This warning has been fairly useful for chromium and webkit, too. It
would be great if clang would warn on some variant of this. I looked
at this for two hours or so a while ago and hope to get back to it
eventually ( http://llvm.org/bugs/show_bug.cgi?id=9952 ).

Nico

>
> ----
>
> clang/lib/AST/ASTContext.cpp:3953
>  ParmOffset = PtrSize;
>
>  // Argument types.
>  ParmOffset = PtrSize;
>
> Probably just some duplicated code.
>
> -----
>
> That's all for Clang. Thank you in advance for any comments and fixes.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list