[cfe-commits] r141408 - /cfe/trunk/include/clang/Analysis/ProgramPoint.h

Ted Kremenek kremenek at apple.com
Fri Oct 7 13:37:58 PDT 2011


We should make the copy constructor private (and marked "explicit") so that "withTag()" is the only consumer.

On Oct 7, 2011, at 1:08 PM, Anna Zaks wrote:

> Author: zaks
> Date: Fri Oct  7 15:08:27 2011
> New Revision: 141408
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=141408&view=rev
> Log:
> Add a copy constructor to ProgramPoint and pull withTag() method from a child. (withTag essentialy creates a copy with a given tag.)
> 
> Modified:
>    cfe/trunk/include/clang/Analysis/ProgramPoint.h
> 
> Modified: cfe/trunk/include/clang/Analysis/ProgramPoint.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ProgramPoint.h?rev=141408&r1=141407&r2=141408&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Analysis/ProgramPoint.h (original)
> +++ cfe/trunk/include/clang/Analysis/ProgramPoint.h Fri Oct  7 15:08:27 2011
> @@ -78,6 +78,15 @@
>   const void *getData2() const { return Data.second; }
> 
> public:
> +  ProgramPoint(const ProgramPoint &P)
> +    : Data(P.Data), K(P.K), L(P.L), Tag(P.Tag) {}
> +
> +  /// Create a new ProgramPoint object that is the same as the original
> +  /// except for using the specified tag value.
> +  ProgramPoint withTag(const ProgramPointTag *tag) {
> +    return ProgramPoint(Data.first, Data.second, K, L, tag);
> +  }
> +
>   Kind getKind() const { return K; }
> 
>   const ProgramPointTag *getTag() const { return Tag; }
> @@ -127,12 +136,6 @@
>     return B->empty() ? CFGElement() : B->front();
>   }
> 
> -  /// Create a new BlockEntrance object that is the same as the original
> -  /// except for using the specified tag value.
> -  BlockEntrance withTag(const ProgramPointTag *tag) {
> -    return BlockEntrance(getBlock(), getLocationContext(), tag);
> -  }
> -  
>   static bool classof(const ProgramPoint* Location) {
>     return Location->getKind() == BlockEntranceKind;
>   }
> 
> 
> _______________________________________________
> 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