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;
}
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
EmitAllDecls = 0;
MathErrno = 1;
+ // FIXME: The default should be 1.
+ AccessControl = 0;
+
OverflowChecking = 0;
ObjCGCBitmapPrint = 0;
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();
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);
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;
-// RUN: clang-cc -fsyntax-only -verify %s
+// RUN: clang-cc -fsyntax-only -faccess-control -verify %s
namespace T1 {
class A { };
-// 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.
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,
if (EnableHeinousExtensions)
Options.HeinousExtensions = 1;
+ if (AccessControl)
+ Options.AccessControl = 1;
+
Options.MathErrno = MathErrno;
Options.InstantiationDepth = TemplateDepth;