diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h index e10d776015d2..a9c99352765b 100644 --- a/clang/include/clang/Basic/LangOptions.h +++ b/clang/include/clang/Basic/LangOptions.h @@ -93,7 +93,7 @@ public: // smallest integer type with enough room. unsigned OpenCL : 1; // OpenCL C99 language extensions. - + unsigned AssumeSaneOperatorNew : 1; // Whether to add __attribute__((malloc)) // to the declaration of C++'s new // operators @@ -104,7 +104,7 @@ public: unsigned DumpVTableLayouts : 1; /// Dump the layouts of emitted vtables. unsigned NoConstantCFStrings : 1; // Do not do CF strings unsigned InlineVisibilityHidden : 1; // Whether inline C++ methods have - // hidden visibility by default. + // hidden visibility by default. unsigned SpellChecking : 1; // Whether to perform spell-checking for error // recovery. @@ -131,7 +131,7 @@ public: Protected, Hidden }; - + enum SignedOverflowBehaviorTy { SOB_Undefined, // Default C standard behavior. SOB_Defined, // -fwrapv @@ -157,14 +157,14 @@ public: AltiVec = OpenCL = StackProtector = 0; SymbolVisibility = (unsigned) Default; - + ThreadsafeStatics = 1; POSIXThreads = 0; Blocks = 0; EmitAllDecls = 0; MathErrno = 1; SignedOverflowBehavior = SOB_Undefined; - + AssumeSaneOperatorNew = 1; AccessControl = 1; ElideConstructors = 1; @@ -207,7 +207,7 @@ public: return (VisibilityMode) SymbolVisibility; } void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; } - + SignedOverflowBehaviorTy getSignedOverflowBehavior() const { return (SignedOverflowBehaviorTy)SignedOverflowBehavior; } diff --git a/clang/include/clang/Driver/CC1Options.td b/clang/include/clang/Driver/CC1Options.td index 25ffdd09a47d..d801c900aeae 100644 --- a/clang/include/clang/Driver/CC1Options.td +++ b/clang/include/clang/Driver/CC1Options.td @@ -88,7 +88,7 @@ def analyzer_output_EQ : Joined<"-analyzer-output=">, def analyzer_opt_analyze_headers : Flag<"-analyzer-opt-analyze-headers">, HelpText<"Force the static analyzer to analyze functions defined in header files">; def analyzer_opt_analyze_nested_blocks : Flag<"-analyzer-opt-analyze-nested-blocks">, - HelpText<"Analyze the definitions of blocks in addition to functions">; + HelpText<"Analyze the definitions of blocks in addition to functions">; def analyzer_display_progress : Flag<"-analyzer-display-progress">, HelpText<"Emit verbose output about the analyzer's progress">; def analyzer_experimental_checks : Flag<"-analyzer-experimental-checks">, @@ -230,7 +230,7 @@ def fdiagnostics_show_option : Flag<"-fdiagnostics-show-option">, HelpText<"Print diagnostic name with mappable diagnostics">; def fdiagnostics_show_category : Separate<"-fdiagnostics-show-category">, HelpText<"Print diagnostic category">; - + def ftabstop : Separate<"-ftabstop">, MetaVarName<"">, HelpText<"Set the tab stop distance.">; def ferror_limit : Separate<"-ferror-limit">, MetaVarName<"">, @@ -289,7 +289,7 @@ def load : Separate<"-load">, MetaVarName<"">, HelpText<"Load the named plugin (dynamic shared object)">; def plugin : Separate<"-plugin">, MetaVarName<"">, HelpText<"Use the named plugin action (use \"help\" to list available options)">; -def plugin_arg : JoinedAndSeparate<"-plugin-arg-">, +def plugin_arg : JoinedAndSeparate<"-plugin-arg-">, MetaVarName<" ">, HelpText<"Pass to plugin ">; def resource_dir : Separate<"-resource-dir">, @@ -408,7 +408,7 @@ def femit_all_decls : Flag<"-femit-all-decls">, HelpText<"Emit all declarations, even if unused">; def fblocks : Flag<"-fblocks">, HelpText<"enable the 'blocks' language feature">; -def fheinous_gnu_extensions : Flag<"-fheinous-gnu-extensions">; +def fheinous_gnu_extensions : Flag<"-fheinous-gnu-extensions">; def fexceptions : Flag<"-fexceptions">, HelpText<"Enable support for exception handling">; def fsjlj_exceptions : Flag<"-fsjlj-exceptions">, @@ -438,7 +438,7 @@ def fno_operator_names : Flag<"-fno-operator-names">, def fno_signed_char : Flag<"-fno-signed-char">, HelpText<"Char is unsigned">; def fno_spell_checking : Flag<"-fno-spell-checking">, - HelpText<"Disable spell-checking">; + HelpText<"Disable spell-checking">; def fno_use_cxa_atexit : Flag<"-fno-use-cxa-atexit">, HelpText<"Don't use __cxa_atexit for calling destructors">; def fconstant_string_class : Separate<"-fconstant-string-class">, @@ -561,7 +561,7 @@ def undef : Flag<"-undef">, MetaVarName<"">, HelpText<"undef all system defines">; def detailed_preprocessing_record : Flag<"-detailed-preprocessing-record">, HelpText<"include a detailed record of preprocessing actions">; - + //===----------------------------------------------------------------------===// // Preprocessed Output Options //===----------------------------------------------------------------------===// diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index b029b6e2573c..8ee43955c3bf 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -294,11 +294,11 @@ def finstrument_functions : Flag<"-finstrument-functions">, Group; def fkeep_inline_functions : Flag<"-fkeep-inline-functions">, Group; def flat__namespace : Flag<"-flat_namespace">; def flax_vector_conversions : Flag<"-flax-vector-conversions">, Group; -def flimit_debug_info : Flag<"-flimit-debug-info">, Group, +def flimit_debug_info : Flag<"-flimit-debug-info">, Group, HelpText<"Limit debug information produced to reduce size of debug binary">; def flimited_precision_EQ : Joined<"-flimited-precision=">, Group; def flto : Flag<"-flto">, Group; -def fmacro_backtrace_limit_EQ : Joined<"-fmacro-backtrace-limit=">, +def fmacro_backtrace_limit_EQ : Joined<"-fmacro-backtrace-limit=">, Group; def fmath_errno : Flag<"-fmath-errno">, Group; def fmerge_all_constants : Flag<"-fmerge-all-constants">, Group; @@ -398,7 +398,7 @@ def fsyntax_only : Flag<"-fsyntax-only">, Flags<[DriverOption]>; def ftabstop_EQ : Joined<"-ftabstop=">, Group; def ferror_limit_EQ : Joined<"-ferror-limit=">, Group; def ftemplate_depth_ : Joined<"-ftemplate-depth-">, Group; -def ftemplate_backtrace_limit_EQ : Joined<"-ftemplate-backtrace-limit=">, +def ftemplate_backtrace_limit_EQ : Joined<"-ftemplate-backtrace-limit=">, Group; def fterminated_vtables : Flag<"-fterminated-vtables">, Group; def fthreadsafe_statics : Flag<"-fthreadsafe-statics">, Group; diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 31a55b6c9487..960121021205 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -160,12 +160,12 @@ public: return llvm::MCSectionMachO::ParseSectionSpecifier(SR, Segment, Section, TAA, StubSize); } - + virtual const char *getStaticInitSectionSpecifier() const { // FIXME: We should return 0 when building kexts. return "__TEXT,__StaticInit,regular,pure_instructions"; } - + }; @@ -458,16 +458,16 @@ public: // FIXME: The following are added to allow parsing. // I just took a guess at what the actions should be. // Also, is more specific checking needed? I.e. specific registers? - case 'd': // Floating point register (containing 64-bit value) + case 'd': // Floating point register (containing 64-bit value) case 'v': // Altivec vector register Info.setAllowsRegister(); break; case 'w': switch (Name[1]) { - case 'd':// VSX vector register to hold vector double data - case 'f':// VSX vector register to hold vector float data - case 's':// VSX vector register to hold scalar float data - case 'a':// Any VSX register + case 'd':// VSX vector register to hold vector double data + case 'f':// VSX vector register to hold vector float data + case 's':// VSX vector register to hold scalar float data + case 'a':// Any VSX register break; default: return false; @@ -475,27 +475,27 @@ public: Info.setAllowsRegister(); Name++; // Skip over 'w'. break; - case 'h': // `MQ', `CTR', or `LINK' register - case 'q': // `MQ' register - case 'c': // `CTR' register - case 'l': // `LINK' register - case 'x': // `CR' register (condition register) number 0 - case 'y': // `CR' register (condition register) - case 'z': // `XER[CA]' carry bit (part of the XER register) + case 'h': // `MQ', `CTR', or `LINK' register + case 'q': // `MQ' register + case 'c': // `CTR' register + case 'l': // `LINK' register + case 'x': // `CR' register (condition register) number 0 + case 'y': // `CR' register (condition register) + case 'z': // `XER[CA]' carry bit (part of the XER register) Info.setAllowsRegister(); break; - case 'I': // Signed 16-bit constant + case 'I': // Signed 16-bit constant case 'J': // Unsigned 16-bit constant shifted left 16 bits - // (use `L' instead for SImode constants) - case 'K': // Unsigned 16-bit constant - case 'L': // Signed 16-bit constant shifted left 16 bits - case 'M': // Constant larger than 31 - case 'N': // Exact power of 2 - case 'P': // Constant whose negation is a signed 16-bit constant + // (use `L' instead for SImode constants) + case 'K': // Unsigned 16-bit constant + case 'L': // Signed 16-bit constant shifted left 16 bits + case 'M': // Constant larger than 31 + case 'N': // Exact power of 2 + case 'P': // Constant whose negation is a signed 16-bit constant case 'G': // Floating point constant that can be loaded into a - // register with one instruction per word + // register with one instruction per word case 'H': // Integer/Floating point constant that can be loaded - // into a register using three instructions + // into a register using three instructions break; case 'm': // Memory operand. Note that on PowerPC targets, m can // include addresses that update the base register. It @@ -503,13 +503,13 @@ public: // if that asm statement accesses the operand exactly once. // The asm statement must also use `%U' as a // placeholder for the "update" flag in the corresponding - // load or store instruction. For example: + // load or store instruction. For example: // asm ("st%U0 %1,%0" : "=m" (mem) : "r" (val)); - // is correct but: + // is correct but: // asm ("st %1,%0" : "=m" (mem) : "r" (val)); // is not. Use es rather than m if you don't want the base - // register to be updated. - case 'e': + // register to be updated. + case 'e': if (Name[1] != 's') return false; // es: A "stable" memory operand; that is, one which does not @@ -521,23 +521,23 @@ public: Name++; // Skip over 'e'. break; case 'Q': // Memory operand that is an offset from a register (it is - // usually better to use `m' or `es' in asm statements) + // usually better to use `m' or `es' in asm statements) case 'Z': // Memory operand that is an indexed or indirect from a // register (it is usually better to use `m' or `es' in - // asm statements) + // asm statements) Info.setAllowsMemory(); Info.setAllowsRegister(); break; - case 'R': // AIX TOC entry + case 'R': // AIX TOC entry case 'a': // Address operand that is an indexed or indirect from a - // register (`p' is preferable for asm statements) - case 'S': // Constant suitable as a 64-bit mask operand - case 'T': // Constant suitable as a 32-bit mask operand - case 'U': // System V Release 4 small data area reference + // register (`p' is preferable for asm statements) + case 'S': // Constant suitable as a 64-bit mask operand + case 'T': // Constant suitable as a 32-bit mask operand + case 'U': // System V Release 4 small data area reference case 't': // AND masks that can be performed by two rldic{l, r} - // instructions - case 'W': // Vector constant that does not require memory - case 'j': // Vector constant that is all zeros. + // instructions + case 'W': // Vector constant that does not require memory + case 'j': // Vector constant that is all zeros. break; // End FIXME. } @@ -584,7 +584,7 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, // FIXME: Should be controlled by command line option. Builder.defineMacro("__LONG_DOUBLE_128__"); - + if (Opts.AltiVec) { Builder.defineMacro("__VEC__", "10206"); Builder.defineMacro("__ALTIVEC__"); @@ -1116,13 +1116,13 @@ void X86TargetInfo::HandleTargetFeatures(std::vector &Features) { .Case("mmx", MMX) .Default(NoMMXSSE); SSELevel = std::max(SSELevel, Level); - - AMD3DNowEnum ThreeDNowLevel = + + AMD3DNowEnum ThreeDNowLevel = llvm::StringSwitch(Features[i].substr(1)) .Case("3dnowa", AMD3DNowAthlon) .Case("3dnow", AMD3DNow) .Default(NoAMD3DNow); - + AMD3DNowLevel = std::max(AMD3DNowLevel, ThreeDNowLevel); } } @@ -1284,7 +1284,7 @@ public: virtual const char *getVAListDeclaration() const { return "typedef char* __builtin_va_list;"; } - + int getEHDataRegisterNumber(unsigned RegNo) const { if (RegNo == 0) return 0; if (RegNo == 1) return 2; @@ -1595,7 +1595,7 @@ public: // {} in inline assembly are neon specifiers, not assembly variant // specifiers. NoAsmVariants = true; - + // FIXME: Should we just treat this as a feature? IsThumb = getTriple().getArchName().startswith("thumb"); if (IsThumb) { @@ -1660,7 +1660,7 @@ public: else if (CPU == "cortex-a8" || CPU == "cortex-a9") Features["neon"] = true; } - + virtual bool setFeatureEnabled(llvm::StringMap &Features, const std::string &Name, bool Enabled) const { @@ -2335,7 +2335,7 @@ public: }; const char * const MipsTargetInfo::GCCRegNames[] = { - "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", + "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$sp", "$fp", "$31", diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 882571fdb232..d4ba92cdb646 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -943,7 +943,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // toolchains which have the integrated assembler on by default. bool IsVerboseAsmDefault = getToolChain().IsIntegratedAssemblerDefault(); if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm, - IsVerboseAsmDefault) || + IsVerboseAsmDefault) || Args.hasArg(options::OPT_dA)) CmdArgs.push_back("-masm-verbose"); @@ -1182,7 +1182,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden); - + // -fhosted is default. if (KernelOrKext || Args.hasFlag(options::OPT_ffreestanding, options::OPT_fhosted, @@ -1297,7 +1297,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-fno-signed-char"); // -fthreadsafe-static is default. - if (!Args.hasFlag(options::OPT_fthreadsafe_statics, + if (!Args.hasFlag(options::OPT_fthreadsafe_statics, options::OPT_fno_threadsafe_statics)) CmdArgs.push_back("-fno-threadsafe-statics"); @@ -1327,7 +1327,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // -fnext-runtime defaults to on Darwin and when rewriting Objective-C, and is // -the -cc1 default. - bool NeXTRuntimeIsDefault = + bool NeXTRuntimeIsDefault = IsRewriter || getToolChain().getTriple().getOS() == llvm::Triple::Darwin; if (!Args.hasFlag(options::OPT_fnext_runtime, options::OPT_fgnu_runtime, NeXTRuntimeIsDefault)) @@ -1375,7 +1375,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Version = 1; } } - + if (Version == 2 || Version == 3) { if (Version == 2) CmdArgs.push_back("-fobjc-nonfragile-abi"); @@ -1598,7 +1598,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, (*it)->claim(); D.Diag(clang::diag::warn_drv_clang_unsupported) << (*it)->getAsString(Args); } - + // Claim some arguments which clang supports automatically. // -fpch-preprocess is used with gcc to add a special marker in the output to @@ -1797,7 +1797,7 @@ void gcc::Compile::RenderExtraToolArgs(const JobAction &JA, if (JA.getType() != types::TY_PP_Asm) D.Diag(clang::diag::err_drv_invalid_gcc_output_type) << getTypeName(JA.getType()); - + CmdArgs.push_back("-S"); } } @@ -2545,7 +2545,7 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA, // categories. if (Args.hasArg(options::OPT_ObjC) || Args.hasArg(options::OPT_ObjCXX)) CmdArgs.push_back("-ObjC"); - + CmdArgs.push_back("-o"); CmdArgs.push_back(Output.getFilename()); @@ -2955,7 +2955,7 @@ void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA, if (getToolChain().getArchName() == "i386") CmdArgs.push_back("--32"); - + // Set byte order explicitly if (getToolChain().getArchName() == "mips") CmdArgs.push_back("-EB"); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 70bdd5b99cb7..b7ad08b8b2bb 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -152,7 +152,7 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts, // TimePasses is only derived. // UnitAtATime is unused. // Inlining is only derived. - + // UnrollLoops is derived, but also accepts an option, no // harm in pushing it back here. if (Opts.UnrollLoops) @@ -577,7 +577,7 @@ static void LangOptsToArgs(const LangOptions &Opts, switch (Opts.getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: break; case LangOptions::SOB_Defined: Res.push_back("-fwrapv"); break; - case LangOptions::SOB_Trapping: + case LangOptions::SOB_Trapping: Res.push_back("-ftrapv"); break; if (!Opts.OverflowHandler.empty()) { Res.push_back("-ftrapv-handler"); @@ -634,7 +634,7 @@ static void LangOptsToArgs(const LangOptions &Opts, } if (Opts.InlineVisibilityHidden) Res.push_back("-fvisibility-inlines-hidden"); - + if (Opts.getStackProtectorMode() != 0) { Res.push_back("-stack-protector"); Res.push_back(llvm::utostr(Opts.getStackProtectorMode())); @@ -866,7 +866,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.OptimizeSize = Args.hasArg(OPT_Os); Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) || Args.hasArg(OPT_ffreestanding)); - Opts.UnrollLoops = Args.hasArg(OPT_funroll_loops) || + Opts.UnrollLoops = Args.hasArg(OPT_funroll_loops) || (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize); Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose); @@ -953,17 +953,17 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, Diags.Report(diag::err_drv_invalid_value) << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args) << ShowCategory; - + Opts.ShowSourceRanges = Args.hasArg(OPT_fdiagnostics_print_source_range_info); Opts.ShowParseableFixits = Args.hasArg(OPT_fdiagnostics_parseable_fixits); Opts.VerifyDiagnostics = Args.hasArg(OPT_verify); Opts.ErrorLimit = Args.getLastArgIntValue(OPT_ferror_limit, 0, Diags); Opts.MacroBacktraceLimit - = Args.getLastArgIntValue(OPT_fmacro_backtrace_limit, + = Args.getLastArgIntValue(OPT_fmacro_backtrace_limit, DiagnosticOptions::DefaultMacroBacktraceLimit, Diags); Opts.TemplateBacktraceLimit - = Args.getLastArgIntValue(OPT_ftemplate_backtrace_limit, - DiagnosticOptions::DefaultTemplateBacktraceLimit, + = Args.getLastArgIntValue(OPT_ftemplate_backtrace_limit, + DiagnosticOptions::DefaultTemplateBacktraceLimit, Diags); Opts.TabStop = Args.getLastArgIntValue(OPT_ftabstop, DiagnosticOptions::DefaultTabStop, Diags); @@ -1313,15 +1313,15 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, if (Args.hasArg(OPT_fvisibility_inlines_hidden)) Opts.InlineVisibilityHidden = 1; - + if (Args.hasArg(OPT_ftrapv)) { - Opts.setSignedOverflowBehavior(LangOptions::SOB_Trapping); + Opts.setSignedOverflowBehavior(LangOptions::SOB_Trapping); // Set the handler, if one is specified. Opts.OverflowHandler = Args.getLastArgValue(OPT_ftrapv_handler); } else if (Args.hasArg(OPT_fwrapv)) - Opts.setSignedOverflowBehavior(LangOptions::SOB_Defined); + Opts.setSignedOverflowBehavior(LangOptions::SOB_Defined); // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs // is specified, or -std is set to a conforming mode. @@ -1423,7 +1423,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, size_t Comma = Value.find(','); unsigned Bytes = 0; unsigned EndOfLine = 0; - + if (Comma == llvm::StringRef::npos || Value.substr(0, Comma).getAsInteger(10, Bytes) || Value.substr(Comma + 1).getAsInteger(10, EndOfLine)) @@ -1433,7 +1433,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, Opts.PrecompiledPreambleBytes.second = (EndOfLine != 0); } } - + // Add macros from the command line. for (arg_iterator it = Args.filtered_begin(OPT_D, OPT_U), ie = Args.filtered_end(); it != ie; ++it) { diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 5389b5194408..ada41b446cae 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -81,7 +81,7 @@ PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) { PARSE_LANGOPT_IMPORTANT(ObjC2, diag::warn_pch_objective_c2); PARSE_LANGOPT_IMPORTANT(ObjCNonFragileABI, diag::warn_pch_nonfragile_abi); PARSE_LANGOPT_IMPORTANT(ObjCNonFragileABI2, diag::warn_pch_nonfragile_abi2); - PARSE_LANGOPT_IMPORTANT(NoConstantCFStrings, + PARSE_LANGOPT_IMPORTANT(NoConstantCFStrings, diag::warn_pch_no_constant_cfstrings); PARSE_LANGOPT_BENIGN(PascalStrings); PARSE_LANGOPT_BENIGN(WritableStrings); @@ -791,7 +791,7 @@ public: case DeclarationName::CXXUsingDirective: break; } - + return Key; } @@ -853,7 +853,7 @@ public: case DeclarationName::ObjCZeroArgSelector: case DeclarationName::ObjCOneArgSelector: case DeclarationName::ObjCMultiArgSelector: - Key.Data = + Key.Data = (uint64_t)Reader.DecodeSelector(ReadUnalignedLE32(d)).getAsOpaquePtr(); break; case DeclarationName::CXXConstructorName: @@ -870,7 +870,7 @@ public: case DeclarationName::CXXUsingDirective: break; } - + return Key; } @@ -1339,7 +1339,7 @@ bool ASTReader::ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, while (true) { uint64_t Offset = Cursor.GetCurrentBitNo(); unsigned Code = Cursor.ReadCode(); - + // We expect all abbrevs to be at the start of the block. if (Code != llvm::bitc::DEFINE_ABBREV) { Cursor.JumpToBit(Offset); @@ -1388,7 +1388,7 @@ void ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) { unsigned BlobLen = 0; Record.clear(); PreprocessorRecordTypes RecType = - (PreprocessorRecordTypes)Stream.ReadRecord(Code, Record, BlobStart, + (PreprocessorRecordTypes)Stream.ReadRecord(Code, Record, BlobStart, BlobLen); switch (RecType) { case PP_MACRO_OBJECT_LIKE: @@ -1436,13 +1436,13 @@ void ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) { // Remember that we saw this macro last so that we add the tokens that // form its body to it. Macro = MI; - + if (NextIndex + 1 == Record.size() && PP->getPreprocessingRecord()) { // We have a macro definition. Load it now. PP->getPreprocessingRecord()->RegisterMacroDefinition(Macro, getMacroDefinition(Record[NextIndex])); } - + ++NumMacrosRead; break; } @@ -1463,19 +1463,19 @@ void ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) { Macro->AddTokenToBody(Tok); break; } - + case PP_MACRO_INSTANTIATION: { // If we already have a macro, that means that we've hit the end // of the definition of the macro we were looking for. We're // done. if (Macro) return; - + if (!PP->getPreprocessingRecord()) { Error("missing preprocessing record in AST file"); return; } - + PreprocessingRecord &PPRec = *PP->getPreprocessingRecord(); if (PPRec.getPreprocessedEntity(Record[0])) return; @@ -1495,23 +1495,23 @@ void ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) { // done. if (Macro) return; - + if (!PP->getPreprocessingRecord()) { Error("missing preprocessing record in AST file"); return; } - + PreprocessingRecord &PPRec = *PP->getPreprocessingRecord(); if (PPRec.getPreprocessedEntity(Record[0])) return; - + if (Record[1] > MacroDefinitionsLoaded.size()) { Error("out-of-bounds macro definition record"); return; } // Decode the identifier info and then check again; if the macro is - // still defined and associated with the identifier, + // still defined and associated with the identifier, IdentifierInfo *II = DecodeIdentifierInfo(Record[4]); if (!MacroDefinitionsLoaded[Record[1] - 1]) { MacroDefinition *MD @@ -1520,38 +1520,38 @@ void ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) { SourceRange( ReadSourceLocation(F, Record[2]), ReadSourceLocation(F, Record[3]))); - + PPRec.SetPreallocatedEntity(Record[0], MD); MacroDefinitionsLoaded[Record[1] - 1] = MD; - + if (DeserializationListener) DeserializationListener->MacroDefinitionRead(Record[1], MD); } - + return; } - + case PP_INCLUSION_DIRECTIVE: { // If we already have a macro, that means that we've hit the end // of the definition of the macro we were looking for. We're // done. if (Macro) return; - + if (!PP->getPreprocessingRecord()) { Error("missing preprocessing record in AST file"); return; } - + PreprocessingRecord &PPRec = *PP->getPreprocessingRecord(); if (PPRec.getPreprocessedEntity(Record[0])) return; const char *FullFileNameStart = BlobStart + Record[3]; - const FileEntry *File + const FileEntry *File = PP->getFileManager().getFile(FullFileNameStart, FullFileNameStart + (BlobLen - Record[3])); - + // FIXME: Stable encoding InclusionDirective::InclusionKind Kind = static_cast(Record[5]); @@ -1580,7 +1580,7 @@ void ASTReader::ReadDefinedMacros() { llvm::BitstreamCursor Cursor = MacroCursor; Cursor.JumpToBit(F.MacroStartOffset); - + RecordData Record; while (true) { uint64_t Offset = Cursor.GetCurrentBitNo(); @@ -1619,7 +1619,7 @@ void ASTReader::ReadDefinedMacros() { case PP_TOKEN: // Ignore tokens. break; - + case PP_MACRO_INSTANTIATION: case PP_MACRO_DEFINITION: case PP_INCLUSION_DIRECTIVE: @@ -2805,7 +2805,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { llvm::SmallVector Protos; for (unsigned I = 0; I != NumProtos; ++I) Protos.push_back(cast(GetDecl(Record[Idx++]))); - return Context->getObjCObjectType(Base, Protos.data(), NumProtos); + return Context->getObjCObjectType(Base, Protos.data(), NumProtos); } case TYPE_OBJC_OBJECT_POINTER: { @@ -2831,7 +2831,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { return QualType(new (*Context, TypeAlignment) InjectedClassNameType(D, TST), 0); } - + case TYPE_TEMPLATE_TYPE_PARM: { unsigned Idx = 0; unsigned Depth = Record[Idx++]; @@ -2840,7 +2840,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { IdentifierInfo *Name = GetIdentifierInfo(Record, Idx); return Context->getTemplateTypeParmType(Depth, Index, Pack, Name); } - + case TYPE_DEPENDENT_NAME: { unsigned Idx = 0; ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++]; @@ -2849,7 +2849,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { QualType Canon = GetType(Record[Idx++]); return Context->getDependentNameType(Keyword, NNS, Name, Canon); } - + case TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION: { unsigned Idx = 0; ElaboratedTypeKeyword Keyword = (ElaboratedTypeKeyword)Record[Idx++]; @@ -2863,7 +2863,7 @@ QualType ASTReader::ReadTypeRecord(unsigned Index) { return Context->getDependentTemplateSpecializationType(Keyword, NNS, Name, Args.size(), Args.data()); } - + case TYPE_DEPENDENT_SIZED_ARRAY: { unsigned Idx = 0; @@ -3832,7 +3832,7 @@ Selector ASTReader::DecodeSelector(unsigned ID) { return SelectorsLoaded[ID - 1]; } -Selector ASTReader::GetExternalSelector(uint32_t ID) { +Selector ASTReader::GetExternalSelector(uint32_t ID) { return DecodeSelector(ID); } @@ -3938,7 +3938,7 @@ void ASTReader::ReadQualifierInfo(PerFileData &F, QualifierInfo &Info, TemplateName ASTReader::ReadTemplateName(const RecordData &Record, unsigned &Idx) { - TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++]; + TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++]; switch (Kind) { case TemplateName::Template: return TemplateName(cast_or_null(GetDecl(Record[Idx++]))); @@ -3951,14 +3951,14 @@ ASTReader::ReadTemplateName(const RecordData &Record, unsigned &Idx) { return Context->getOverloadedTemplateName(Decls.begin(), Decls.end()); } - + case TemplateName::QualifiedTemplate: { NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx); bool hasTemplKeyword = Record[Idx++]; TemplateDecl *Template = cast(GetDecl(Record[Idx++])); return Context->getQualifiedTemplateName(NNS, hasTemplKeyword, Template); } - + case TemplateName::DependentTemplate: { NestedNameSpecifier *NNS = ReadNestedNameSpecifier(Record, Idx); if (Record[Idx++]) // isIdentifier @@ -3968,7 +3968,7 @@ ASTReader::ReadTemplateName(const RecordData &Record, unsigned &Idx) { (OverloadedOperatorKind)Record[Idx++]); } } - + assert(0 && "Unhandled template name kind!"); return TemplateName(); } @@ -4003,7 +4003,7 @@ ASTReader::ReadTemplateArgument(PerFileData &F, return TemplArg; } } - + assert(0 && "Unhandled template argument kind!"); return TemplateArgument(); } @@ -4020,8 +4020,8 @@ ASTReader::ReadTemplateParameterList(PerFileData &F, Params.reserve(NumParams); while (NumParams--) Params.push_back(cast(GetDecl(Record[Idx++]))); - - TemplateParameterList* TemplateParams = + + TemplateParameterList* TemplateParams = TemplateParameterList::Create(*Context, TemplateLoc, LAngleLoc, Params.data(), Params.size(), RAngleLoc); return TemplateParams; @@ -4075,7 +4075,7 @@ ASTReader::ReadCXXBaseOrMemberInitializers(PerFileData &F, TypeSourceInfo *BaseClassInfo = 0; bool IsBaseVirtual = false; FieldDecl *Member = 0; - + bool IsBaseInitializer = Record[Idx++]; if (IsBaseInitializer) { BaseClassInfo = GetTypeSourceInfo(F, Record, Idx); @@ -4100,7 +4100,7 @@ ASTReader::ReadCXXBaseOrMemberInitializers(PerFileData &F, for (unsigned i=0; i != SourceOrderOrNumArrayIndices; ++i) Indices.push_back(cast(GetDecl(Record[Idx++]))); } - + CXXBaseOrMemberInitializer *BOMInit; if (IsBaseInitializer) { BOMInit = new (C) CXXBaseOrMemberInitializer(C, BaseClassInfo, diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 8cf7e85dc683..d0e4802524bf 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -643,7 +643,7 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(MACRO_DEFINITION_OFFSETS); RECORD(CHAINED_METADATA); RECORD(REFERENCED_SELECTOR_POOL); - + // SourceManager Block. BLOCK(SOURCE_MANAGER_BLOCK); RECORD(SM_SLOC_FILE_ENTRY); @@ -659,7 +659,7 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(PP_TOKEN); RECORD(PP_MACRO_INSTANTIATION); RECORD(PP_MACRO_DEFINITION); - + // Decls and Types block. BLOCK(DECLTYPES_BLOCK); RECORD(TYPE_EXT_QUAL); @@ -1279,9 +1279,9 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // in quotes Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // kind Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); - InclusionAbbrev = Stream.EmitAbbrev(Abbrev); + InclusionAbbrev = Stream.EmitAbbrev(Abbrev); } - + for (Preprocessor::macro_iterator I = PP.macro_begin(), E = PP.macro_end(); I != E; ++I) { // FIXME: This emits macros in hash table order, we should do it in a stable @@ -1296,7 +1296,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { // the macro comes from the original PCH but the identifier comes from a // chained PCH, by storing the offset into the original PCH rather than // writing the macro definition a second time. - if (MI->isBuiltinMacro() || + if (MI->isBuiltinMacro() || (Chain && I->first->isFromAST() && MI->isFromAST())) continue; @@ -1318,12 +1318,12 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { I != E; ++I) AddIdentifierRef(*I, Record); } - + // If we have a detailed preprocessing record, record the macro definition // ID that corresponds to this macro. if (PPRec) Record.push_back(getMacroDefinitionID(PPRec->findMacroDefinition(MI))); - + Stream.EmitRecord(Code, Record); Record.clear(); @@ -1351,7 +1351,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { } ++NumMacros; } - + // If the preprocessor has a preprocessing record, emit it. unsigned NumPreprocessingRecords = 0; if (PPRec) { @@ -1360,7 +1360,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { EEnd = PPRec->end(Chain); E != EEnd; ++E) { Record.clear(); - + if (MacroInstantiation *MI = dyn_cast(*E)) { Record.push_back(IndexBase + NumPreprocessingRecords++); AddSourceLocation(MI->getSourceRange().getBegin(), Record); @@ -1370,24 +1370,24 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { Stream.EmitRecord(PP_MACRO_INSTANTIATION, Record); continue; } - + if (MacroDefinition *MD = dyn_cast(*E)) { // Record this macro definition's location. MacroID ID = getMacroDefinitionID(MD); - + // Don't write the macro definition if it is from another AST file. if (ID < FirstMacroID) continue; - + unsigned Position = ID - FirstMacroID; if (Position != MacroDefinitionOffsets.size()) { if (Position > MacroDefinitionOffsets.size()) MacroDefinitionOffsets.resize(Position + 1); - - MacroDefinitionOffsets[Position] = Stream.GetCurrentBitNo(); + + MacroDefinitionOffsets[Position] = Stream.GetCurrentBitNo(); } else MacroDefinitionOffsets.push_back(Stream.GetCurrentBitNo()); - + Record.push_back(IndexBase + NumPreprocessingRecords++); Record.push_back(ID); AddSourceLocation(MD->getSourceRange().getBegin(), Record); @@ -1397,7 +1397,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { Stream.EmitRecord(PP_MACRO_DEFINITION, Record); continue; } - + if (InclusionDirective *ID = dyn_cast(*E)) { Record.push_back(PP_INCLUSION_DIRECTIVE); Record.push_back(IndexBase + NumPreprocessingRecords++); @@ -1414,9 +1414,9 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { } } } - + Stream.ExitBlock(); - + // Write the offsets table for the preprocessing record. if (NumPreprocessingRecords > 0) { // Write the offsets table for identifier IDs. @@ -1427,7 +1427,7 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP) { Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // # of macro defs Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); unsigned MacroDefOffsetAbbrev = Stream.EmitAbbrev(Abbrev); - + Record.clear(); Record.push_back(MACRO_DEFINITION_OFFSETS); Record.push_back(NumPreprocessingRecords); @@ -3046,7 +3046,7 @@ void ASTWriter::AddNestedNameSpecifier(NestedNameSpecifier *NNS, } void ASTWriter::AddTemplateName(TemplateName Name, RecordData &Record) { - TemplateName::NameKind Kind = Name.getKind(); + TemplateName::NameKind Kind = Name.getKind(); Record.push_back(Kind); switch (Kind) { case TemplateName::Template: @@ -3061,7 +3061,7 @@ void ASTWriter::AddTemplateName(TemplateName Name, RecordData &Record) { AddDeclRef(*I, Record); break; } - + case TemplateName::QualifiedTemplate: { QualifiedTemplateName *QualT = Name.getAsQualifiedTemplateName(); AddNestedNameSpecifier(QualT->getQualifier(), Record); @@ -3069,7 +3069,7 @@ void ASTWriter::AddTemplateName(TemplateName Name, RecordData &Record) { AddDeclRef(QualT->getTemplateDecl(), Record); break; } - + case TemplateName::DependentTemplate: { DependentTemplateName *DepT = Name.getAsDependentTemplateName(); AddNestedNameSpecifier(DepT->getQualifier(), Record); @@ -3083,7 +3083,7 @@ void ASTWriter::AddTemplateName(TemplateName Name, RecordData &Record) { } } -void ASTWriter::AddTemplateArgument(const TemplateArgument &Arg, +void ASTWriter::AddTemplateArgument(const TemplateArgument &Arg, RecordData &Record) { Record.push_back(Arg.getKind()); switch (Arg.getKind()) { @@ -3206,7 +3206,7 @@ void ASTWriter::IdentifierRead(IdentID ID, IdentifierInfo *II) { void ASTWriter::TypeRead(TypeIdx Idx, QualType T) { // Always take the highest-numbered type index. This copes with an interesting // case for chained AST writing where we schedule writing the type and then, - // later, deserialize the type from another AST. In this case, we want to + // later, deserialize the type from another AST. In this case, we want to // keep the higher-numbered entry so that we can properly write it out to // the AST file. TypeIdx &StoredIdx = TypeIdxs[T]; @@ -3222,7 +3222,7 @@ void ASTWriter::SelectorRead(SelectorID ID, Selector S) { SelectorIDs[S] = ID; } -void ASTWriter::MacroDefinitionRead(serialization::MacroID ID, +void ASTWriter::MacroDefinitionRead(serialization::MacroID ID, MacroDefinition *MD) { MacroDefinitions[MD] = ID; }