mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-12 02:47:10 +00:00
Fix memory leak in [Clang] Implement __builtin_source_location.
Fixes: d61487490022
This commit is contained in:
parent
9b36e126fd
commit
8f66f13719
@ -4221,7 +4221,8 @@ class UnnamedGlobalConstantDecl : public ValueDecl,
|
||||
|
||||
void anchor() override;
|
||||
|
||||
UnnamedGlobalConstantDecl(DeclContext *DC, QualType T, const APValue &Val);
|
||||
UnnamedGlobalConstantDecl(const ASTContext &C, DeclContext *DC, QualType T,
|
||||
const APValue &Val);
|
||||
|
||||
static UnnamedGlobalConstantDecl *Create(const ASTContext &C, QualType T,
|
||||
const APValue &APVal);
|
||||
|
@ -3365,23 +3365,30 @@ APValue &MSGuidDecl::getAsAPValue() const {
|
||||
|
||||
void UnnamedGlobalConstantDecl::anchor() {}
|
||||
|
||||
UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(DeclContext *DC,
|
||||
UnnamedGlobalConstantDecl::UnnamedGlobalConstantDecl(const ASTContext &C,
|
||||
DeclContext *DC,
|
||||
QualType Ty,
|
||||
const APValue &Value)
|
||||
const APValue &Val)
|
||||
: ValueDecl(Decl::UnnamedGlobalConstant, DC, SourceLocation(),
|
||||
DeclarationName(), Ty),
|
||||
Value(Value) {}
|
||||
Value(Val) {
|
||||
// Cleanup the embedded APValue if required (note that our destructor is never
|
||||
// run)
|
||||
if (Value.needsCleanup())
|
||||
C.addDestruction(&Value);
|
||||
}
|
||||
|
||||
UnnamedGlobalConstantDecl *
|
||||
UnnamedGlobalConstantDecl::Create(const ASTContext &C, QualType T,
|
||||
const APValue &Value) {
|
||||
DeclContext *DC = C.getTranslationUnitDecl();
|
||||
return new (C, DC) UnnamedGlobalConstantDecl(DC, T, Value);
|
||||
return new (C, DC) UnnamedGlobalConstantDecl(C, DC, T, Value);
|
||||
}
|
||||
|
||||
UnnamedGlobalConstantDecl *
|
||||
UnnamedGlobalConstantDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
|
||||
return new (C, ID) UnnamedGlobalConstantDecl(nullptr, QualType(), APValue());
|
||||
return new (C, ID)
|
||||
UnnamedGlobalConstantDecl(C, nullptr, QualType(), APValue());
|
||||
}
|
||||
|
||||
void UnnamedGlobalConstantDecl::printName(llvm::raw_ostream &OS) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user