global allocation or deallocation function, that should not cause that global
allocation or deallocation function to become unavailable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186270
91177308-0d34-0410-b5e6-
96231b3b80d8
using Decl::isModulePrivate;
using Decl::setModulePrivate;
-
+
/// \brief Determine whether this declaration is hidden from name lookup.
bool isHidden() const { return Hidden; }
-
+
+ /// \brief Set whether this declaration is hidden from name lookup.
+ void setHidden(bool Hide) { Hidden = Hide; }
+
/// \brief Determine whether this declaration is a C++ class member.
bool isCXXClassMember() const {
const DeclContext *DC = getDeclContext();
Func->getParamDecl(0)->getType().getUnqualifiedType());
// FIXME: Do we need to check for default arguments here?
if (Func->getNumParams() == 1 && InitialParamType == Argument) {
- if(AddMallocAttr && !Func->hasAttr<MallocAttr>())
+ if (AddMallocAttr && !Func->hasAttr<MallocAttr>())
Func->addAttr(::new (Context) MallocAttr(SourceLocation(), Context));
+ // Make the function visible to name lookup, even if we found it in an
+ // unimported module. It either is an implicitly-declared global
+ // allocation function, or is suppressing that function.
+ Func->setHidden(false);
return;
}
}
--- /dev/null
+void operator delete(void*);
header "cxx-templates-b.h"
}
+module cxx_decls {
+ module unimported {
+ header "cxx-decls-unimported.h"
+ }
+ module imported {
+ header "cxx-decls-imported.h"
+ }
+}
+
module config {
header "config.h"
config_macros [exhaustive] WANT_FOO, WANT_BAR
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11
+
+// expected-no-diagnostics
+
+@import cxx_decls.imported;
+
+void test_delete(int *p) {
+ // We can call the normal global deallocation function even though it has only
+ // ever been explicitly declared in an unimported submodule.
+ delete p;
+}