diff options
Diffstat (limited to 'clang-tidy/bugprone/StringConstructorCheck.cpp')
-rw-r--r-- | clang-tidy/bugprone/StringConstructorCheck.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang-tidy/bugprone/StringConstructorCheck.cpp b/clang-tidy/bugprone/StringConstructorCheck.cpp index cc6e2973..a4b83ada 100644 --- a/clang-tidy/bugprone/StringConstructorCheck.cpp +++ b/clang-tidy/bugprone/StringConstructorCheck.cpp @@ -1,9 +1,8 @@ //===--- StringConstructorCheck.cpp - clang-tidy---------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -139,7 +138,8 @@ void StringConstructorCheck::check(const MatchFinder::MatchResult &Result) { } } else if (const auto *Ptr = Result.Nodes.getNodeAs<Expr>("from-ptr")) { Expr::EvalResult ConstPtr; - if (Ptr->EvaluateAsRValue(ConstPtr, Ctx) && + if (!Ptr->isInstantiationDependent() && + Ptr->EvaluateAsRValue(ConstPtr, Ctx) && ((ConstPtr.Val.isInt() && ConstPtr.Val.getInt().isNullValue()) || (ConstPtr.Val.isLValue() && ConstPtr.Val.isNullPointer()))) { diag(Loc, "constructing string from nullptr is undefined behaviour"); |