[llvm] r228647 - Verifier: Add simple checks for MDLocation

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Feb 9 18:27:56 PST 2015


> On 2015-Feb-09, at 18:24, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Mon, Feb 9, 2015 at 5:32 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> Author: dexonsmith
> Date: Mon Feb  9 19:32:56 2015
> New Revision: 228647
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=228647&view=rev
> Log:
> Verifier: Add simple checks for MDLocation
> 
> Modified:
>     llvm/trunk/lib/IR/Verifier.cpp
> 
> Modified: llvm/trunk/lib/IR/Verifier.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=228647&r1=228646&r2=228647&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/Verifier.cpp (original)
> +++ llvm/trunk/lib/IR/Verifier.cpp Mon Feb  9 19:32:56 2015
> @@ -678,7 +678,13 @@ void Verifier::visitMetadataAsValue(cons
>      visitValueAsMetadata(*V, F);
>  }
> 
> -void Verifier::visitMDLocation(const MDLocation &) {}
> +void Verifier::visitMDLocation(const MDLocation &N) {
> +  Assert1(N.getScope(), "location requires a valid scope", &N);
> +  if (N.getInlinedAt())
> +    Assert2(isa<MDLocation>(N.getInlinedAt()),
> +            "inlined-at should be a location", &N, N.getInlinedAt());
> 
> Usually, rather than re-writing the expression, we might write this as:
> 
> if (auto *IA = N.getInlinedAt())
>   Assert2(isa<MDLocation>(IA), "inlined-at should be a location", &N, IA);
>  
> +}
> +

r228655

>  void Verifier::visitGenericDebugNode(const GenericDebugNode &) {}
>  void Verifier::visitMDSubrange(const MDSubrange &) {}
>  void Verifier::visitMDEnumerator(const MDEnumerator &) {}
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 





More information about the llvm-commits mailing list