forked from OSchip/llvm-project
Disable access control by default. It can be enabled with the -faccess-control option. When we have better support for it, we can enable it by default again.
llvm-svn: 71706
This commit is contained in:
parent
4060be74d9
commit
5879fbd933
|
@ -127,6 +127,10 @@ def warn_macro_name_used_in_pch : Error<
|
|||
def warn_pch_compiler_options_mismatch : Error<
|
||||
"compiler options used when building the precompiled header differ from "
|
||||
"the options used when using the precompiled header">;
|
||||
def warn_pch_access_control : Error<
|
||||
"C++ access control was %select{disabled|enabled}0 in the PCH file but "
|
||||
"is currently %select{disabled|enabled}1">;
|
||||
|
||||
def err_not_a_pch_file : Error<
|
||||
"'%0' does not appear to be a precompiled header file">, DefaultFatal;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,8 @@ public:
|
|||
unsigned ObjCGCBitmapPrint : 1; // Enable printing of gc's bitmap layout
|
||||
// for __weak/__strong ivars.
|
||||
|
||||
unsigned AccessControl : 1; // Whether C++ access control should
|
||||
// be enabled.
|
||||
private:
|
||||
unsigned GC : 2; // Objective-C Garbage Collection modes. We declare
|
||||
// this enum as unsigned because MSVC insists on making enums
|
||||
|
@ -115,6 +117,9 @@ public:
|
|||
EmitAllDecls = 0;
|
||||
MathErrno = 1;
|
||||
|
||||
// FIXME: The default should be 1.
|
||||
AccessControl = 0;
|
||||
|
||||
OverflowChecking = 0;
|
||||
ObjCGCBitmapPrint = 0;
|
||||
|
||||
|
|
|
@ -1520,6 +1520,7 @@ bool PCHReader::ParseLanguageOptions(
|
|||
PARSE_LANGOPT_IMPORTANT(PICLevel, diag::warn_pch_pic_level);
|
||||
PARSE_LANGOPT_IMPORTANT(GNUInline, diag::warn_pch_gnu_inline);
|
||||
PARSE_LANGOPT_IMPORTANT(NoInline, diag::warn_pch_no_inline);
|
||||
PARSE_LANGOPT_IMPORTANT(AccessControl, diag::warn_pch_access_control);
|
||||
if ((LangOpts.getGCMode() != 0) != (Record[Idx] != 0)) {
|
||||
Diag(diag::warn_pch_gc_mode)
|
||||
<< (unsigned)Record[Idx] << LangOpts.getGCMode();
|
||||
|
|
|
@ -546,6 +546,8 @@ void PCHWriter::WriteLanguageOptions(const LangOptions &LangOpts) {
|
|||
Record.push_back(LangOpts.GNUInline); // Should GNU inline semantics be
|
||||
// used (instead of C99 semantics).
|
||||
Record.push_back(LangOpts.NoInline); // Should __NO_INLINE__ be defined.
|
||||
Record.push_back(LangOpts.AccessControl); // Whether C++ access control should
|
||||
// be enabled.
|
||||
Record.push_back(LangOpts.getGCMode());
|
||||
Record.push_back(LangOpts.getVisibilityMode());
|
||||
Record.push_back(LangOpts.InstantiationDepth);
|
||||
|
|
|
@ -53,6 +53,9 @@ bool Sema::CheckBaseClassAccess(QualType Derived, QualType Base,
|
|||
assert(Paths.isRecordingPaths() &&
|
||||
"Can't check base class access without recorded paths");
|
||||
|
||||
if (!getLangOptions().AccessControl)
|
||||
return false;
|
||||
|
||||
const CXXBaseSpecifier *InacessibleBase = 0;
|
||||
|
||||
const CXXRecordDecl* CurrentClassDecl = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify %s
|
||||
// RUN: clang-cc -fsyntax-only -faccess-control -verify %s
|
||||
namespace T1 {
|
||||
|
||||
class A { };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
|
||||
// RUN: clang-cc -fsyntax-only -verify -faccess-control -std=c++0x %s
|
||||
|
||||
// C++ rules for ?: are a lot stricter than C rules, and have to take into
|
||||
// account more conversion options.
|
||||
|
|
|
@ -669,6 +669,11 @@ static llvm::cl::opt<std::string>
|
|||
MainFileName("main-file-name",
|
||||
llvm::cl::desc("Main file name to use for debug info"));
|
||||
|
||||
// FIXME: Also add an "-fno-access-control" option.
|
||||
static llvm::cl::opt<bool>
|
||||
AccessControl("faccess-control",
|
||||
llvm::cl::desc("Enable C++ access control"));
|
||||
|
||||
// It might be nice to add bounds to the CommandLine library directly.
|
||||
struct OptLevelParser : public llvm::cl::parser<unsigned> {
|
||||
bool parse(llvm::cl::Option &O, const char *ArgName,
|
||||
|
@ -801,6 +806,9 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
|
|||
if (EnableHeinousExtensions)
|
||||
Options.HeinousExtensions = 1;
|
||||
|
||||
if (AccessControl)
|
||||
Options.AccessControl = 1;
|
||||
|
||||
Options.MathErrno = MathErrno;
|
||||
|
||||
Options.InstantiationDepth = TemplateDepth;
|
||||
|
|
Loading…
Reference in New Issue