Skip to content

Commit de9d7e4

Browse files
author
Balazs Benics
committed
[analyzer][NFC] CallDescription should own the qualified name parts
Previously, CallDescription simply referred to the qualified name parts by `const char*` pointers. In the future we might want to dynamically load and populate `CallDescriptionMaps`, hence we will need the `CallDescriptions` to actually **own** their qualified name parts. Reviewed By: martong, xazax.hun Differential Revision: https://reviews.llvm.org/D113593
1 parent 9ad0a90 commit de9d7e4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CallDescription {
4343
mutable Optional<const IdentifierInfo *> II;
4444
// The list of the qualified names used to identify the specified CallEvent,
4545
// e.g. "{a, b}" represent the qualified names, like "a::b".
46-
std::vector<const char *> QualifiedName;
46+
std::vector<std::string> QualifiedName;
4747
Optional<unsigned> RequiredArgs;
4848
Optional<size_t> RequiredParams;
4949
int Flags;

clang/lib/StaticAnalyzer/Core/CallDescription.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
1818
#include "llvm/ADT/ArrayRef.h"
1919
#include "llvm/ADT/Optional.h"
20+
#include <iterator>
2021

2122
using namespace llvm;
2223
using namespace clang;
@@ -35,10 +36,12 @@ ento::CallDescription::CallDescription(
3536
int Flags, ArrayRef<const char *> QualifiedName,
3637
Optional<unsigned> RequiredArgs /*= None*/,
3738
Optional<size_t> RequiredParams /*= None*/)
38-
: QualifiedName(QualifiedName), RequiredArgs(RequiredArgs),
39+
: RequiredArgs(RequiredArgs),
3940
RequiredParams(readRequiredParams(RequiredArgs, RequiredParams)),
4041
Flags(Flags) {
4142
assert(!QualifiedName.empty());
43+
this->QualifiedName.reserve(QualifiedName.size());
44+
llvm::copy(QualifiedName, std::back_inserter(this->QualifiedName));
4245
}
4346

4447
/// Construct a CallDescription with default flags.

0 commit comments

Comments
 (0)