This reverts commit r263738.
This appears to cause a failure in
CXX/temp/temp.decls/temp.friend/p1.cpp
llvm-svn: 263740
/// \returns true to continue parsing, or false to abort parsing.
virtual bool HandleTopLevelDecl(DeclGroupRef D);
- /// \brief This callback is invoked each time an inline (method or friend)
- /// function definition in a class is completed.
- virtual void HandleInlineFunctionDefinition(FunctionDecl *D) {}
+ /// \brief This callback is invoked each time an inline method definition is
+ /// completed.
+ virtual void HandleInlineMethodDefinition(CXXMethodDecl *D) {}
/// HandleInterestingDecl - Handle the specified interesting declaration. This
/// is called by the AST reader when deserializing things that might interest
void Initialize(ASTContext &Context) override;
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override;
bool HandleTopLevelDecl(DeclGroupRef D) override;
- void HandleInlineFunctionDefinition(FunctionDecl *D) override;
+ void HandleInlineMethodDefinition(CXXMethodDecl *D) override;
void HandleInterestingDecl(DeclGroupRef D) override;
void HandleTranslationUnit(ASTContext &Ctx) override;
void HandleTagDeclDefinition(TagDecl *D) override;
Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body);
Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
Decl *ActOnSkippedFunctionBody(Decl *Decl);
- void ActOnFinishInlineFunctionDef(FunctionDecl *D);
+ void ActOnFinishInlineMethodDef(CXXMethodDecl *D);
/// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
/// attribute for which parsing is delayed.
return true;
}
- void HandleInlineFunctionDefinition(FunctionDecl *D) override {
+ void HandleInlineMethodDefinition(CXXMethodDecl *D) override {
PrettyStackTraceDecl CrashInfo(D, SourceLocation(),
Context->getSourceManager(),
- "LLVM IR generation of inline function");
+ "LLVM IR generation of inline method");
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.startTimer();
- Gen->HandleInlineFunctionDefinition(D);
+ Gen->HandleInlineMethodDefinition(D);
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.stopTimer();
DeferredInlineMethodDefinitions.clear();
}
- void HandleInlineFunctionDefinition(FunctionDecl *D) override {
+ void HandleInlineMethodDefinition(CXXMethodDecl *D) override {
if (Diags.hasErrorOccurred())
return;
assert(D->doesThisDeclarationHaveABody());
- // Handle friend functions.
- if (D->isInIdentifierNamespace(Decl::IDNS_OrdinaryFriend)) {
- if (Ctx->getTargetInfo().getCXXABI().isMicrosoft())
- Builder->EmitTopLevelDecl(D);
- return;
- }
-
- // Otherwise, must be a method.
- auto MD = cast<CXXMethodDecl>(D);
-
// We may want to emit this definition. However, that decision might be
// based on computing the linkage, and we have to defer that in case we
// are inside of something that will change the method's final linkage,
// void bar();
// void foo() { bar(); }
// } A;
- DeferredInlineMethodDefinitions.push_back(MD);
+ DeferredInlineMethodDefinitions.push_back(D);
// Provide some coverage mapping even for methods that aren't emitted.
// Don't do this for templated classes though, as they may not be
// instantiable.
- if (!MD->getParent()->getDescribedClassTemplate())
- Builder->AddDeferredUnusedCoverageMapping(MD);
+ if (!D->getParent()->getDescribedClassTemplate())
+ Builder->AddDeferredUnusedCoverageMapping(D);
}
/// HandleTagDeclDefinition - This callback is invoked each time a TagDecl
return Continue;
}
-void MultiplexConsumer::HandleInlineFunctionDefinition(FunctionDecl *D) {
+void MultiplexConsumer::HandleInlineMethodDefinition(CXXMethodDecl *D) {
for (auto &Consumer : Consumers)
- Consumer->HandleInlineFunctionDefinition(D);
+ Consumer->HandleInlineMethodDefinition(D);
}
void MultiplexConsumer::HandleCXXStaticMemberVarInstantiation(VarDecl *VD) {
if (Tok.is(tok::eof) && Tok.getEofData() == LM.D)
ConsumeAnyToken();
- if (auto *FD = dyn_cast_or_null<FunctionDecl>(LM.D))
- if (isa<CXXMethodDecl>(FD) ||
- FD->isInIdentifierNamespace(Decl::IDNS_OrdinaryFriend))
- Actions.ActOnFinishInlineFunctionDef(FD);
+ if (CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(LM.D))
+ Actions.ActOnFinishInlineMethodDef(MD);
}
/// ParseLexedMemberInitializers - We finished parsing the member specification
return ActOnStartOfFunctionDef(FnBodyScope, DP, SkipBody);
}
-void Sema::ActOnFinishInlineFunctionDef(FunctionDecl *D) {
- Consumer.HandleInlineFunctionDefinition(D);
+void Sema::ActOnFinishInlineMethodDef(CXXMethodDecl *D) {
+ Consumer.HandleInlineMethodDefinition(D);
}
static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD,
// GNU-DAG: define dllexport void @_Z7friend1v()
// MSC-DAG: define dllexport void @"\01?friend2@@YAXXZ"()
// GNU-DAG: define dllexport void @_Z7friend2v()
-// MSC-DAG: define weak_odr dllexport void @"\01?friend3@@YAXXZ"()
struct FuncFriend {
friend __declspec(dllexport) void friend1();
friend __declspec(dllexport) void friend2();
- friend __declspec(dllexport) void friend3() {}
};
__declspec(dllexport) void friend1() {}
void friend2() {}