maybeMangleDeclName should take GlobalDecl. This enforces integrity.
This commit is contained in:
parent
9b352aa828
commit
a97a2811c9
@ -15,6 +15,7 @@ namespace clang {
|
||||
class Expr;
|
||||
class DeclContext;
|
||||
class DeclarationName;
|
||||
class GlobalDecl;
|
||||
class FunctionDecl;
|
||||
class IntegerLiteral;
|
||||
class NamedDecl;
|
||||
@ -41,12 +42,12 @@ namespace utils {
|
||||
///
|
||||
static bool IsWrapper(const clang::NamedDecl* ND);
|
||||
|
||||
///\brief Get the mangled name of a NamedDecl.
|
||||
///\brief Get the mangled name of a GlobalDecl.
|
||||
///
|
||||
///\param [in] D - try to mangle this decl's name.
|
||||
///\param [in] GD - try to mangle this decl's name.
|
||||
///\param [out] mangledName - put the mangled name in here.
|
||||
///
|
||||
static void maybeMangleDeclName(const clang::NamedDecl* D,
|
||||
static void maybeMangleDeclName(const clang::GlobalDecl& GD,
|
||||
std::string& mangledName);
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/DeclarationName.h"
|
||||
#include "clang/AST/GlobalDecl.h"
|
||||
#include "clang/Sema/Sema.h"
|
||||
#include "clang/Sema/Lookup.h"
|
||||
#include "clang/AST/DeclTemplate.h"
|
||||
@ -43,12 +44,14 @@ namespace utils {
|
||||
.startswith(Synthesize::UniquePrefix);
|
||||
}
|
||||
|
||||
void Analyze::maybeMangleDeclName(const clang::NamedDecl* D,
|
||||
std::string& mangledName) {
|
||||
void Analyze::maybeMangleDeclName(const clang::GlobalDecl& GD,
|
||||
std::string& mangledName) {
|
||||
///Get the mangled name of a NamedDecl.
|
||||
///
|
||||
///D - mangle this decl's name
|
||||
///mangledName - put the mangled name in here
|
||||
clang::NamedDecl* D
|
||||
= cast<NamedDecl>(const_cast<clang::Decl*>(GD.getDecl()));
|
||||
llvm::OwningPtr<MangleContext> mangleCtx;
|
||||
mangleCtx.reset(D->getASTContext().createMangleContext());
|
||||
if (mangleCtx->shouldMangleDeclName(D)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user