From bbafb8a745736afb1b4b0c9bf4da896c5587f7c7 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sun, 11 Mar 2012 07:00:24 +0000 Subject: [PATCH] Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536 --- clang/examples/wpa/clang-wpa.cpp | 8 +- clang/include/clang/AST/ASTContext.h | 4 +- clang/include/clang/Edit/EditedSource.h | 2 +- clang/include/clang/Lex/Lexer.h | 30 +- clang/include/clang/Lex/Preprocessor.h | 20 +- clang/include/clang/Parse/Parser.h | 20 +- clang/include/clang/Sema/Initialization.h | 2 +- clang/include/clang/Sema/Lookup.h | 2 +- clang/include/clang/Sema/Sema.h | 4 +- .../StaticAnalyzer/Core/CheckerManager.h | 2 +- .../Core/PathSensitive/AnalysisManager.h | 6 +- .../Core/PathSensitive/CheckerContext.h | 4 +- clang/lib/ARCMigrate/ARCMT.cpp | 14 +- clang/lib/ARCMigrate/ObjCMT.cpp | 4 +- .../lib/ARCMigrate/TransBlockObjCVariable.cpp | 2 +- clang/lib/ARCMigrate/TransGCAttrs.cpp | 2 +- .../ARCMigrate/TransRetainReleaseDealloc.cpp | 2 +- clang/lib/ARCMigrate/Transforms.cpp | 14 +- clang/lib/AST/ASTContext.cpp | 22 +- clang/lib/AST/ASTDiagnostic.cpp | 2 +- clang/lib/AST/ASTImporter.cpp | 10 +- clang/lib/AST/Decl.cpp | 44 +-- clang/lib/AST/DeclBase.cpp | 2 +- clang/lib/AST/DeclCXX.cpp | 6 +- clang/lib/AST/DeclObjC.cpp | 2 +- clang/lib/AST/Expr.cpp | 12 +- clang/lib/AST/ExprClassification.cpp | 20 +- clang/lib/AST/ExprConstant.cpp | 18 +- clang/lib/AST/ItaniumMangle.cpp | 4 +- clang/lib/AST/MicrosoftMangle.cpp | 4 +- clang/lib/AST/RecordLayoutBuilder.cpp | 12 +- clang/lib/AST/StmtDumper.cpp | 4 +- clang/lib/AST/StmtPrinter.cpp | 2 +- clang/lib/AST/Type.cpp | 14 +- clang/lib/AST/VTableBuilder.cpp | 4 +- clang/lib/Analysis/AnalysisDeclContext.cpp | 2 +- clang/lib/Analysis/CFG.cpp | 2 +- clang/lib/CodeGen/CGBlocks.cpp | 16 +- clang/lib/CodeGen/CGCall.cpp | 10 +- clang/lib/CodeGen/CGClass.cpp | 14 +- clang/lib/CodeGen/CGDebugInfo.cpp | 20 +- clang/lib/CodeGen/CGDecl.cpp | 10 +- clang/lib/CodeGen/CGDeclCXX.cpp | 6 +- clang/lib/CodeGen/CGException.cpp | 26 +- clang/lib/CodeGen/CGExpr.cpp | 20 +- clang/lib/CodeGen/CGExprAgg.cpp | 10 +- clang/lib/CodeGen/CGExprCXX.cpp | 10 +- clang/lib/CodeGen/CGExprComplex.cpp | 4 +- clang/lib/CodeGen/CGExprScalar.cpp | 32 +- clang/lib/CodeGen/CGObjC.cpp | 34 +-- clang/lib/CodeGen/CGObjCGNU.cpp | 30 +- clang/lib/CodeGen/CGObjCMac.cpp | 36 +-- clang/lib/CodeGen/CGObjCRuntime.cpp | 2 +- clang/lib/CodeGen/CGRTTI.cpp | 8 +- clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 4 +- clang/lib/CodeGen/CGStmt.cpp | 2 +- clang/lib/CodeGen/CGVTables.cpp | 2 +- clang/lib/CodeGen/CodeGenFunction.cpp | 10 +- clang/lib/CodeGen/CodeGenFunction.h | 6 +- clang/lib/CodeGen/CodeGenModule.cpp | 80 ++--- clang/lib/CodeGen/CodeGenModule.h | 6 +- clang/lib/CodeGen/CodeGenTypes.cpp | 2 +- clang/lib/CodeGen/ItaniumCXXABI.cpp | 4 +- clang/lib/CodeGen/ModuleBuilder.cpp | 2 +- clang/lib/CodeGen/TargetInfo.cpp | 8 +- clang/lib/Edit/Commit.cpp | 2 +- clang/lib/Edit/RewriteObjCFoundationAPI.cpp | 2 +- clang/lib/Frontend/ASTMerge.cpp | 2 +- clang/lib/Frontend/ASTUnit.cpp | 10 +- clang/lib/Frontend/CacheTokens.cpp | 2 +- clang/lib/Frontend/ChainedIncludesSource.cpp | 2 +- clang/lib/Frontend/FrontendAction.cpp | 2 +- clang/lib/Frontend/FrontendActions.cpp | 2 +- clang/lib/Frontend/InitPreprocessor.cpp | 12 +- .../lib/Frontend/PrintPreprocessedOutput.cpp | 2 +- .../lib/Frontend/VerifyDiagnosticConsumer.cpp | 2 +- clang/lib/Index/ASTLocation.cpp | 2 +- clang/lib/Lex/Lexer.cpp | 120 ++++---- clang/lib/Lex/LiteralSupport.cpp | 12 +- clang/lib/Lex/PPDirectives.cpp | 34 +-- clang/lib/Lex/PPExpressions.cpp | 8 +- clang/lib/Lex/PPMacroExpansion.cpp | 10 +- clang/lib/Lex/Pragma.cpp | 2 +- clang/lib/Lex/Preprocessor.cpp | 10 +- clang/lib/Lex/TokenConcatenation.cpp | 14 +- clang/lib/Lex/TokenLexer.cpp | 8 +- clang/lib/Parse/ParseCXXInlineMethods.cpp | 8 +- clang/lib/Parse/ParseDecl.cpp | 146 ++++----- clang/lib/Parse/ParseDeclCXX.cpp | 44 +-- clang/lib/Parse/ParseExpr.cpp | 64 ++-- clang/lib/Parse/ParseExprCXX.cpp | 30 +- clang/lib/Parse/ParseInit.cpp | 12 +- clang/lib/Parse/ParseObjc.cpp | 26 +- clang/lib/Parse/ParsePragma.cpp | 4 +- clang/lib/Parse/ParseStmt.cpp | 38 +-- clang/lib/Parse/ParseTemplate.cpp | 8 +- clang/lib/Parse/ParseTentative.cpp | 22 +- clang/lib/Parse/Parser.cpp | 60 ++-- clang/lib/Rewrite/HTMLPrint.cpp | 2 +- clang/lib/Rewrite/HTMLRewrite.cpp | 4 +- clang/lib/Rewrite/RewriteMacros.cpp | 4 +- clang/lib/Rewrite/RewriteModernObjC.cpp | 2 +- clang/lib/Rewrite/RewriteObjC.cpp | 2 +- clang/lib/Rewrite/RewriteTest.cpp | 2 +- clang/lib/Sema/DeclSpec.cpp | 12 +- clang/lib/Sema/IdentifierResolver.cpp | 2 +- clang/lib/Sema/JumpDiagnostics.cpp | 8 +- clang/lib/Sema/Sema.cpp | 16 +- clang/lib/Sema/SemaAccess.cpp | 24 +- clang/lib/Sema/SemaAttr.cpp | 2 +- clang/lib/Sema/SemaCXXScopeSpec.cpp | 14 +- clang/lib/Sema/SemaCast.cpp | 24 +- clang/lib/Sema/SemaChecking.cpp | 20 +- clang/lib/Sema/SemaCodeComplete.cpp | 142 ++++----- clang/lib/Sema/SemaDecl.cpp | 280 +++++++++--------- clang/lib/Sema/SemaDeclAttr.cpp | 8 +- clang/lib/Sema/SemaDeclCXX.cpp | 70 ++--- clang/lib/Sema/SemaDeclObjC.cpp | 30 +- clang/lib/Sema/SemaExceptionSpec.cpp | 16 +- clang/lib/Sema/SemaExpr.cpp | 214 ++++++------- clang/lib/Sema/SemaExprCXX.cpp | 52 ++-- clang/lib/Sema/SemaExprMember.cpp | 16 +- clang/lib/Sema/SemaExprObjC.cpp | 50 ++-- clang/lib/Sema/SemaInit.cpp | 84 +++--- clang/lib/Sema/SemaLambda.cpp | 2 +- clang/lib/Sema/SemaLookup.cpp | 66 ++--- clang/lib/Sema/SemaObjCProperty.cpp | 66 ++--- clang/lib/Sema/SemaOverload.cpp | 66 ++--- clang/lib/Sema/SemaPseudoObject.cpp | 16 +- clang/lib/Sema/SemaStmt.cpp | 36 +-- clang/lib/Sema/SemaTemplate.cpp | 48 +-- clang/lib/Sema/SemaTemplateDeduction.cpp | 12 +- clang/lib/Sema/SemaTemplateInstantiate.cpp | 6 +- .../lib/Sema/SemaTemplateInstantiateDecl.cpp | 14 +- clang/lib/Sema/SemaTemplateVariadic.cpp | 4 +- clang/lib/Sema/SemaType.cpp | 56 ++-- clang/lib/Sema/TargetAttributesSema.cpp | 2 +- clang/lib/Sema/TreeTransform.h | 2 +- clang/lib/Serialization/ASTReader.cpp | 8 +- clang/lib/Serialization/ASTReaderDecl.cpp | 2 +- clang/lib/Serialization/ASTWriter.cpp | 8 +- .../Checkers/CheckObjCDealloc.cpp | 4 +- .../StaticAnalyzer/Checkers/DebugCheckers.cpp | 4 +- .../Checkers/NSAutoreleasePoolChecker.cpp | 2 +- .../Checkers/ObjCAtSyncChecker.cpp | 2 +- .../Checkers/RetainCountChecker.cpp | 14 +- .../Checkers/StackAddrEscapeChecker.cpp | 4 +- .../StaticAnalyzer/Core/AnalysisManager.cpp | 4 +- .../StaticAnalyzer/Core/CheckerContext.cpp | 4 +- clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 2 +- .../StaticAnalyzer/Core/HTMLDiagnostics.cpp | 4 +- clang/lib/StaticAnalyzer/Core/MemRegion.cpp | 4 +- .../StaticAnalyzer/Core/PlistDiagnostics.cpp | 2 +- .../Frontend/AnalysisConsumer.cpp | 6 +- clang/tools/arcmt-test/arcmt-test.cpp | 2 +- clang/tools/libclang/CIndex.cpp | 8 +- clang/tools/libclang/CIndexCodeCompletion.cpp | 10 +- clang/tools/libclang/CIndexDiagnostic.cpp | 2 +- clang/tools/libclang/CIndexUSRs.cpp | 2 +- clang/tools/libclang/CXSourceLocation.h | 4 +- 160 files changed, 1531 insertions(+), 1531 deletions(-) diff --git a/clang/examples/wpa/clang-wpa.cpp b/clang/examples/wpa/clang-wpa.cpp index 8e29090fe78b..f8a3e5cb96e6 100644 --- a/clang/examples/wpa/clang-wpa.cpp +++ b/clang/examples/wpa/clang-wpa.cpp @@ -151,16 +151,16 @@ int main(int argc, char **argv) { Opts.CheckersControlList.push_back(std::make_pair("macosx", true)); // Checks to perform for Objective-C/Objective-C++. - if (PP.getLangOptions().ObjC1) + if (PP.getLangOpts().ObjC1) Opts.CheckersControlList.push_back(std::make_pair("cocoa", true)); OwningPtr checkerMgr; - checkerMgr.reset(ento::registerCheckers(Opts, PP.getLangOptions(), + checkerMgr.reset(ento::registerCheckers(Opts, PP.getLangOpts(), PP.getDiagnostics())); using namespace clang::ento; AnalysisManager AMgr(TU->getASTContext(), PP.getDiagnostics(), - PP.getLangOptions(), /* PathDiagnostic */ 0, + PP.getLangOpts(), /* PathDiagnostic */ 0, CreateRegionStoreManager, CreateRangeConstraintManager, checkerMgr.get(), &Idxer, Opts.MaxNodes, Opts.MaxLoop, @@ -172,7 +172,7 @@ int main(int argc, char **argv) { Opts.EagerlyTrimEGraph); TransferFuncs* TF = MakeCFRefCountTF(AMgr.getASTContext(), /*GC*/false, - AMgr.getLangOptions()); + AMgr.getLangOpts()); ExprEngine Eng(AMgr, TF); Eng.ExecuteWorkList(AMgr.getStackFrame(FD, TU), AMgr.getMaxNodes()); diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 425ee3cdb231..96e41c5d0357 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -411,7 +411,7 @@ public: const TargetInfo &getTargetInfo() const { return *Target; } - const LangOptions& getLangOptions() const { return LangOpts; } + const LangOptions& getLangOpts() const { return LangOpts; } DiagnosticsEngine &getDiagnostics() const; @@ -1058,7 +1058,7 @@ public: /// \brief The result type of logical operations, '<', '>', '!=', etc. QualType getLogicalOperationType() const { - return getLangOptions().CPlusPlus ? BoolTy : IntTy; + return getLangOpts().CPlusPlus ? BoolTy : IntTy; } /// getObjCEncodingForType - Emit the ObjC type encoding for the diff --git a/clang/include/clang/Edit/EditedSource.h b/clang/include/clang/Edit/EditedSource.h index 095ec74c7b92..c685753e4b65 100644 --- a/clang/include/clang/Edit/EditedSource.h +++ b/clang/include/clang/Edit/EditedSource.h @@ -50,7 +50,7 @@ public: StrAlloc(/*size=*/512) { } const SourceManager &getSourceManager() const { return SourceMgr; } - const LangOptions &getLangOptions() const { return LangOpts; } + const LangOptions &getLangOpts() const { return LangOpts; } const PreprocessingRecord *getPreprocessingRecord() const { return PPRec; } bool canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs); diff --git a/clang/include/clang/Lex/Lexer.h b/clang/include/clang/Lex/Lexer.h index df303949471a..04bcead6d45e 100644 --- a/clang/include/clang/Lex/Lexer.h +++ b/clang/include/clang/Lex/Lexer.h @@ -51,7 +51,7 @@ class Lexer : public PreprocessorLexer { const char *BufferStart; // Start of the buffer. const char *BufferEnd; // End of the buffer. SourceLocation FileLoc; // Location for start of file. - LangOptions Features; // Features enabled by this language (cache). + LangOptions LangOpts; // LangOpts enabled by this language (cache). bool Is_PragmaLexer; // True if lexer for _Pragma handling. //===--------------------------------------------------------------------===// @@ -99,14 +99,14 @@ public: /// Lexer constructor - Create a new raw lexer object. This object is only /// suitable for calls to 'LexRawToken'. This lexer assumes that the text /// range will outlive it, so it doesn't take ownership of it. - Lexer(SourceLocation FileLoc, const LangOptions &Features, + Lexer(SourceLocation FileLoc, const LangOptions &LangOpts, const char *BufStart, const char *BufPtr, const char *BufEnd); /// Lexer constructor - Create a new raw lexer object. This object is only /// suitable for calls to 'LexRawToken'. This lexer assumes that the text /// range will outlive it, so it doesn't take ownership of it. Lexer(FileID FID, const llvm::MemoryBuffer *InputBuffer, - const SourceManager &SM, const LangOptions &Features); + const SourceManager &SM, const LangOptions &LangOpts); /// Create_PragmaLexer: Lexer constructor - Create a new lexer object for /// _Pragma expansion. This has a variety of magic semantics that this method @@ -117,9 +117,9 @@ public: unsigned TokLen, Preprocessor &PP); - /// getFeatures - Return the language features currently enabled. NOTE: this - /// lexer modifies features as a file is parsed! - const LangOptions &getFeatures() const { return Features; } + /// getLangOpts - Return the language features currently enabled. + /// NOTE: this lexer modifies features as a file is parsed! + const LangOptions &getLangOpts() const { return LangOpts; } /// getFileLoc - Return the File Location for the file we are lexing out of. /// The physical location encodes the location where the characters come from, @@ -240,7 +240,7 @@ public: /// if an internal buffer is returned. static unsigned getSpelling(const Token &Tok, const char *&Buffer, const SourceManager &SourceMgr, - const LangOptions &Features, + const LangOptions &LangOpts, bool *Invalid = 0); /// getSpelling() - Return the 'spelling' of the Tok token. The spelling of a @@ -250,7 +250,7 @@ public: /// UCNs, etc. static std::string getSpelling(const Token &Tok, const SourceManager &SourceMgr, - const LangOptions &Features, + const LangOptions &LangOpts, bool *Invalid = 0); /// getSpelling - This method is used to get the spelling of the @@ -264,7 +264,7 @@ public: static StringRef getSpelling(SourceLocation loc, SmallVectorImpl &buffer, const SourceManager &SourceMgr, - const LangOptions &Features, + const LangOptions &LangOpts, bool *invalid = 0); /// MeasureTokenLength - Relex the token at the specified location and return @@ -290,7 +290,7 @@ public: static SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Character, const SourceManager &SM, - const LangOptions &Features); + const LangOptions &LangOpts); /// \brief Computes the source location just past the end of the /// token at this source location. @@ -309,7 +309,7 @@ public: /// a source location pointing to the last character in the token, etc. static SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset, const SourceManager &SM, - const LangOptions &Features); + const LangOptions &LangOpts); /// \brief Returns true if the given MacroID location points at the first /// token of the macro expansion. @@ -372,7 +372,7 @@ public: /// of the file begins along with a boolean value indicating whether /// the preamble ends at the beginning of a new line. static std::pair - ComputePreamble(const llvm::MemoryBuffer *Buffer, const LangOptions &Features, + ComputePreamble(const llvm::MemoryBuffer *Buffer, const LangOptions &LangOpts, unsigned MaxLines = 0); //===--------------------------------------------------------------------===// @@ -486,7 +486,7 @@ public: /// getCharAndSizeNoWarn - Like the getCharAndSize method, but does not ever /// emit a warning. static inline char getCharAndSizeNoWarn(const char *Ptr, unsigned &Size, - const LangOptions &Features) { + const LangOptions &LangOpts) { // If this is not a trigraph and not a UCN or escaped newline, return // quickly. if (isObviouslySimpleCharacter(Ptr[0])) { @@ -495,7 +495,7 @@ public: } Size = 0; - return getCharAndSizeSlowNoWarn(Ptr, Size, Features); + return getCharAndSizeSlowNoWarn(Ptr, Size, LangOpts); } /// getEscapedNewLineSize - Return the size of the specified escaped newline, @@ -524,7 +524,7 @@ private: /// getCharAndSizeSlowNoWarn - Same as getCharAndSizeSlow, but never emits a /// diagnostic. static char getCharAndSizeSlowNoWarn(const char *Ptr, unsigned &Size, - const LangOptions &Features); + const LangOptions &LangOpts); //===--------------------------------------------------------------------===// // Other lexer functions. diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index c5bccb11715d..508c168f998f 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -62,7 +62,7 @@ class ModuleLoader; /// class Preprocessor : public RefCountedBase { DiagnosticsEngine *Diags; - LangOptions &Features; + LangOptions &LangOpts; const TargetInfo *Target; FileManager &FileMgr; SourceManager &SourceMgr; @@ -357,7 +357,7 @@ public: DiagnosticsEngine &getDiagnostics() const { return *Diags; } void setDiagnostics(DiagnosticsEngine &D) { Diags = &D; } - const LangOptions &getLangOptions() const { return Features; } + const LangOptions &getLangOpts() const { return LangOpts; } const TargetInfo &getTargetInfo() const { return *Target; } FileManager &getFileManager() const { return FileMgr; } SourceManager &getSourceManager() const { return SourceMgr; } @@ -782,7 +782,7 @@ public: StringRef getSpelling(SourceLocation loc, SmallVectorImpl &buffer, bool *invalid = 0) const { - return Lexer::getSpelling(loc, buffer, SourceMgr, Features, invalid); + return Lexer::getSpelling(loc, buffer, SourceMgr, LangOpts, invalid); } /// getSpelling() - Return the 'spelling' of the Tok token. The spelling of a @@ -793,7 +793,7 @@ public: /// /// \param Invalid If non-null, will be set \c true if an error occurs. std::string getSpelling(const Token &Tok, bool *Invalid = 0) const { - return Lexer::getSpelling(Tok, SourceMgr, Features, Invalid); + return Lexer::getSpelling(Tok, SourceMgr, LangOpts, Invalid); } /// getSpelling - This method is used to get the spelling of a token into a @@ -808,7 +808,7 @@ public: /// if an internal buffer is returned. unsigned getSpelling(const Token &Tok, const char *&Buffer, bool *Invalid = 0) const { - return Lexer::getSpelling(Tok, Buffer, SourceMgr, Features, Invalid); + return Lexer::getSpelling(Tok, Buffer, SourceMgr, LangOpts, Invalid); } /// getSpelling - This method is used to get the spelling of a token into a @@ -843,7 +843,7 @@ public: /// refers to the SourceManager-owned buffer of the source where that macro /// name is spelled. Thus, the result shouldn't out-live the SourceManager. StringRef getImmediateMacroName(SourceLocation Loc) { - return Lexer::getImmediateMacroName(Loc, SourceMgr, getLangOptions()); + return Lexer::getImmediateMacroName(Loc, SourceMgr, getLangOpts()); } /// CreateString - Plop the specified string into a scratch buffer and set the @@ -869,7 +869,7 @@ public: /// location pointing just past the end of the token; an offset of 1 produces /// a source location pointing to the last character in the token, etc. SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset = 0) { - return Lexer::getLocForEndOfToken(Loc, Offset, SourceMgr, Features); + return Lexer::getLocForEndOfToken(Loc, Offset, SourceMgr, LangOpts); } /// \brief Returns true if the given MacroID location points at the first @@ -879,7 +879,7 @@ public: /// begin location of the macro. bool isAtStartOfMacroExpansion(SourceLocation loc, SourceLocation *MacroBegin = 0) const { - return Lexer::isAtStartOfMacroExpansion(loc, SourceMgr, Features, + return Lexer::isAtStartOfMacroExpansion(loc, SourceMgr, LangOpts, MacroBegin); } @@ -890,7 +890,7 @@ public: /// end location of the macro. bool isAtEndOfMacroExpansion(SourceLocation loc, SourceLocation *MacroEnd = 0) const { - return Lexer::isAtEndOfMacroExpansion(loc, SourceMgr, Features, MacroEnd); + return Lexer::isAtEndOfMacroExpansion(loc, SourceMgr, LangOpts, MacroEnd); } /// DumpToken - Print the token to stderr, used for debugging. @@ -903,7 +903,7 @@ public: /// token, return a new location that specifies a character within the token. SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Char) const { - return Lexer::AdvanceToTokenCharacter(TokStart, Char, SourceMgr, Features); + return Lexer::AdvanceToTokenCharacter(TokStart, Char, SourceMgr, LangOpts); } /// IncrementPasteCounter - Increment the counters for the number of token diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index e3b6fe2cf4f9..2124f1ebe28e 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -202,7 +202,7 @@ public: Parser(Preprocessor &PP, Sema &Actions); ~Parser(); - const LangOptions &getLang() const { return PP.getLangOptions(); } + const LangOptions &getLangOpts() const { return PP.getLangOpts(); } const TargetInfo &getTargetInfo() const { return PP.getTargetInfo(); } Preprocessor &getPreprocessor() const { return PP; } Sema &getActions() const { return Actions; } @@ -544,7 +544,7 @@ private: bool TryAltiVecToken(DeclSpec &DS, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, bool &isInvalid) { - if (!getLang().AltiVec || + if (!getLangOpts().AltiVec || (Tok.getIdentifierInfo() != Ident_vector && Tok.getIdentifierInfo() != Ident_pixel)) return false; @@ -556,7 +556,7 @@ private: /// identifier token, replacing it with the non-context-sensitive __vector. /// This returns true if the token was replaced. bool TryAltiVecVectorToken() { - if (!getLang().AltiVec || + if (!getLangOpts().AltiVec || Tok.getIdentifierInfo() != Ident_vector) return false; return TryAltiVecVectorTokenOutOfLine(); } @@ -1712,7 +1712,7 @@ private: /// expression statement, when parsing function bodies. /// Returns true for declaration, false for expression. bool isDeclarationStatement() { - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) return isCXXDeclarationStatement(); return isDeclarationSpecifier(true); } @@ -1722,7 +1722,7 @@ private: // 'for-init-statement' part of a 'for' statement. /// Returns true for declaration, false for expression. bool isForInitDeclaration() { - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) return isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true); return isDeclarationSpecifier(true); } @@ -1748,7 +1748,7 @@ private: /// whether the parens contain an expression or a type-id. /// Returns true for a type-id and false for an expression. bool isTypeIdInParens(bool &isAmbiguous) { - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) return isCXXTypeId(TypeIdInParens, isAmbiguous); isAmbiguous = false; return isTypeSpecifierQualifier(); @@ -1890,7 +1890,7 @@ private: SourceLocation *EndLoc); void MaybeParseCXX0XAttributes(Declarator &D) { - if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) { + if (getLangOpts().CPlusPlus0x && isCXX0XAttributeSpecifier()) { ParsedAttributesWithRange attrs(AttrFactory); SourceLocation endLoc; ParseCXX0XAttributes(attrs, &endLoc); @@ -1899,7 +1899,7 @@ private: } void MaybeParseCXX0XAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = 0) { - if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) { + if (getLangOpts().CPlusPlus0x && isCXX0XAttributeSpecifier()) { ParsedAttributesWithRange attrsWithRange(AttrFactory); ParseCXX0XAttributes(attrsWithRange, endLoc); attrs.takeAllFrom(attrsWithRange); @@ -1907,7 +1907,7 @@ private: } void MaybeParseCXX0XAttributes(ParsedAttributesWithRange &attrs, SourceLocation *endLoc = 0) { - if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) + if (getLangOpts().CPlusPlus0x && isCXX0XAttributeSpecifier()) ParseCXX0XAttributes(attrs, endLoc); } @@ -1918,7 +1918,7 @@ private: void MaybeParseMicrosoftAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = 0) { - if (getLang().MicrosoftExt && Tok.is(tok::l_square)) + if (getLangOpts().MicrosoftExt && Tok.is(tok::l_square)) ParseMicrosoftAttributes(attrs, endLoc); } void ParseMicrosoftAttributes(ParsedAttributes &attrs, diff --git a/clang/include/clang/Sema/Initialization.h b/clang/include/clang/Sema/Initialization.h index 1c31c574b1a9..90407034362a 100644 --- a/clang/include/clang/Sema/Initialization.h +++ b/clang/include/clang/Sema/Initialization.h @@ -175,7 +175,7 @@ public: /// \brief Create the initialization entity for a parameter. static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm) { - bool Consumed = (Context.getLangOptions().ObjCAutoRefCount && + bool Consumed = (Context.getLangOpts().ObjCAutoRefCount && Parm->hasAttr()); InitializedEntity Entity; diff --git a/clang/include/clang/Sema/Lookup.h b/clang/include/clang/Sema/Lookup.h index d35711a361d4..fe5d2627335a 100644 --- a/clang/include/clang/Sema/Lookup.h +++ b/clang/include/clang/Sema/Lookup.h @@ -592,7 +592,7 @@ private: void diagnose() { if (isAmbiguous()) SemaRef.DiagnoseAmbiguousLookup(*this); - else if (isClassLookup() && SemaRef.getLangOptions().AccessControl) + else if (isClassLookup() && SemaRef.getLangOpts().AccessControl) SemaRef.CheckLookupAccess(*this); } diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index a1d743bd4bbe..cd200f327adb 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -745,7 +745,7 @@ public: /// initialized but before it parses anything. void Initialize(); - const LangOptions &getLangOptions() const { return LangOpts; } + const LangOptions &getLangOpts() const { return LangOpts; } OpenCLOptions &getOpenCLOptions() { return OpenCLFeatures; } FPOptions &getFPOptions() { return FPFeatures; } @@ -3024,7 +3024,7 @@ public: public: explicit ImplicitExceptionSpecification(ASTContext &Context) : Context(&Context), ComputedEST(EST_BasicNoexcept) { - if (!Context.getLangOptions().CPlusPlus0x) + if (!Context.getLangOpts().CPlusPlus0x) ComputedEST = EST_DynamicNone; } diff --git a/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h b/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h index fa22f53d5fd8..b8a024b9cc9b 100644 --- a/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h +++ b/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h @@ -128,7 +128,7 @@ public: void finishedCheckerRegistration(); - const LangOptions &getLangOptions() const { return LangOpts; } + const LangOptions &getLangOpts() const { return LangOpts; } typedef CheckerBase *CheckerRef; typedef const void *CheckerTag; diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h index c191a658830b..3e19b2632892 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -38,7 +38,7 @@ class AnalysisManager : public BugReporterData { ASTContext &Ctx; DiagnosticsEngine &Diags; - const LangOptions &LangInfo; + const LangOptions &LangOpts; OwningPtr PD; @@ -148,8 +148,8 @@ public: return Diags; } - const LangOptions &getLangOptions() const { - return LangInfo; + const LangOptions &getLangOpts() const { + return LangOpts; } virtual PathDiagnosticConsumer *getPathDiagnosticConsumer() { diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index d02eab77c838..3bed6daf7c68 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -78,8 +78,8 @@ public: return Eng.getContext(); } - const LangOptions &getLangOptions() const { - return Eng.getContext().getLangOptions(); + const LangOptions &getLangOpts() const { + return Eng.getContext().getLangOpts(); } const LocationContext *getLocationContext() const { diff --git a/clang/lib/ARCMigrate/ARCMT.cpp b/clang/lib/ARCMigrate/ARCMT.cpp index 07f22c4f3698..9354dc38b8c6 100644 --- a/clang/lib/ARCMigrate/ARCMT.cpp +++ b/clang/lib/ARCMigrate/ARCMT.cpp @@ -211,7 +211,7 @@ static void emitPremigrationErrors(const CapturedDiagList &arcDiags, new DiagnosticsEngine(DiagID, &printer, /*ShouldOwnClient=*/false)); Diags->setSourceManager(&PP.getSourceManager()); - printer.BeginSourceFile(PP.getLangOptions(), &PP); + printer.BeginSourceFile(PP.getLangOpts(), &PP); arcDiags.reportDiagnostics(*Diags); printer.EndSourceFile(); } @@ -264,7 +264,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI, if (Diags->hasFatalErrorOccurred()) { Diags->Reset(); - DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor()); + DiagClient->BeginSourceFile(Ctx.getLangOpts(), &Unit->getPreprocessor()); capturedDiags.reportDiagnostics(*Diags); DiagClient->EndSourceFile(); return true; @@ -279,7 +279,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI, I = capturedDiags.begin(), E = capturedDiags.end(); I != E; ++I) arcDiags.push_back(*I); writeARCDiagsToPlist(plistOut, arcDiags, - Ctx.getSourceManager(), Ctx.getLangOptions()); + Ctx.getSourceManager(), Ctx.getLangOpts()); } // After parsing of source files ended, we want to reuse the @@ -287,7 +287,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI, // We call BeginSourceFile because DiagnosticConsumer requires that // diagnostics with source range information are emitted only in between // BeginSourceFile() and EndSourceFile(). - DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor()); + DiagClient->BeginSourceFile(Ctx.getLangOpts(), &Unit->getPreprocessor()); // No macros will be added since we are just checking and we won't modify // source code. @@ -573,7 +573,7 @@ bool MigrationProcess::applyTransform(TransformFn trans, if (Diags->hasFatalErrorOccurred()) { Diags->Reset(); - DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor()); + DiagClient->BeginSourceFile(Ctx.getLangOpts(), &Unit->getPreprocessor()); capturedDiags.reportDiagnostics(*Diags); DiagClient->EndSourceFile(); return true; @@ -584,9 +584,9 @@ bool MigrationProcess::applyTransform(TransformFn trans, // We call BeginSourceFile because DiagnosticConsumer requires that // diagnostics with source range information are emitted only in between // BeginSourceFile() and EndSourceFile(). - DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor()); + DiagClient->BeginSourceFile(Ctx.getLangOpts(), &Unit->getPreprocessor()); - Rewriter rewriter(Ctx.getSourceManager(), Ctx.getLangOptions()); + Rewriter rewriter(Ctx.getSourceManager(), Ctx.getLangOpts()); TransformActions TA(*Diags, capturedDiags, Ctx, Unit->getPreprocessor()); MigrationPass pass(Ctx, OrigCI.getLangOpts()->getGC(), Unit->getSema(), TA, ARCMTMacroLocs); diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index 497377a39430..e63527447633 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -58,7 +58,7 @@ protected: virtual void Initialize(ASTContext &Context) { NSAPIObj.reset(new NSAPI(Context)); Editor.reset(new edit::EditedSource(Context.getSourceManager(), - Context.getLangOptions(), + Context.getLangOpts(), PPRec)); } @@ -180,7 +180,7 @@ public: } void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) { - Rewriter rewriter(Ctx.getSourceManager(), Ctx.getLangOptions()); + Rewriter rewriter(Ctx.getSourceManager(), Ctx.getLangOpts()); RewritesReceiver Rec(rewriter); Editor->applyRewrites(Rec); diff --git a/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp b/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp index 845da159a13a..3be8132e3b7e 100644 --- a/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp +++ b/clang/lib/ARCMigrate/TransBlockObjCVariable.cpp @@ -54,7 +54,7 @@ class RootBlockObjCVarRewriter : if (castE->getCastKind() == CK_LValueToRValue) return true; // Using the value of the variable. if (castE->getCastKind() == CK_NoOp && castE->isLValue() && - Var->getASTContext().getLangOptions().CPlusPlus) + Var->getASTContext().getLangOpts().CPlusPlus) return true; // Binding to const C++ reference. } } diff --git a/clang/lib/ARCMigrate/TransGCAttrs.cpp b/clang/lib/ARCMigrate/TransGCAttrs.cpp index b0dadc2e2e77..9f6066ef77da 100644 --- a/clang/lib/ARCMigrate/TransGCAttrs.cpp +++ b/clang/lib/ARCMigrate/TransGCAttrs.cpp @@ -97,7 +97,7 @@ public: bool Invalid = false; StringRef Spell = Lexer::getSpelling( SM.getSpellingLoc(TL.getAttrEnumOperandLoc()), - Buf, SM, Ctx.getLangOptions(), &Invalid); + Buf, SM, Ctx.getLangOpts(), &Invalid); if (Invalid) return false; MigrationContext::GCAttrOccurrence::AttrKind Kind; diff --git a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp index 15669ac973c8..11a655334144 100644 --- a/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ b/clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -173,7 +173,7 @@ private: return; SourceManager &SM = Pass.Ctx.getSourceManager(); StringRef MacroName = Lexer::getImmediateMacroName(Loc, SM, - Pass.Ctx.getLangOptions()); + Pass.Ctx.getLangOpts()); bool isGCDOrXPC = llvm::StringSwitch(MacroName) .Case("dispatch_retain", true) .Case("dispatch_release", true) diff --git a/clang/lib/ARCMigrate/Transforms.cpp b/clang/lib/ARCMigrate/Transforms.cpp index 45a8c989efd3..c0adf16a11a9 100644 --- a/clang/lib/ARCMigrate/Transforms.cpp +++ b/clang/lib/ARCMigrate/Transforms.cpp @@ -67,7 +67,7 @@ static bool isClassInWeakBlacklist(ObjCInterfaceDecl *cls) { bool trans::canApplyWeak(ASTContext &Ctx, QualType type, bool AllowOnUnknownClass) { - if (!Ctx.getLangOptions().ObjCRuntimeHasWeak) + if (!Ctx.getLangOpts().ObjCRuntimeHasWeak) return false; QualType T = type; @@ -111,10 +111,10 @@ SourceLocation trans::findSemiAfterLocation(SourceLocation loc, ASTContext &Ctx) { SourceManager &SM = Ctx.getSourceManager(); if (loc.isMacroID()) { - if (!Lexer::isAtEndOfMacroExpansion(loc, SM, Ctx.getLangOptions(), &loc)) + if (!Lexer::isAtEndOfMacroExpansion(loc, SM, Ctx.getLangOpts(), &loc)) return SourceLocation(); } - loc = Lexer::getLocForEndOfToken(loc, /*Offset=*/0, SM, Ctx.getLangOptions()); + loc = Lexer::getLocForEndOfToken(loc, /*Offset=*/0, SM, Ctx.getLangOpts()); // Break down the source location. std::pair locInfo = SM.getDecomposedLoc(loc); @@ -129,7 +129,7 @@ SourceLocation trans::findSemiAfterLocation(SourceLocation loc, // Lex from the start of the given location. Lexer lexer(SM.getLocForStartOfFile(locInfo.first), - Ctx.getLangOptions(), + Ctx.getLangOpts(), file.begin(), tokenBegin, file.end()); Token tok; lexer.LexFromRawLexer(tok); @@ -375,7 +375,7 @@ bool MigrationContext::rewritePropertyAttribute(StringRef fromAttr, // Lex from the start of the given location. Lexer lexer(SM.getLocForStartOfFile(locInfo.first), - Pass.Ctx.getLangOptions(), + Pass.Ctx.getLangOpts(), file.begin(), tokenBegin, file.end()); Token tok; lexer.LexFromRawLexer(tok); @@ -458,7 +458,7 @@ bool MigrationContext::addPropertyAttribute(StringRef attr, // Lex from the start of the given location. Lexer lexer(SM.getLocForStartOfFile(locInfo.first), - Pass.Ctx.getLangOptions(), + Pass.Ctx.getLangOpts(), file.begin(), tokenBegin, file.end()); Token tok; lexer.LexFromRawLexer(tok); @@ -520,7 +520,7 @@ static void GCRewriteFinalize(MigrationPass &pass) { "#if !__has_feature(objc_arc)\n"); CharSourceRange::getTokenRange(FinalizeM->getSourceRange()); const SourceManager &SM = pass.Ctx.getSourceManager(); - const LangOptions &LangOpts = pass.Ctx.getLangOptions(); + const LangOptions &LangOpts = pass.Ctx.getLangOpts(); bool Invalid; std::string str = "\n#endif\n"; str += Lexer::getSourceText( diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index ba3f503e3b0c..b7e7850329f0 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -328,14 +328,14 @@ void ASTContext::PrintStats() const { llvm::errs() << NumImplicitCopyConstructorsDeclared << "/" << NumImplicitCopyConstructors << " implicit copy constructors created\n"; - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) llvm::errs() << NumImplicitMoveConstructorsDeclared << "/" << NumImplicitMoveConstructors << " implicit move constructors created\n"; llvm::errs() << NumImplicitCopyAssignmentOperatorsDeclared << "/" << NumImplicitCopyAssignmentOperators << " implicit copy assignment operators created\n"; - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) llvm::errs() << NumImplicitMoveAssignmentOperatorsDeclared << "/" << NumImplicitMoveAssignmentOperators << " implicit move assignment operators created\n"; @@ -3190,7 +3190,7 @@ bool ASTContext::UnwrapSimilarPointerTypes(QualType &T1, QualType &T2) { return true; } - if (getLangOptions().ObjC1) { + if (getLangOpts().ObjC1) { const ObjCObjectPointerType *T1OPType = T1->getAs(), *T2OPType = T2->getAs(); if (T1OPType && T2OPType) { @@ -3769,7 +3769,7 @@ static RecordDecl * CreateRecordDecl(const ASTContext &Ctx, RecordDecl::TagKind TK, DeclContext *DC, IdentifierInfo *Id) { SourceLocation Loc; - if (Ctx.getLangOptions().CPlusPlus) + if (Ctx.getLangOpts().CPlusPlus) return CXXRecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id); else return RecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id); @@ -3904,7 +3904,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() const { bool ASTContext::BlockRequiresCopying(QualType Ty) const { if (Ty->isObjCRetainableType()) return true; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (const RecordType *RT = Ty->getAs()) { CXXRecordDecl *RD = cast(RT->getDecl()); return RD->hasConstCopyConstructor(); @@ -4380,7 +4380,7 @@ static void EncodeBitField(const ASTContext *Ctx, std::string& S, // information is not especially sensible, but we're stuck with it for // compatibility with GCC, although providing it breaks anything that // actually uses runtime introspection and wants to work on both runtimes... - if (!Ctx->getLangOptions().NeXTRuntime) { + if (!Ctx->getLangOpts().NeXTRuntime) { const RecordDecl *RD = FD->getParent(); const ASTRecordLayout &RL = Ctx->getASTRecordLayout(RD); S += llvm::utostr(RL.getFieldOffset(FD->getFieldIndex())); @@ -5118,10 +5118,10 @@ CanQualType ASTContext::getFromTargetType(unsigned Type) const { /// garbage collection attribute. /// Qualifiers::GC ASTContext::getObjCGCAttrKind(QualType Ty) const { - if (getLangOptions().getGC() == LangOptions::NonGC) + if (getLangOpts().getGC() == LangOptions::NonGC) return Qualifiers::GCNone; - assert(getLangOptions().ObjC1); + assert(getLangOpts().ObjC1); Qualifiers::GC GCAttrs = Ty.getObjCGCAttr(); // Default behaviour under objective-C's gc is for ObjC pointers @@ -5615,7 +5615,7 @@ bool ASTContext::canBindObjCObjectType(QualType To, QualType From) { /// same. See 6.7.[2,3,5] for additional rules. bool ASTContext::typesAreCompatible(QualType LHS, QualType RHS, bool CompareUnqualified) { - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return hasSameType(LHS, RHS); return !mergeTypes(LHS, RHS, false, CompareUnqualified).isNull(); @@ -6568,7 +6568,7 @@ GVALinkage ASTContext::GetGVALinkageForFunction(const FunctionDecl *FD) { if (!FD->isInlined()) return External; - if (!getLangOptions().CPlusPlus || FD->hasAttr()) { + if (!getLangOpts().CPlusPlus || FD->hasAttr()) { // GNU or C99 inline semantics. Determine whether this symbol should be // externally visible. if (FD->isInlineDefinitionExternallyVisible()) @@ -6600,7 +6600,7 @@ GVALinkage ASTContext::GetGVALinkageForVariable(const VarDecl *VD) { TSK = VD->getTemplateSpecializationKind(); Linkage L = VD->getLinkage(); - if (L == ExternalLinkage && getLangOptions().CPlusPlus && + if (L == ExternalLinkage && getLangOpts().CPlusPlus && VD->getType()->getLinkage() == UniqueExternalLinkage) L = UniqueExternalLinkage; diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index 0923b5fafbea..ca4fe268522f 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -294,7 +294,7 @@ void clang::FormatASTNodeDiagnosticArgument( if (DC->isTranslationUnit()) { // FIXME: Get these strings from some localized place - if (Context.getLangOptions().CPlusPlus) + if (Context.getLangOpts().CPlusPlus) S = "the global namespace"; else S = "the global scope"; diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index febfaabd7401..621658c7f0ac 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -1359,7 +1359,7 @@ QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) { // The context we're importing from has an unsigned 'char'. If we're // importing into a context with a signed 'char', translate to // 'unsigned char' instead. - if (Importer.getToContext().getLangOptions().CharIsSigned) + if (Importer.getToContext().getLangOpts().CharIsSigned) return Importer.getToContext().UnsignedCharTy; return Importer.getToContext().CharTy; @@ -1368,7 +1368,7 @@ QualType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) { // The context we're importing from has an unsigned 'char'. If we're // importing into a context with a signed 'char', translate to // 'unsigned char' instead. - if (!Importer.getToContext().getLangOptions().CharIsSigned) + if (!Importer.getToContext().getLangOpts().CharIsSigned) return Importer.getToContext().SignedCharTy; return Importer.getToContext().CharTy; @@ -2243,7 +2243,7 @@ Decl *ASTNodeImporter::VisitEnumDecl(EnumDecl *D) { if (!SearchName && D->getTypedefNameForAnonDecl()) { SearchName = Importer.Import(D->getTypedefNameForAnonDecl()->getDeclName()); IDNS = Decl::IDNS_Ordinary; - } else if (Importer.getToContext().getLangOptions().CPlusPlus) + } else if (Importer.getToContext().getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Ordinary; // We may already have an enum of the same name; try to find and match it. @@ -2328,7 +2328,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) { if (!SearchName && D->getTypedefNameForAnonDecl()) { SearchName = Importer.Import(D->getTypedefNameForAnonDecl()->getDeclName()); IDNS = Decl::IDNS_Ordinary; - } else if (Importer.getToContext().getLangOptions().CPlusPlus) + } else if (Importer.getToContext().getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Ordinary; // We may already have a record of the same name; try to find and match it. @@ -2485,7 +2485,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { // Sema::IsOverload out to the AST library. // Function overloading is okay in C++. - if (Importer.getToContext().getLangOptions().CPlusPlus) + if (Importer.getToContext().getLangOpts().CPlusPlus) continue; // Complain about inconsistent function types. diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 0e2793490d95..b430fae3b1da 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -222,7 +222,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) { // and neither explicitly declared extern nor previously // declared to have external linkage; or // (there is no equivalent in C99) - if (Context.getLangOptions().CPlusPlus && + if (Context.getLangOpts().CPlusPlus && Var->getType().isConstant(Context) && Var->getStorageClass() != SC_Extern && Var->getStorageClass() != SC_PrivateExtern) { @@ -279,7 +279,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) { // scope and no storage-class specifier, its linkage is // external. LinkageInfo LV; - LV.mergeVisibility(Context.getLangOptions().getVisibilityMode()); + LV.mergeVisibility(Context.getLangOpts().getVisibilityMode()); if (F.ConsiderVisibilityAttributes) { if (llvm::Optional Vis = D->getExplicitVisibility()) { @@ -330,7 +330,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) { // // Note that we don't want to make the variable non-external // because of this, but unique-external linkage suits us. - if (Context.getLangOptions().CPlusPlus && + if (Context.getLangOpts().CPlusPlus && !Var->getDeclContext()->isExternCContext()) { LinkageInfo TypeLV = getLVForType(Var->getType()); if (TypeLV.linkage() != ExternalLinkage) @@ -342,7 +342,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) { if (Var->getStorageClass() == SC_PrivateExtern) LV.setVisibility(HiddenVisibility, true); - if (!Context.getLangOptions().CPlusPlus && + if (!Context.getLangOpts().CPlusPlus && (Var->getStorageClass() == SC_Extern || Var->getStorageClass() == SC_PrivateExtern)) { @@ -377,7 +377,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) { // storage-class specifier, its linkage is determined exactly // as if it were declared with the storage-class specifier // extern. - if (!Context.getLangOptions().CPlusPlus && + if (!Context.getLangOpts().CPlusPlus && (Function->getStorageClass() == SC_Extern || Function->getStorageClass() == SC_PrivateExtern || Function->getStorageClass() == SC_None)) { @@ -401,7 +401,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) { // unique-external linkage, it's not legally usable from outside // this translation unit. However, we should use the C linkage // rules instead for extern "C" declarations. - if (Context.getLangOptions().CPlusPlus && + if (Context.getLangOpts().CPlusPlus && !Function->getDeclContext()->isExternCContext() && Function->getType()->getLinkage() == UniqueExternalLinkage) return LinkageInfo::uniqueExternal(); @@ -447,7 +447,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) { // Consider -fvisibility unless the type has C linkage. if (F.ConsiderGlobalVisibility) F.ConsiderGlobalVisibility = - (Context.getLangOptions().CPlusPlus && + (Context.getLangOpts().CPlusPlus && !Tag->getDeclContext()->isExternCContext()); // - an enumerator belonging to an enumeration with external linkage; @@ -499,7 +499,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, LVFlags F) { return LinkageInfo::none(); LinkageInfo LV; - LV.mergeVisibility(D->getASTContext().getLangOptions().getVisibilityMode()); + LV.mergeVisibility(D->getASTContext().getLangOpts().getVisibilityMode()); // The flags we're going to use to compute the class's visibility. LVFlags ClassF = F; @@ -563,7 +563,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, LVFlags F) { if (TSK != TSK_ExplicitInstantiationDeclaration && TSK != TSK_ExplicitInstantiationDefinition && F.ConsiderGlobalVisibility && - MD->getASTContext().getLangOptions().InlineVisibilityHidden) { + MD->getASTContext().getLangOpts().InlineVisibilityHidden) { // InlineVisibilityHidden only applies to definitions, and // isInlined() only gives meaningful answers on definitions // anyway. @@ -845,7 +845,7 @@ static LinkageInfo getLVForDecl(const NamedDecl *D, LVFlags Flags) { } std::string NamedDecl::getQualifiedNameAsString() const { - return getQualifiedNameAsString(getASTContext().getLangOptions()); + return getQualifiedNameAsString(getASTContext().getLangOpts()); } std::string NamedDecl::getQualifiedNameAsString(const PrintingPolicy &P) const { @@ -1207,7 +1207,7 @@ bool VarDecl::isExternC() const { return false; ASTContext &Context = getASTContext(); - if (!Context.getLangOptions().CPlusPlus) + if (!Context.getLangOpts().CPlusPlus) return true; return DC->isExternCContext(); } @@ -1260,7 +1260,7 @@ VarDecl::DefinitionKind VarDecl::isThisDeclarationADefinition( // and without a storage class specifier or the scs 'static', constitutes // a tentative definition. // No such thing in C++. - if (!C.getLangOptions().CPlusPlus && isFileVarDecl()) + if (!C.getLangOpts().CPlusPlus && isFileVarDecl()) return TentativeDefinition; // What's left is (in C, block-scope) declarations without initializers or @@ -1373,7 +1373,7 @@ void VarDecl::setInit(Expr *I) { } bool VarDecl::isUsableInConstantExpressions(ASTContext &C) const { - const LangOptions &Lang = C.getLangOptions(); + const LangOptions &Lang = C.getLangOpts(); if (!Lang.CPlusPlus) return false; @@ -1452,7 +1452,7 @@ APValue *VarDecl::evaluateValue( // In C++11, we have determined whether the initializer was a constant // expression as a side-effect. - if (getASTContext().getLangOptions().CPlusPlus0x && !Eval->CheckedICE) { + if (getASTContext().getLangOpts().CPlusPlus0x && !Eval->CheckedICE) { Eval->CheckedICE = true; Eval->IsICE = Result && Notes.empty(); } @@ -1476,7 +1476,7 @@ bool VarDecl::checkInitIsICE() const { // In C++11, evaluate the initializer to check whether it's a constant // expression. - if (getASTContext().getLangOptions().CPlusPlus0x) { + if (getASTContext().getLangOpts().CPlusPlus0x) { llvm::SmallVector Notes; evaluateValue(Notes); return Eval->IsICE; @@ -1693,7 +1693,7 @@ bool FunctionDecl::isMain() const { const TranslationUnitDecl *tunit = dyn_cast(getDeclContext()->getRedeclContext()); return tunit && - !tunit->getASTContext().getLangOptions().Freestanding && + !tunit->getASTContext().getLangOpts().Freestanding && getIdentifier() && getIdentifier()->isStr("main"); } @@ -1732,7 +1732,7 @@ bool FunctionDecl::isExternC() const { return false; ASTContext &Context = getASTContext(); - if (!Context.getLangOptions().CPlusPlus) + if (!Context.getLangOpts().CPlusPlus) return true; return isMain() || DC->isExternCContext(); @@ -1820,7 +1820,7 @@ unsigned FunctionDecl::getBuiltinID() const { // If this function is at translation-unit scope and we're not in // C++, it refers to the C library function. - if (!Context.getLangOptions().CPlusPlus && + if (!Context.getLangOpts().CPlusPlus && getDeclContext()->isTranslationUnit()) return BuiltinID; @@ -1875,7 +1875,7 @@ void FunctionDecl::setDeclsInPrototypeScope(llvm::ArrayRef NewDecls /// function parameters, if some of the parameters have default /// arguments (in C++) or the last parameter is a parameter pack. unsigned FunctionDecl::getMinRequiredArguments() const { - if (!getASTContext().getLangOptions().CPlusPlus) + if (!getASTContext().getLangOpts().CPlusPlus) return getNumParams(); unsigned NumRequiredArgs = getNumParams(); @@ -1965,7 +1965,7 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const { ASTContext &Context = getASTContext(); - if (Context.getLangOptions().GNUInline || hasAttr()) { + if (Context.getLangOpts().GNUInline || hasAttr()) { // With GNU inlining, a declaration with 'inline' but not 'extern', forces // an externally visible definition. // @@ -1993,7 +1993,7 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const { return FoundBody; } - if (Context.getLangOptions().CPlusPlus) + if (Context.getLangOpts().CPlusPlus) return false; // C99 6.7.4p6: @@ -2034,7 +2034,7 @@ bool FunctionDecl::isInlineDefinitionExternallyVisible() const { assert(isInlined() && "Function must be inline"); ASTContext &Context = getASTContext(); - if (Context.getLangOptions().GNUInline || hasAttr()) { + if (Context.getLangOpts().GNUInline || hasAttr()) { // Note: If you change the logic here, please change // doesDeclarationForceExternallyVisibleDefinition as well. // diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 2e192657daab..baba97d81515 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -423,7 +423,7 @@ bool Decl::canBeWeakImported(bool &IsDefinition) const { } } else if (isa(this) || isa(this)) return false; - else if (!(getASTContext().getLangOptions().ObjCNonFragileABI && + else if (!(getASTContext().getLangOpts().ObjCNonFragileABI && isa(this))) return false; diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 33d313084853..114322b1a8a6 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -636,7 +636,7 @@ NotASpecialMember:; // C++0x [dcl.init.aggr]p1: // An aggregate is an array or a class with no user-provided // constructors [...]. - if (!getASTContext().getLangOptions().CPlusPlus0x || UserProvided) + if (!getASTContext().getLangOpts().CPlusPlus0x || UserProvided) data().Aggregate = false; // C++ [class]p4: @@ -798,7 +798,7 @@ NotASpecialMember:; ASTContext &Context = getASTContext(); QualType T = Context.getBaseElementType(Field->getType()); if (T->isObjCRetainableType() || T.isObjCGCStrong()) { - if (!Context.getLangOptions().ObjCAutoRefCount || + if (!Context.getLangOpts().ObjCAutoRefCount || T.getObjCLifetime() != Qualifiers::OCL_ExplicitNone) setHasObjectMember(true); } else if (!T.isPODType(Context)) @@ -1243,7 +1243,7 @@ void CXXRecordDecl::completeDefinition() { void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) { RecordDecl::completeDefinition(); - if (hasObjectMember() && getASTContext().getLangOptions().ObjCAutoRefCount) { + if (hasObjectMember() && getASTContext().getLangOpts().ObjCAutoRefCount) { // Objective-C Automatic Reference Counting: // If a class has a non-static data member of Objective-C pointer // type (or array thereof), it is a non-POD type and its diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 7822eb217fea..3d1fc8466008 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -628,7 +628,7 @@ void ObjCMethodDecl::createImplicitParams(ASTContext &Context, bool selfIsPseudoStrong = false; bool selfIsConsumed = false; - if (Context.getLangOptions().ObjCAutoRefCount) { + if (Context.getLangOpts().ObjCAutoRefCount) { if (isInstanceMethod()) { selfIsConsumed = hasAttr(); diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 6722e2f21c78..e2fc120b8ab1 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -193,7 +193,7 @@ static void computeDeclRefDependence(ASTContext &Ctx, NamedDecl *D, QualType T, // - an entity with reference type and is initialized with an // expression that is value-dependent [C++11] if (VarDecl *Var = dyn_cast(D)) { - if ((Ctx.getLangOptions().CPlusPlus0x ? + if ((Ctx.getLangOpts().CPlusPlus0x ? Var->getType()->isLiteralType() : Var->getType()->isIntegralOrEnumerationType()) && (Var->getType().getCVRQualifiers() == Qualifiers::Const || @@ -398,7 +398,7 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) { Out << "static "; } - PrintingPolicy Policy(Context.getLangOptions()); + PrintingPolicy Policy(Context.getLangOpts()); std::string Proto = FD->getQualifiedNameAsString(Policy); @@ -1750,7 +1750,7 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, case ObjCMessageExprClass: { const ObjCMessageExpr *ME = cast(this); - if (Ctx.getLangOptions().ObjCAutoRefCount && + if (Ctx.getLangOpts().ObjCAutoRefCount && ME->isInstanceMessage() && !ME->getType()->isVoidType() && ME->getSelector().getIdentifierInfoForSlot(0) && @@ -2780,7 +2780,7 @@ Expr::isNullPointerConstant(ASTContext &Ctx, // Strip off a cast to void*, if it exists. Except in C++. if (const ExplicitCastExpr *CE = dyn_cast(this)) { - if (!Ctx.getLangOptions().CPlusPlus) { + if (!Ctx.getLangOpts().CPlusPlus) { // Check that it is a cast to void*. if (const PointerType *PT = CE->getType()->getAs()) { QualType Pointee = PT->getPointeeType(); @@ -2828,14 +2828,14 @@ Expr::isNullPointerConstant(ASTContext &Ctx, } // This expression must be an integer type. if (!getType()->isIntegerType() || - (Ctx.getLangOptions().CPlusPlus && getType()->isEnumeralType())) + (Ctx.getLangOpts().CPlusPlus && getType()->isEnumeralType())) return NPCK_NotNull; // If we have an integer constant expression, we need to *evaluate* it and // test for the value 0. Don't use the C++11 constant expression semantics // for this, for now; once the dust settles on core issue 903, we might only // allow a literal 0 here in C++11 mode. - if (Ctx.getLangOptions().CPlusPlus0x) { + if (Ctx.getLangOpts().CPlusPlus0x) { if (!isCXX98IntegralConstantExpr(Ctx)) return NPCK_NotNull; } else { diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp index 7c402c98e41a..3261eb6974da 100644 --- a/clang/lib/AST/ExprClassification.cpp +++ b/clang/lib/AST/ExprClassification.cpp @@ -55,7 +55,7 @@ Cl Expr::ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const { Cl::Kinds kind = ClassifyInternal(Ctx, this); // C99 6.3.2.1: An lvalue is an expression with an object type or an // incomplete type other than void. - if (!Ctx.getLangOptions().CPlusPlus) { + if (!Ctx.getLangOpts().CPlusPlus) { // Thus, no functions. if (TR->isFunctionType() || TR == Ctx.OverloadTy) kind = Cl::CL_Function; @@ -89,7 +89,7 @@ Cl Expr::ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const { static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { // This function takes the first stab at classifying expressions. - const LangOptions &Lang = Ctx.getLangOptions(); + const LangOptions &Lang = Ctx.getLangOpts(); switch (E->getStmtClass()) { case Stmt::NoStmtClass: @@ -126,7 +126,7 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { // C99 6.5.2.5p5 says that compound literals are lvalues. // In C++, they're class temporaries. case Expr::CompoundLiteralExprClass: - return Ctx.getLangOptions().CPlusPlus? Cl::CL_ClassTemporary + return Ctx.getLangOpts().CPlusPlus? Cl::CL_ClassTemporary : Cl::CL_LValue; // Expressions that are prvalues. @@ -396,7 +396,7 @@ static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D) { else islvalue = isa(D) || isa(D) || isa(D) || - (Ctx.getLangOptions().CPlusPlus && + (Ctx.getLangOpts().CPlusPlus && (isa(D) || isa(D))); return islvalue ? Cl::CL_LValue : Cl::CL_PRValue; @@ -407,7 +407,7 @@ static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D) { /// calls and casts. static Cl::Kinds ClassifyUnnamed(ASTContext &Ctx, QualType T) { // In C, function calls are always rvalues. - if (!Ctx.getLangOptions().CPlusPlus) return Cl::CL_PRValue; + if (!Ctx.getLangOpts().CPlusPlus) return Cl::CL_PRValue; // C++ [expr.call]p10: A function call is an lvalue if the result type is an // lvalue reference type or an rvalue reference to function type, an xvalue @@ -428,7 +428,7 @@ static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E) { ? Cl::CL_PRValue : Cl::CL_LValue); // Handle C first, it's easier. - if (!Ctx.getLangOptions().CPlusPlus) { + if (!Ctx.getLangOpts().CPlusPlus) { // C99 6.5.2.3p3 // For dot access, the expression is an lvalue if the first part is. For // arrow access, it always is an lvalue. @@ -480,7 +480,7 @@ static Cl::Kinds ClassifyMemberExpr(ASTContext &Ctx, const MemberExpr *E) { } static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E) { - assert(Ctx.getLangOptions().CPlusPlus && + assert(Ctx.getLangOpts().CPlusPlus && "This is only relevant for C++."); // C++ [expr.ass]p1: All [...] return an lvalue referring to the left operand. // Except we override this for writes to ObjC properties. @@ -516,7 +516,7 @@ static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E) { static Cl::Kinds ClassifyConditional(ASTContext &Ctx, const Expr *True, const Expr *False) { - assert(Ctx.getLangOptions().CPlusPlus && + assert(Ctx.getLangOpts().CPlusPlus && "This is only relevant for C++."); // C++ [expr.cond]p2 @@ -555,7 +555,7 @@ static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, // This is the lvalue case. // Functions are lvalues in C++, but not modifiable. (C++ [basic.lval]p6) - if (Ctx.getLangOptions().CPlusPlus && E->getType()->isFunctionType()) + if (Ctx.getLangOpts().CPlusPlus && E->getType()->isFunctionType()) return Cl::CM_Function; // You cannot assign to a variable outside a block from within the block if @@ -591,7 +591,7 @@ static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, // Records with any const fields (recursively) are not modifiable. if (const RecordType *R = CT->getAs()) { assert((E->getObjectKind() == OK_ObjCProperty || - !Ctx.getLangOptions().CPlusPlus) && + !Ctx.getLangOpts().CPlusPlus) && "C++ struct assignment should be resolved by the " "copy assignment operator."); if (R->hasConstFields()) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 2d921467f773..4531a4644802 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -412,7 +412,7 @@ namespace { EvaluatingDeclValue = &Value; } - const LangOptions &getLangOpts() const { return Ctx.getLangOptions(); } + const LangOptions &getLangOpts() const { return Ctx.getLangOpts(); } bool CheckCallLimit(SourceLocation Loc) { // Don't perform any constexpr calls (other than the call we're checking) @@ -6057,7 +6057,7 @@ bool Expr::EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx) const { // FIXME: Evaluating values of large array and record types can cause // performance problems. Only do so in C++11 for now. if (isRValue() && (getType()->isArrayType() || getType()->isRecordType()) && - !Ctx.getLangOptions().CPlusPlus0x) + !Ctx.getLangOpts().CPlusPlus0x) return false; EvalInfo Info(Ctx, Result); @@ -6104,7 +6104,7 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx, // FIXME: Evaluating initializers for large array and record types can cause // performance problems. Only do so in C++11 for now. if (isRValue() && (getType()->isArrayType() || getType()->isRecordType()) && - !Ctx.getLangOptions().CPlusPlus0x) + !Ctx.getLangOpts().CPlusPlus0x) return false; Expr::EvalStatus EStatus; @@ -6120,7 +6120,7 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx, // Variables with static storage duration or thread storage duration shall be // zero-initialized before any other initialization takes place. // This behavior is not present in C. - if (Ctx.getLangOptions().CPlusPlus && !VD->hasLocalStorage() && + if (Ctx.getLangOpts().CPlusPlus && !VD->hasLocalStorage() && !VD->getType()->isReferenceType()) { ImplicitValueInitExpr VIE(VD->getType()); if (!EvaluateInPlace(Value, InitInfo, LVal, &VIE, CCEK_Constant, @@ -6325,7 +6325,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) { if (isa(cast(E)->getDecl())) return NoDiag(); const ValueDecl *D = dyn_cast(cast(E)->getDecl()); - if (Ctx.getLangOptions().CPlusPlus && + if (Ctx.getLangOpts().CPlusPlus && D && IsConstNonVolatile(D->getType())) { // Parameter variables are never constants. Without this check, // getAnyInitializer() can find a default argument, which leads @@ -6448,7 +6448,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) { } } if (Exp->getOpcode() == BO_Comma) { - if (Ctx.getLangOptions().C99) { + if (Ctx.getLangOpts().C99) { // C99 6.6p3 introduces a strange edge case: comma can be in an ICE // if it isn't evaluated. if (LHSResult.Val == 0 && RHSResult.Val == 0) @@ -6593,7 +6593,7 @@ static bool EvaluateCPlusPlus11IntegralConstantExpr(ASTContext &Ctx, } bool Expr::isIntegerConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const { - if (Ctx.getLangOptions().CPlusPlus0x) + if (Ctx.getLangOpts().CPlusPlus0x) return EvaluateCPlusPlus11IntegralConstantExpr(Ctx, this, 0, Loc); ICEDiag d = CheckICE(this, Ctx); @@ -6606,7 +6606,7 @@ bool Expr::isIntegerConstantExpr(ASTContext &Ctx, SourceLocation *Loc) const { bool Expr::isIntegerConstantExpr(llvm::APSInt &Value, ASTContext &Ctx, SourceLocation *Loc, bool isEvaluated) const { - if (Ctx.getLangOptions().CPlusPlus0x) + if (Ctx.getLangOpts().CPlusPlus0x) return EvaluateCPlusPlus11IntegralConstantExpr(Ctx, this, &Value, Loc); if (!isIntegerConstantExpr(Ctx, Loc)) @@ -6624,7 +6624,7 @@ bool Expr::isCXX11ConstantExpr(ASTContext &Ctx, APValue *Result, SourceLocation *Loc) const { // We support this checking in C++98 mode in order to diagnose compatibility // issues. - assert(Ctx.getLangOptions().CPlusPlus); + assert(Ctx.getLangOpts().CPlusPlus); // Build evaluation settings. Expr::EvalStatus Status; diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index fa7822777891..a4676a6c3961 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -375,7 +375,7 @@ static bool isInCLinkageSpecification(const Decl *D) { bool ItaniumMangleContext::shouldMangleDeclName(const NamedDecl *D) { // In C, functions with no attributes never need to be mangled. Fastpath them. - if (!getASTContext().getLangOptions().CPlusPlus && !D->hasAttrs()) + if (!getASTContext().getLangOpts().CPlusPlus && !D->hasAttrs()) return false; // Any decl can be declared with __asm("foo") on it, and this takes precedence @@ -392,7 +392,7 @@ bool ItaniumMangleContext::shouldMangleDeclName(const NamedDecl *D) { return true; // Otherwise, no mangling is done outside C++ mode. - if (!getASTContext().getLangOptions().CPlusPlus) + if (!getASTContext().getLangOpts().CPlusPlus) return false; // Variables at global scope with non-internal linkage are not mangled diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 42e6c9322db8..ba9856a8432f 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -119,7 +119,7 @@ static bool isInCLinkageSpecification(const Decl *D) { bool MicrosoftMangleContext::shouldMangleDeclName(const NamedDecl *D) { // In C, functions with no attributes never need to be mangled. Fastpath them. - if (!getASTContext().getLangOptions().CPlusPlus && !D->hasAttrs()) + if (!getASTContext().getLangOpts().CPlusPlus && !D->hasAttrs()) return false; // Any decl can be declared with __asm("foo") on it, and this takes precedence @@ -136,7 +136,7 @@ bool MicrosoftMangleContext::shouldMangleDeclName(const NamedDecl *D) { return true; // Otherwise, no mangling is done outside C++ mode. - if (!getASTContext().getLangOptions().CPlusPlus) + if (!getASTContext().getLangOpts().CPlusPlus) return false; // Variables at global scope with internal linkage are not mangled. diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 7c4f7f2622e5..f73287503efc 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -1396,7 +1396,7 @@ void RecordLayoutBuilder::InitializeLayout(const Decl *D) { IsMsStruct = D->hasAttr(); // Honor the default struct packing maximum alignment flag. - if (unsigned DefaultMaxFieldAlignment = Context.getLangOptions().PackStruct) { + if (unsigned DefaultMaxFieldAlignment = Context.getLangOpts().PackStruct) { MaxFieldAlignment = CharUnits::fromQuantity(DefaultMaxFieldAlignment); } @@ -1658,7 +1658,7 @@ void RecordLayoutBuilder::LayoutWideBitField(uint64_t FieldSize, uint64_t TypeSize, bool FieldPacked, const FieldDecl *D) { - assert(Context.getLangOptions().CPlusPlus && + assert(Context.getLangOpts().CPlusPlus && "Can only have wide bit-fields in C++!"); // Itanium C++ ABI 2.4: @@ -1900,7 +1900,7 @@ void RecordLayoutBuilder::LayoutField(const FieldDecl *D) { ZeroLengthBitfield = 0; } - if (Context.getLangOptions().MSBitfields || IsMsStruct) { + if (Context.getLangOpts().MSBitfields || IsMsStruct) { // If MS bitfield layout is required, figure out what type is being // laid out and align the field to the width of that type. @@ -1987,7 +1987,7 @@ void RecordLayoutBuilder::FinishLayout(const NamedDecl *D) { } // In C++, records cannot be of size 0. - if (Context.getLangOptions().CPlusPlus && getSizeInBits() == 0) { + if (Context.getLangOpts().CPlusPlus && getSizeInBits() == 0) { if (const CXXRecordDecl *RD = dyn_cast(D)) { // Compatibility with gcc requires a class (pod or non-pod) // which is not empty but of size 0; such as having fields of @@ -2263,9 +2263,9 @@ ASTContext::getASTRecordLayout(const RecordDecl *D) const { ASTRecordLayouts[D] = NewEntry; - if (getLangOptions().DumpRecordLayouts) { + if (getLangOpts().DumpRecordLayouts) { llvm::errs() << "\n*** Dumping AST Record Layout\n"; - DumpRecordLayout(D, llvm::errs(), getLangOptions().DumpRecordLayoutsSimple); + DumpRecordLayout(D, llvm::errs(), getLangOpts().DumpRecordLayoutsSimple); } return *NewEntry; diff --git a/clang/lib/AST/StmtDumper.cpp b/clang/lib/AST/StmtDumper.cpp index acacf943fdb4..aea4c395d5cd 100644 --- a/clang/lib/AST/StmtDumper.cpp +++ b/clang/lib/AST/StmtDumper.cpp @@ -254,7 +254,7 @@ void StmtDumper::DumpDeclarator(Decl *D) { std::string Name = VD->getNameAsString(); VD->getType().getAsStringInternal(Name, - PrintingPolicy(VD->getASTContext().getLangOptions())); + PrintingPolicy(VD->getASTContext().getLangOpts())); OS << Name; // If this is a vardecl with an initializer, emit it. @@ -287,7 +287,7 @@ void StmtDumper::DumpDeclarator(Decl *D) { const char *tn = UD->isTypeName() ? "typename " : ""; OS << '"' << UD->getDeclKindName() << tn; UD->getQualifier()->print(OS, - PrintingPolicy(UD->getASTContext().getLangOptions())); + PrintingPolicy(UD->getASTContext().getLangOpts())); OS << ";\""; } else if (LabelDecl *LD = dyn_cast(D)) { OS << "label " << *LD; diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 1fe4a792dab0..7ebc1299f07a 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -1833,7 +1833,7 @@ void StmtPrinter::VisitAsTypeExpr(AsTypeExpr *Node) { void Stmt::dumpPretty(ASTContext& Context) const { printPretty(llvm::errs(), Context, 0, - PrintingPolicy(Context.getLangOptions())); + PrintingPolicy(Context.getLangOpts())); } void Stmt::printPretty(raw_ostream &OS, ASTContext& Context, diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index d9fecd449f3b..c61f34f254d1 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -580,7 +580,7 @@ bool Type::isIntegralType(ASTContext &Ctx) const { return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::Int128; - if (!Ctx.getLangOptions().CPlusPlus) + if (!Ctx.getLangOpts().CPlusPlus) if (const EnumType *ET = dyn_cast(CanonicalType)) return ET->getDecl()->isComplete(); // Complete enum types are integral in C. @@ -907,7 +907,7 @@ bool QualType::isPODType(ASTContext &Context) const { if ((*this)->isIncompleteType()) return false; - if (Context.getLangOptions().ObjCAutoRefCount) { + if (Context.getLangOpts().ObjCAutoRefCount) { switch (getObjCLifetime()) { case Qualifiers::OCL_ExplicitNone: return true; @@ -969,7 +969,7 @@ bool QualType::isTrivialType(ASTContext &Context) const { if ((*this)->isIncompleteType()) return false; - if (Context.getLangOptions().ObjCAutoRefCount) { + if (Context.getLangOpts().ObjCAutoRefCount) { switch (getObjCLifetime()) { case Qualifiers::OCL_ExplicitNone: return true; @@ -1019,7 +1019,7 @@ bool QualType::isTriviallyCopyableType(ASTContext &Context) const { if ((*this)->isArrayType()) return Context.getBaseElementType(*this).isTrivialType(Context); - if (Context.getLangOptions().ObjCAutoRefCount) { + if (Context.getLangOpts().ObjCAutoRefCount) { switch (getObjCLifetime()) { case Qualifiers::OCL_ExplicitNone: return true; @@ -1164,7 +1164,7 @@ bool QualType::isCXX11PODType(ASTContext &Context) const { if (ty->isDependentType()) return false; - if (Context.getLangOptions().ObjCAutoRefCount) { + if (Context.getLangOpts().ObjCAutoRefCount) { switch (getObjCLifetime()) { case Qualifiers::OCL_ExplicitNone: return true; @@ -1467,7 +1467,7 @@ QualType QualType::getNonLValueExprType(ASTContext &Context) const { // have cv-unqualified types. // // See also C99 6.3.2.1p2. - if (!Context.getLangOptions().CPlusPlus || + if (!Context.getLangOpts().CPlusPlus || (!getTypePtr()->isDependentType() && !getTypePtr()->isRecordType())) return getUnqualifiedType(); @@ -2234,7 +2234,7 @@ bool QualType::hasTrivialAssignment(ASTContext &Context, bool Copying) const { case Qualifiers::OCL_Autoreleasing: case Qualifiers::OCL_Strong: case Qualifiers::OCL_Weak: - return !Context.getLangOptions().ObjCAutoRefCount; + return !Context.getLangOpts().ObjCAutoRefCount; } if (const CXXRecordDecl *Record diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp index 67924ebf8276..35f84ff4834c 100644 --- a/clang/lib/AST/VTableBuilder.cpp +++ b/clang/lib/AST/VTableBuilder.cpp @@ -996,7 +996,7 @@ public: LayoutVTable(); - if (Context.getLangOptions().DumpVTableLayouts) + if (Context.getLangOpts().DumpVTableLayouts) dumpLayout(llvm::errs()); } @@ -1580,7 +1580,7 @@ void VTableBuilder::LayoutVTable() { LayoutVTablesForVirtualBases(MostDerivedClass, VBases); // -fapple-kext adds an extra entry at end of vtbl. - bool IsAppleKext = Context.getLangOptions().AppleKext; + bool IsAppleKext = Context.getLangOpts().AppleKext; if (IsAppleKext) Components.push_back(VTableComponent::MakeVCallOffset(CharUnits::Zero())); } diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index 3291764b9adf..659cc6d3f1de 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -180,7 +180,7 @@ CFGReverseBlockReachabilityAnalysis *AnalysisDeclContext::getCFGReachablityAnaly } void AnalysisDeclContext::dumpCFG(bool ShowColors) { - getCFG()->dump(getASTContext().getLangOptions(), ShowColors); + getCFG()->dump(getASTContext().getLangOpts(), ShowColors); } ParentMap &AnalysisDeclContext::getParentMap() { diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index e19381dcd81d..0a844a03767e 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1239,7 +1239,7 @@ CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) { bool AddEHEdge = false; // Languages without exceptions are assumed to not throw. - if (Context->getLangOptions().Exceptions) { + if (Context->getLangOpts().Exceptions) { if (BuildOpts.AddEHEdges) AddEHEdge = true; } diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 8e280e6823e9..9fe31cb9581e 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -92,7 +92,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM, CGM.GetAddrOfConstantCString(typeAtEncoding), i8p)); // GC layout. - if (C.getLangOptions().ObjC1) + if (C.getLangOpts().ObjC1) elements.push_back(CGM.getObjCRuntime().BuildGCBlockLayout(CGM, blockInfo)); else elements.push_back(llvm::Constant::getNullValue(i8p)); @@ -227,7 +227,7 @@ static llvm::Constant *tryCaptureAsConstant(CodeGenModule &CGM, // Except that any class member declared mutable can be // modified, any attempt to modify a const object during its // lifetime results in undefined behavior. - if (CGM.getLangOptions().CPlusPlus && !isSafeForCXXConstantCapture(type)) + if (CGM.getLangOpts().CPlusPlus && !isSafeForCXXConstantCapture(type)) return 0; // If the variable doesn't have any initializer (shouldn't this be @@ -374,7 +374,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF, info.HasCXXObject = true; // And so do types with destructors. - } else if (CGM.getLangOptions().CPlusPlus) { + } else if (CGM.getLangOpts().CPlusPlus) { if (const CXXRecordDecl *record = variable->getType()->getAsCXXRecordDecl()) { if (!record->hasTrivialDestructor()) { @@ -1251,7 +1251,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) { flags = BLOCK_FIELD_IS_BLOCK; // Special rules for ARC captures: - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { Qualifiers qs = type.getQualifiers(); // Don't generate special copy logic for a captured object @@ -1363,7 +1363,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) { flags = BLOCK_FIELD_IS_BLOCK; // Special rules for ARC captures. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { Qualifiers qs = type.getQualifiers(); // Don't generate special dispose logic for a captured object @@ -1744,7 +1744,7 @@ CodeGenFunction::buildByrefHelpers(llvm::StructType &byrefType, // If we have lifetime, that dominates. if (Qualifiers::ObjCLifetime lifetime = qs.getObjCLifetime()) { - assert(getLangOptions().ObjCAutoRefCount); + assert(getLangOpts().ObjCAutoRefCount); switch (lifetime) { case Qualifiers::OCL_None: llvm_unreachable("impossible"); @@ -1979,7 +1979,7 @@ namespace { /// to be done externally. void CodeGenFunction::enterByrefCleanup(const AutoVarEmission &emission) { // We don't enter this cleanup if we're in pure-GC mode. - if (CGM.getLangOptions().getGC() == LangOptions::GCOnly) + if (CGM.getLangOpts().getGC() == LangOptions::GCOnly) return; EHStack.pushCleanup(NormalAndEHCleanup, emission.Address); @@ -1988,7 +1988,7 @@ void CodeGenFunction::enterByrefCleanup(const AutoVarEmission &emission) { /// Adjust the declaration of something from the blocks API. static void configureBlocksRuntimeObject(CodeGenModule &CGM, llvm::Constant *C) { - if (!CGM.getLangOptions().BlocksRuntimeOptional) return; + if (!CGM.getLangOpts().BlocksRuntimeOptional) return; llvm::GlobalValue *GV = cast(C->stripPointerCasts()); if (GV->isDeclaration() && diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 2c7a0495aed5..4fe4fa8a1447 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -254,7 +254,7 @@ CodeGenTypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, FunctionType::ExtInfo einfo; einfo = einfo.withCallingConv(getCallingConventionForDecl(MD)); - if (getContext().getLangOptions().ObjCAutoRefCount && + if (getContext().getLangOpts().ObjCAutoRefCount && MD->hasAttr()) einfo = einfo.withProducesResult(true); @@ -1467,7 +1467,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) { // In ARC, end functions that return a retainable type with a call // to objc_autoreleaseReturnValue. if (AutoreleaseResult) { - assert(getLangOptions().ObjCAutoRefCount && + assert(getLangOpts().ObjCAutoRefCount && !FI.isReturnsRetained() && RetTy->isObjCRetainableType()); RV = emitAutoreleaseOfResult(*this, RV); @@ -1662,7 +1662,7 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, QualType type) { if (const ObjCIndirectCopyRestoreExpr *CRE = dyn_cast(E)) { - assert(getContext().getLangOptions().ObjCAutoRefCount); + assert(getContext().getLangOpts().ObjCAutoRefCount); assert(getContext().hasSameType(E->getType(), type)); return emitWritebackArg(*this, args, CRE); } @@ -1717,7 +1717,7 @@ CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, // In ObjC ARC mode with no ObjC ARC exception safety, tell the ARC // optimizer it can aggressively ignore unwind edges. - if (CGM.getLangOptions().ObjCAutoRefCount) + if (CGM.getLangOpts().ObjCAutoRefCount) AddObjCARCExceptionMetadata(Inst); return Inst; @@ -2031,7 +2031,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, // In ObjC ARC mode with no ObjC ARC exception safety, tell the ARC // optimizer it can aggressively ignore unwind edges. - if (CGM.getLangOptions().ObjCAutoRefCount) + if (CGM.getLangOpts().ObjCAutoRefCount) AddObjCARCExceptionMetadata(CS.getInstruction()); // If the call doesn't return, finish the basic block and clear the diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 6b5a1497109b..ee79c394ac04 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -405,7 +405,7 @@ static void EmitBaseInitializer(CodeGenFunction &CGF, CGF.EmitAggExpr(BaseInit->getInit(), AggSlot); - if (CGF.CGM.getLangOptions().Exceptions && + if (CGF.CGM.getLangOpts().Exceptions && !BaseClassDecl->hasTrivialDestructor()) CGF.EHStack.pushCleanup(EHCleanup, BaseClassDecl, isBaseVirtual); @@ -642,7 +642,7 @@ void CodeGenFunction::EmitInitializerForField(FieldDecl *Field, EmitAggMemberInitializer(*this, LHS, Init, ArrayIndexVar, FieldType, ArrayIndexes, 0); - if (!CGM.getLangOptions().Exceptions) + if (!CGM.getLangOpts().Exceptions) return; // FIXME: If we have an array of classes w/ non-trivial destructors, @@ -935,7 +935,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) { } // -fapple-kext must inline any call to this dtor into // the caller's body. - if (getContext().getLangOptions().AppleKext) + if (getContext().getLangOpts().AppleKext) CurFn->addFnAttr(llvm::Attribute::AlwaysInline); break; } @@ -1172,7 +1172,7 @@ CodeGenFunction::EmitCXXAggrConstructorCall(const CXXConstructorDecl *ctor, // Evaluate the constructor and its arguments in a regular // partial-destroy cleanup. - if (getLangOptions().Exceptions && + if (getLangOpts().Exceptions && !ctor->getParent()->hasTrivialDestructor()) { Destroyer *destroyer = destroyCXXObject; pushRegularPartialArrayCleanup(arrayBegin, cur, type, *destroyer); @@ -1376,7 +1376,7 @@ CodeGenFunction::EmitDelegatingCXXConstructorCall(const CXXConstructorDecl *Ctor EmitAggExpr(Ctor->init_begin()[0]->getInit(), AggSlot); const CXXRecordDecl *ClassDecl = Ctor->getParent(); - if (CGM.getLangOptions().Exceptions && !ClassDecl->hasTrivialDestructor()) { + if (CGM.getLangOpts().Exceptions && !ClassDecl->hasTrivialDestructor()) { CXXDtorType Type = CurGD.getCtorType() == Ctor_Complete ? Dtor_Complete : Dtor_Base; @@ -1393,7 +1393,7 @@ void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *DD, llvm::Value *VTT = GetVTTParameter(*this, GlobalDecl(DD, Type), ForVirtualBase); llvm::Value *Callee = 0; - if (getContext().getLangOptions().AppleKext) + if (getContext().getLangOpts().AppleKext) Callee = BuildAppleKextVirtualDestructorCall(DD, Type, DD->getParent()); @@ -1711,7 +1711,7 @@ static bool UseVirtualCall(ASTContext &Context, // When building with -fapple-kext, all calls must go through the vtable since // the kernel linker can do runtime patching of vtables. - if (Context.getLangOptions().AppleKext) + if (Context.getLangOpts().AppleKext) return true; return !canDevirtualizeMemberFunctionCall(CE->getArg(0), MD); diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 96d3198d5e70..bd37197ae3c4 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -183,7 +183,7 @@ CGDebugInfo::getClassName(const RecordDecl *RD) { NumArgs = TemplateArgs.size(); } Buffer = RD->getIdentifier()->getNameStart(); - PrintingPolicy Policy(CGM.getLangOptions()); + PrintingPolicy Policy(CGM.getLangOpts()); Buffer += TemplateSpecializationType::PrintTemplateArgumentList(Args, NumArgs, Policy); @@ -288,7 +288,7 @@ void CGDebugInfo::CreateCompileUnit() { StringRef Filename(FilenamePtr, MainFileName.length()); unsigned LangTag; - const LangOptions &LO = CGM.getLangOptions(); + const LangOptions &LO = CGM.getLangOpts(); if (LO.CPlusPlus) { if (LO.ObjC1) LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus; @@ -332,7 +332,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { llvm_unreachable("Unexpected builtin type"); case BuiltinType::NullPtr: return DBuilder. - createNullPtrType(BT->getName(CGM.getContext().getLangOptions())); + createNullPtrType(BT->getName(CGM.getContext().getLangOpts())); case BuiltinType::Void: return llvm::DIType(); case BuiltinType::ObjCClass: @@ -403,7 +403,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { case BuiltinType::ULong: BTName = "long unsigned int"; break; case BuiltinType::ULongLong: BTName = "long long unsigned int"; break; default: - BTName = BT->getName(CGM.getContext().getLangOptions()); + BTName = BT->getName(CGM.getContext().getLangOpts()); break; } // Bit size, align and offset of the type. @@ -953,7 +953,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, MethodTy, /*isLocalToUnit=*/false, /* isDefinition=*/ false, Virtuality, VIndex, ContainingType, - Flags, CGM.getLangOptions().Optimize); + Flags, CGM.getLangOpts().Optimize); SPCache[Method->getCanonicalDecl()] = llvm::WeakVH(SP); @@ -1345,7 +1345,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, // the non-fragile abi and the debugger should ignore the value anyways. // Call it the FieldNo+1 due to how debuggers use the information, // e.g. negating the value when it needs a lookup in the dynamic table. - uint64_t FieldOffset = CGM.getLangOptions().ObjCNonFragileABI ? FieldNo+1 + uint64_t FieldOffset = CGM.getLangOpts().ObjCNonFragileABI ? FieldNo+1 : RL.getFieldOffset(FieldNo); unsigned Flags = 0; @@ -1996,7 +1996,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, DBuilder.createFunction(FDContext, Name, LinkageName, Unit, LineNo, getOrCreateFunctionType(D, FnType, Unit), Fn->hasInternalLinkage(), true/*definition*/, - Flags, CGM.getLangOptions().Optimize, Fn, + Flags, CGM.getLangOpts().Optimize, Fn, TParamsArray, SPDecl); // Push function on region stack. @@ -2227,7 +2227,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, llvm::DIVariable D = DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope), Name, Unit, Line, Ty, - CGM.getLangOptions().Optimize, Flags, ArgNo); + CGM.getLangOpts().Optimize, Flags, ArgNo); // Insert an llvm.dbg.declare into the current block. llvm::Instruction *Call = @@ -2256,7 +2256,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, llvm::DIVariable D = DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope), FieldName, Unit, Line, FieldTy, - CGM.getLangOptions().Optimize, Flags, + CGM.getLangOpts().Optimize, Flags, ArgNo); // Insert an llvm.dbg.declare into the current block. @@ -2484,7 +2484,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, DBuilder.createLocalVariable(llvm::dwarf::DW_TAG_arg_variable, llvm::DIDescriptor(scope), name, tunit, line, type, - CGM.getLangOptions().Optimize, flags, + CGM.getLangOpts().Optimize, flags, cast(addr)->getArgNo() + 1); // Insert an llvm.dbg.value into the current block. diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index a3437f7458a6..970f0b2389f2 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -121,7 +121,7 @@ void CodeGenFunction::EmitVarDecl(const VarDecl &D) { // uniqued. We can't do this in C, though, because there's no // standard way to agree on which variables are the same (i.e. // there's no mangling). - if (getContext().getLangOptions().CPlusPlus) + if (getContext().getLangOpts().CPlusPlus) if (llvm::GlobalValue::isWeakForLinker(CurFn->getLinkage())) Linkage = CurFn->getLinkage(); @@ -141,7 +141,7 @@ void CodeGenFunction::EmitVarDecl(const VarDecl &D) { static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D, const char *Separator) { CodeGenModule &CGM = CGF.CGM; - if (CGF.getContext().getLangOptions().CPlusPlus) { + if (CGF.getContext().getLangOpts().CPlusPlus) { StringRef Name = CGM.getMangledName(&D); return Name.str(); } @@ -216,7 +216,7 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const VarDecl &D, // If constant emission failed, then this should be a C++ static // initializer. if (!Init) { - if (!getContext().getLangOptions().CPlusPlus) + if (!getContext().getLangOpts().CPlusPlus) CGM.ErrorUnsupported(D.getInit(), "constant l-value expression"); else if (Builder.GetInsertBlock()) { // Since we have a static initializer, this global variable can't @@ -770,7 +770,7 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) { llvm::Value *DeclPtr; if (Ty->isConstantSizeType()) { if (!Target.useGlobalsForAutomaticVariables()) { - bool NRVO = getContext().getLangOptions().ElideConstructors && + bool NRVO = getContext().getLangOpts().ElideConstructors && D.isNRVOVariable(); // If this value is a POD array or struct with a statically @@ -1170,7 +1170,7 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) { emitAutoVarTypeCleanup(emission, dtorKind); // In GC mode, honor objc_precise_lifetime. - if (getLangOptions().getGC() != LangOptions::NonGC && + if (getLangOpts().getGC() != LangOptions::NonGC && D.hasAttr()) { EHStack.pushCleanup(NormalCleanup, &D); } diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index fac38a324277..e7765fd106ba 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -199,14 +199,14 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM, llvm::Function *Fn = llvm::Function::Create(FTy, llvm::GlobalValue::InternalLinkage, Name, &CGM.getModule()); - if (!CGM.getContext().getLangOptions().AppleKext) { + if (!CGM.getContext().getLangOpts().AppleKext) { // Set the section if needed. if (const char *Section = CGM.getContext().getTargetInfo().getStaticInitSectionSpecifier()) Fn->setSection(Section); } - if (!CGM.getLangOptions().Exceptions) + if (!CGM.getLangOpts().Exceptions) Fn->setDoesNotThrow(); return Fn; @@ -327,7 +327,7 @@ void CodeGenFunction::GenerateCXXGlobalInitFunc(llvm::Function *Fn, // When building in Objective-C++ ARC mode, create an autorelease pool // around the global initializers. - if (getLangOptions().ObjCAutoRefCount && getLangOptions().CPlusPlus) { + if (getLangOpts().ObjCAutoRefCount && getLangOpts().CPlusPlus) { llvm::Value *token = EmitObjCAutoreleasePoolPush(); EmitObjCAutoreleasePoolCleanup(token); } diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 668dbaf70eff..95e0030866d7 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -100,7 +100,7 @@ llvm::Constant *CodeGenFunction::getUnwindResumeFn() { llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, Int8PtrTy, /*IsVarArgs=*/false); - if (CGM.getLangOptions().SjLjExceptions) + if (CGM.getLangOpts().SjLjExceptions) return CGM.CreateRuntimeFunction(FTy, "_Unwind_SjLj_Resume"); return CGM.CreateRuntimeFunction(FTy, "_Unwind_Resume"); } @@ -109,7 +109,7 @@ llvm::Constant *CodeGenFunction::getUnwindResumeOrRethrowFn() { llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, Int8PtrTy, /*IsVarArgs=*/false); - if (CGM.getLangOptions().SjLjExceptions) + if (CGM.getLangOpts().SjLjExceptions) return CGM.CreateRuntimeFunction(FTy, "_Unwind_SjLj_Resume_or_Rethrow"); return CGM.CreateRuntimeFunction(FTy, "_Unwind_Resume_or_Rethrow"); } @@ -123,9 +123,9 @@ static llvm::Constant *getTerminateFn(CodeGenFunction &CGF) { StringRef name; // In C++, use std::terminate(). - if (CGF.getLangOptions().CPlusPlus) + if (CGF.getLangOpts().CPlusPlus) name = "_ZSt9terminatev"; // FIXME: mangling! - else if (CGF.getLangOptions().ObjC1 && + else if (CGF.getLangOpts().ObjC1 && CGF.CGM.getCodeGenOpts().ObjCRuntimeHasTerminate) name = "objc_terminate"; else @@ -300,11 +300,11 @@ void CodeGenModule::SimplifyPersonality() { return; // If we're not in ObjC++ -fexceptions, there's nothing to do. - if (!Features.CPlusPlus || !Features.ObjC1 || !Features.Exceptions) + if (!LangOpts.CPlusPlus || !LangOpts.ObjC1 || !LangOpts.Exceptions) return; - const EHPersonality &ObjCXX = EHPersonality::get(Features); - const EHPersonality &CXX = getCXXPersonality(Features); + const EHPersonality &ObjCXX = EHPersonality::get(LangOpts); + const EHPersonality &CXX = getCXXPersonality(LangOpts); if (&ObjCXX == &CXX) return; @@ -470,7 +470,7 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) { } void CodeGenFunction::EmitStartEHSpec(const Decl *D) { - if (!CGM.getLangOptions().CXXExceptions) + if (!CGM.getLangOpts().CXXExceptions) return; const FunctionDecl* FD = dyn_cast_or_null(D); @@ -538,7 +538,7 @@ static void emitFilterDispatchBlock(CodeGenFunction &CGF, } void CodeGenFunction::EmitEndEHSpec(const Decl *D) { - if (!CGM.getLangOptions().CXXExceptions) + if (!CGM.getLangOpts().CXXExceptions) return; const FunctionDecl* FD = dyn_cast_or_null(D); @@ -661,7 +661,7 @@ llvm::BasicBlock *CodeGenFunction::getInvokeDestImpl() { assert(EHStack.requiresLandingPad()); assert(!EHStack.empty()); - if (!CGM.getLangOptions().Exceptions) + if (!CGM.getLangOpts().Exceptions) return 0; // Check the innermost scope for a cached landing pad. If this is @@ -751,7 +751,7 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() { // Save the current IR generation state. CGBuilderTy::InsertPoint savedIP = Builder.saveAndClearIP(); - const EHPersonality &personality = EHPersonality::get(getLangOptions()); + const EHPersonality &personality = EHPersonality::get(getLangOpts()); // Create and configure the landing pad. llvm::BasicBlock *lpad = createBasicBlock("lpad"); @@ -1494,7 +1494,7 @@ llvm::BasicBlock *CodeGenFunction::getTerminateLandingPad() { Builder.SetInsertPoint(TerminateLandingPad); // Tell the backend that this is a landing pad. - const EHPersonality &Personality = EHPersonality::get(CGM.getLangOptions()); + const EHPersonality &Personality = EHPersonality::get(CGM.getLangOpts()); llvm::LandingPadInst *LPadInst = Builder.CreateLandingPad(llvm::StructType::get(Int8PtrTy, Int32Ty, NULL), getOpaquePersonalityFn(CGM, Personality), 0); @@ -1541,7 +1541,7 @@ llvm::BasicBlock *CodeGenFunction::getEHResumeBlock() { EHResumeBlock = createBasicBlock("eh.resume"); Builder.SetInsertPoint(EHResumeBlock); - const EHPersonality &Personality = EHPersonality::get(CGM.getLangOptions()); + const EHPersonality &Personality = EHPersonality::get(CGM.getLangOpts()); // This can always be a call because we necessarily didn't find // anything on the EH stack which needs our help. diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 80233b5d2818..7b820f5732dc 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -225,7 +225,7 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E, // Objective-C++ ARC: // If we are binding a reference to a temporary that has ownership, we // need to perform retain/release operations on the temporary. - if (CGF.getContext().getLangOptions().ObjCAutoRefCount && + if (CGF.getContext().getLangOpts().ObjCAutoRefCount && E->getType()->isObjCLifetimeType() && (E->getType().getObjCLifetime() == Qualifiers::OCL_Strong || E->getType().getObjCLifetime() == Qualifiers::OCL_Weak || @@ -1329,7 +1329,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, LValue &LV, bool IsMemberAccess=false) { - if (Ctx.getLangOptions().getGC() == LangOptions::NonGC) + if (Ctx.getLangOpts().getGC() == LangOptions::NonGC) return; if (isa(E)) { @@ -1565,8 +1565,8 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) { // of a pointer to object; as in void foo (__weak id *param); *param = 0; // But, we continue to generate __strong write barrier on indirect write // into a pointer to object. - if (getContext().getLangOptions().ObjC1 && - getContext().getLangOptions().getGC() != LangOptions::NonGC && + if (getContext().getLangOpts().ObjC1 && + getContext().getLangOpts().getGC() != LangOptions::NonGC && LV.isObjCWeak()) LV.setNonGC(!E->isOBJCGCCandidate(getContext())); return LV; @@ -1766,7 +1766,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this if overflow is not undefined behavior. - if (getLangOptions().isSignedOverflowDefined()) { + if (getLangOpts().isSignedOverflowDefined()) { Idx = Builder.CreateMul(Idx, numElements); Address = Builder.CreateGEP(Address, Idx, "arrayidx"); } else { @@ -1801,14 +1801,14 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { // Propagate the alignment from the array itself to the result. ArrayAlignment = ArrayLV.getAlignment(); - if (getContext().getLangOptions().isSignedOverflowDefined()) + if (getContext().getLangOpts().isSignedOverflowDefined()) Address = Builder.CreateGEP(ArrayPtr, Args, "arrayidx"); else Address = Builder.CreateInBoundsGEP(ArrayPtr, Args, "arrayidx"); } else { // The base must be a pointer, which is not an aggregate. Emit it. llvm::Value *Base = EmitScalarExpr(E->getBase()); - if (getContext().getLangOptions().isSignedOverflowDefined()) + if (getContext().getLangOpts().isSignedOverflowDefined()) Address = Builder.CreateGEP(Base, Idx, "arrayidx"); else Address = Builder.CreateInBoundsGEP(Base, Idx, "arrayidx"); @@ -1831,8 +1831,8 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { LV.getQuals().setAddressSpace(E->getBase()->getType().getAddressSpace()); - if (getContext().getLangOptions().ObjC1 && - getContext().getLangOptions().getGC() != LangOptions::NonGC) { + if (getContext().getLangOpts().ObjC1 && + getContext().getLangOpts().getGC() != LangOptions::NonGC) { LV.setNonGC(!E->isOBJCGCCandidate(getContext())); setObjCGCLValueClass(getContext(), E, LV); } @@ -2340,7 +2340,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E, if (const CXXPseudoDestructorExpr *PseudoDtor = dyn_cast(E->getCallee()->IgnoreParens())) { QualType DestroyedType = PseudoDtor->getDestroyedType(); - if (getContext().getLangOptions().ObjCAutoRefCount && + if (getContext().getLangOpts().ObjCAutoRefCount && DestroyedType->isObjCLifetimeType() && (DestroyedType.getObjCLifetime() == Qualifiers::OCL_Strong || DestroyedType.getObjCLifetime() == Qualifiers::OCL_Weak)) { diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 3e8ae06f166c..b6efc1cafaaa 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -85,7 +85,7 @@ public: QualType elementType, InitListExpr *E); AggValueSlot::NeedsGCBarriers_t needsGC(QualType T) { - if (CGF.getLangOptions().getGC() && TypeRequiresGCollection(T)) + if (CGF.getLangOpts().getGC() && TypeRequiresGCollection(T)) return AggValueSlot::NeedsGCBarriers; return AggValueSlot::DoesNotNeedGCBarriers; } @@ -254,7 +254,7 @@ void AggExprEmitter::EmitFinalDestCopy(const Expr *E, RValue Src, bool Ignore, // volatile. if (Dest.isIgnored()) { if (!Src.isVolatileQualified() || - CGF.CGM.getLangOptions().CPlusPlus || + CGF.CGM.getLangOpts().CPlusPlus || (IgnoreResult && Ignore)) return; @@ -1123,7 +1123,7 @@ static void CheckAggExprForMemSetUse(AggValueSlot &Slot, const Expr *E, if (Slot.isZeroed() || Slot.isVolatile() || Slot.getAddr() == 0) return; // C++ objects with a user-declared constructor don't need zero'ing. - if (CGF.getContext().getLangOptions().CPlusPlus) + if (CGF.getContext().getLangOpts().CPlusPlus) if (const RecordType *RT = CGF.getContext() .getBaseElementType(E->getType())->getAs()) { const CXXRecordDecl *RD = cast(RT->getDecl()); @@ -1195,7 +1195,7 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, bool isVolatile, unsigned Alignment) { assert(!Ty->isAnyComplexType() && "Shouldn't happen for complex"); - if (getContext().getLangOptions().CPlusPlus) { + if (getContext().getLangOpts().CPlusPlus) { if (const RecordType *RT = Ty->getAs()) { CXXRecordDecl *Record = cast(RT->getDecl()); assert((Record->hasTrivialCopyConstructor() || @@ -1254,7 +1254,7 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, SrcPtr = Builder.CreateBitCast(SrcPtr, SBP); // Don't do any of the memmove_collectable tests if GC isn't set. - if (CGM.getLangOptions().getGC() == LangOptions::NonGC) { + if (CGM.getLangOpts().getGC() == LangOptions::NonGC) { // fall through } else if (const RecordType *RecordTy = Ty->getAs()) { RecordDecl *Record = RecordTy->getDecl(); diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index c0e3acf51b86..d3ba77074700 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -113,7 +113,7 @@ static bool canDevirtualizeMemberFunctionCalls(ASTContext &Context, // When building with -fapple-kext, all calls must go through the vtable since // the kernel linker can do runtime patching of vtables. - if (Context.getLangOptions().AppleKext) + if (Context.getLangOpts().AppleKext) return false; // If the most derived class is marked final, we know that no subclass can @@ -256,7 +256,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, if (UseVirtualCall) { Callee = BuildVirtualCall(Dtor, Dtor_Complete, This, Ty); } else { - if (getContext().getLangOptions().AppleKext && + if (getContext().getLangOpts().AppleKext && MD->isVirtual() && ME->hasQualifier()) Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), Ty); @@ -269,7 +269,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, } else if (UseVirtualCall) { Callee = BuildVirtualCall(MD, This, Ty); } else { - if (getContext().getLangOptions().AppleKext && + if (getContext().getLangOpts().AppleKext && MD->isVirtual() && ME->hasQualifier()) Callee = BuildAppleKextVirtualCall(MD, ME->getQualifier(), Ty); @@ -427,7 +427,7 @@ CodeGenFunction::EmitCXXConstructExpr(const CXXConstructExpr *E, // Elide the constructor if we're constructing from a temporary. // The temporary check is required because Sema sets this on NRVO // returns. - if (getContext().getLangOptions().ElideConstructors && E->isElidable()) { + if (getContext().getLangOpts().ElideConstructors && E->isElidable()) { assert(getContext().hasSameUnqualifiedType(E->getType(), E->getArg(0)->getType())); if (E->getArg(0)->isTemporaryObject(getContext(), CD->getParent())) { @@ -1381,7 +1381,7 @@ static void EmitObjectDelete(CodeGenFunction &CGF, if (Dtor) CGF.EmitCXXDestructorCall(Dtor, Dtor_Complete, /*ForVirtualBase=*/false, Ptr); - else if (CGF.getLangOptions().ObjCAutoRefCount && + else if (CGF.getLangOpts().ObjCAutoRefCount && ElementType->isObjCLifetimeType()) { switch (ElementType.getObjCLifetime()) { case Qualifiers::OCL_None: diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index c5b705f329cd..0233745afa91 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -640,7 +640,7 @@ EmitCompoundAssign(const CompoundAssignOperator *E, LValue LV = EmitCompoundAssignLValue(E, Func, Val); // The result of an assignment in C is the assigned r-value. - if (!CGF.getContext().getLangOptions().CPlusPlus) + if (!CGF.getContext().getLangOpts().CPlusPlus) return Val; // If the lvalue is non-volatile, return the computed value of the assignment. @@ -675,7 +675,7 @@ ComplexPairTy ComplexExprEmitter::VisitBinAssign(const BinaryOperator *E) { LValue LV = EmitBinAssignLValue(E, Val); // The result of an assignment in C is the assigned r-value. - if (!CGF.getContext().getLangOptions().CPlusPlus) + if (!CGF.getContext().getLangOpts().CPlusPlus) return Val; // If the lvalue is non-volatile, return the computed value of the assignment. diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index d3cbf00c85c7..e9de43dd66ba 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -391,7 +391,7 @@ public: // Binary Operators. Value *EmitMul(const BinOpInfo &Ops) { if (Ops.Ty->isSignedIntegerOrEnumerationType()) { - switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) { + switch (CGF.getContext().getLangOpts().getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: return Builder.CreateNSWMul(Ops.LHS, Ops.RHS, "mul"); case LangOptions::SOB_Defined: @@ -406,7 +406,7 @@ public: return Builder.CreateMul(Ops.LHS, Ops.RHS, "mul"); } bool isTrapvOverflowBehavior() { - return CGF.getContext().getLangOptions().getSignedOverflowBehavior() + return CGF.getContext().getLangOpts().getSignedOverflowBehavior() == LangOptions::SOB_Trapping; } /// Create a binary op that checks for overflow. @@ -1247,7 +1247,7 @@ llvm::Value *ScalarExprEmitter:: EmitAddConsiderOverflowBehavior(const UnaryOperator *E, llvm::Value *InVal, llvm::Value *NextVal, bool IsInc) { - switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) { + switch (CGF.getContext().getLangOpts().getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: return Builder.CreateNSWAdd(InVal, NextVal, IsInc ? "inc" : "dec"); case LangOptions::SOB_Defined: @@ -1319,7 +1319,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, = CGF.getContext().getAsVariableArrayType(type)) { llvm::Value *numElts = CGF.getVLASize(vla).first; if (!isInc) numElts = Builder.CreateNSWNeg(numElts, "vla.negsize"); - if (CGF.getContext().getLangOptions().isSignedOverflowDefined()) + if (CGF.getContext().getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, numElts, "vla.inc"); else value = Builder.CreateInBoundsGEP(value, numElts, "vla.inc"); @@ -1329,7 +1329,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, llvm::Value *amt = Builder.getInt32(amount); value = CGF.EmitCastToVoidPtr(value); - if (CGF.getContext().getLangOptions().isSignedOverflowDefined()) + if (CGF.getContext().getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, amt, "incdec.funcptr"); else value = Builder.CreateInBoundsGEP(value, amt, "incdec.funcptr"); @@ -1338,7 +1338,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, // For everything else, we can just do a simple increment. } else { llvm::Value *amt = Builder.getInt32(amount); - if (CGF.getContext().getLangOptions().isSignedOverflowDefined()) + if (CGF.getContext().getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, amt, "incdec.ptr"); else value = Builder.CreateInBoundsGEP(value, amt, "incdec.ptr"); @@ -1399,7 +1399,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, llvm::Value *sizeValue = llvm::ConstantInt::get(CGF.SizeTy, size.getQuantity()); - if (CGF.getContext().getLangOptions().isSignedOverflowDefined()) + if (CGF.getContext().getLangOpts().isSignedOverflowDefined()) value = Builder.CreateGEP(value, sizeValue, "incdec.objptr"); else value = Builder.CreateInBoundsGEP(value, sizeValue, "incdec.objptr"); @@ -1740,7 +1740,7 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E, return 0; // The result of an assignment in C is the assigned r-value. - if (!CGF.getContext().getLangOptions().CPlusPlus) + if (!CGF.getContext().getLangOpts().CPlusPlus) return RHS; // If the lvalue is non-volatile, return the computed value of the assignment. @@ -1801,7 +1801,7 @@ Value *ScalarExprEmitter::EmitDiv(const BinOpInfo &Ops) { } if (Ops.LHS->getType()->isFPOrFPVectorTy()) { llvm::Value *Val = Builder.CreateFDiv(Ops.LHS, Ops.RHS, "div"); - if (CGF.getContext().getLangOptions().OpenCL) { + if (CGF.getContext().getLangOpts().OpenCL) { // OpenCL 1.1 7.4: minimum accuracy of single precision / is 2.5ulp llvm::Type *ValTy = Val->getType(); if (ValTy->isFloatTy() || @@ -1877,7 +1877,7 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) { // Handle overflow with llvm.trap. const std::string *handlerName = - &CGF.getContext().getLangOptions().OverflowHandler; + &CGF.getContext().getLangOpts().OverflowHandler; if (handlerName->empty()) { EmitOverflowBB(overflowBB); Builder.SetInsertPoint(continueBB); @@ -1976,7 +1976,7 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // GEP indexes are signed, and scaling an index isn't permitted to // signed-overflow, so we use the same semantics for our explicit // multiply. We suppress this if overflow is not undefined behavior. - if (CGF.getLangOptions().isSignedOverflowDefined()) { + if (CGF.getLangOpts().isSignedOverflowDefined()) { index = CGF.Builder.CreateMul(index, numElements, "vla.index"); pointer = CGF.Builder.CreateGEP(pointer, index, "add.ptr"); } else { @@ -1995,7 +1995,7 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, return CGF.Builder.CreateBitCast(result, pointer->getType()); } - if (CGF.getLangOptions().isSignedOverflowDefined()) + if (CGF.getLangOpts().isSignedOverflowDefined()) return CGF.Builder.CreateGEP(pointer, index, "add.ptr"); return CGF.Builder.CreateInBoundsGEP(pointer, index, "add.ptr"); @@ -2007,7 +2007,7 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &op) { return emitPointerArithmetic(CGF, op, /*subtraction*/ false); if (op.Ty->isSignedIntegerOrEnumerationType()) { - switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) { + switch (CGF.getContext().getLangOpts().getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: return Builder.CreateNSWAdd(op.LHS, op.RHS, "add"); case LangOptions::SOB_Defined: @@ -2027,7 +2027,7 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &op) { // The LHS is always a pointer if either side is. if (!op.LHS->getType()->isPointerTy()) { if (op.Ty->isSignedIntegerOrEnumerationType()) { - switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) { + switch (CGF.getContext().getLangOpts().getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: return Builder.CreateNSWSub(op.LHS, op.RHS, "sub"); case LangOptions::SOB_Defined: @@ -2353,7 +2353,7 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) { return 0; // The result of an assignment in C is the assigned r-value. - if (!CGF.getContext().getLangOptions().CPlusPlus) + if (!CGF.getContext().getLangOpts().CPlusPlus) return RHS; // If the lvalue is non-volatile, return the computed value of the assignment. @@ -2567,7 +2567,7 @@ VisitAbstractConditionalOperator(const AbstractConditionalOperator *E) { // OpenCL: If the condition is a vector, we can treat this condition like // the select function. - if (CGF.getContext().getLangOptions().OpenCL + if (CGF.getContext().getLangOpts().OpenCL && condExpr->getType()->isVectorType()) { llvm::Value *CondV = CGF.EmitScalarExpr(condExpr); llvm::Value *LHS = Visit(lhsExpr); diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index ffb1266b97f7..b18060c3c5f4 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -279,7 +279,7 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E, // though. bool retainSelf = (!isDelegateInit && - CGM.getLangOptions().ObjCAutoRefCount && + CGM.getLangOpts().ObjCAutoRefCount && method && method->hasAttr()); @@ -333,7 +333,7 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E, // In ARC, we sometimes want to "extend the lifetime" // (i.e. retain+autorelease) of receivers of returns-inner-pointer // messages. - if (getLangOptions().ObjCAutoRefCount && method && + if (getLangOpts().ObjCAutoRefCount && method && method->hasAttr() && shouldExtendReceiverForInnerPointerMessage(E)) Receiver = EmitARCRetainAutorelease(ReceiverType, Receiver); @@ -352,7 +352,7 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E, // be an undefined read and write of an object in unordered // expressions. if (isDelegateInit) { - assert(getLangOptions().ObjCAutoRefCount && + assert(getLangOpts().ObjCAutoRefCount && "delegate init calls should only be marked in ARC"); // Do an unsafe store of null into self. @@ -458,7 +458,7 @@ void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD, StartFunction(OMD, OMD->getResultType(), Fn, FI, args, StartLoc); // In ARC, certain methods get an extra cleanup. - if (CGM.getLangOptions().ObjCAutoRefCount && + if (CGM.getLangOpts().ObjCAutoRefCount && OMD->isInstanceMethod() && OMD->getSelector().isUnarySelector()) { const IdentifierInfo *ident = @@ -604,13 +604,13 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM, // Handle retain. if (setterKind == ObjCPropertyDecl::Retain) { // In GC-only, there's nothing special that needs to be done. - if (CGM.getLangOptions().getGC() == LangOptions::GCOnly) { + if (CGM.getLangOpts().getGC() == LangOptions::GCOnly) { // fallthrough // In ARC, if the property is non-atomic, use expression emission, // which translates to objc_storeStrong. This isn't required, but // it's slightly nicer. - } else if (CGM.getLangOptions().ObjCAutoRefCount && !IsAtomic) { + } else if (CGM.getLangOpts().ObjCAutoRefCount && !IsAtomic) { Kind = Expression; return; @@ -645,14 +645,14 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM, // expressions. This actually works out to being atomic anyway, // except for ARC __strong, but that should trigger the above code. if (ivarType.hasNonTrivialObjCLifetime() || - (CGM.getLangOptions().getGC() && + (CGM.getLangOpts().getGC() && CGM.getContext().getObjCGCAttrKind(ivarType))) { Kind = Expression; return; } // Compute whether the ivar has strong members. - if (CGM.getLangOptions().getGC()) + if (CGM.getLangOpts().getGC()) if (const RecordType *recordType = ivarType->getAs()) HasStrong = recordType->getDecl()->hasObjectMember(); @@ -1021,7 +1021,7 @@ static bool hasTrivialSetExpr(const ObjCPropertyImplDecl *PID) { } static bool UseOptimizedSetter(CodeGenModule &CGM) { - if (CGM.getLangOptions().getGC() != LangOptions::NonGC) + if (CGM.getLangOpts().getGC() != LangOptions::NonGC) return false; const TargetInfo &Target = CGM.getContext().getTargetInfo(); @@ -1334,7 +1334,7 @@ bool CodeGenFunction::IndirectObjCSetterArg(const CGFunctionInfo &FI) { } bool CodeGenFunction::IvarTypeWithAggrGCObjects(QualType Ty) { - if (CGM.getLangOptions().getGC() == LangOptions::NonGC) + if (CGM.getLangOpts().getGC() == LangOptions::NonGC) return false; if (const RecordType *FDTTy = Ty.getTypePtr()->getAs()) return FDTTy->getDecl()->hasObjectMember(); @@ -1399,7 +1399,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){ // Emit the collection pointer. In ARC, we do a retain. llvm::Value *Collection; - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { Collection = EmitARCRetainScalarExpr(S.getCollection()); // Enter a cleanup to do the release. @@ -1624,7 +1624,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){ DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); // Leave the cleanup we entered in ARC. - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) PopCleanupBlock(); EmitBlock(LoopEnd.getBlock()); @@ -2241,7 +2241,7 @@ namespace { } void CodeGenFunction::EmitObjCAutoreleasePoolCleanup(llvm::Value *Ptr) { - if (CGM.getLangOptions().ObjCAutoRefCount) + if (CGM.getLangOpts().ObjCAutoRefCount) EHStack.pushCleanup(NormalCleanup, Ptr); else EHStack.pushCleanup(NormalCleanup, Ptr); @@ -2292,7 +2292,7 @@ static TryEmitResult tryEmitARCRetainLoadOfScalar(CodeGenFunction &CGF, // As a very special optimization, in ARC++, if the l-value is the // result of a non-volatile assignment, do a simple retain of the // result of the call to objc_storeWeak instead of reloading. - if (CGF.getLangOptions().CPlusPlus && + if (CGF.getLangOpts().CPlusPlus && !type.isVolatileQualified() && type.getObjCLifetime() == Qualifiers::OCL_Weak && isa(e) && @@ -2637,7 +2637,7 @@ llvm::Value *CodeGenFunction::EmitARCExtendBlockObject(const Expr *e) { llvm::Value *CodeGenFunction::EmitObjCThrowOperand(const Expr *expr) { // In ARC, retain and autorelease the expression. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { // Do so before running any cleanups for the full-expression. // tryEmitARCRetainScalarExpr does make an effort to do things // inside cleanups, but there are crazy cases like @@ -2754,7 +2754,7 @@ llvm::Constant * CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction( const ObjCPropertyImplDecl *PID) { // FIXME. This api is for NeXt runtime only for now. - if (!getLangOptions().CPlusPlus || !getLangOptions().NeXTRuntime) + if (!getLangOpts().CPlusPlus || !getLangOpts().NeXTRuntime) return 0; QualType Ty = PID->getPropertyIvarDecl()->getType(); if (!Ty->isRecordType()) @@ -2837,7 +2837,7 @@ llvm::Constant * CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction( const ObjCPropertyImplDecl *PID) { // FIXME. This api is for NeXt runtime only for now. - if (!getLangOptions().CPlusPlus || !getLangOptions().NeXTRuntime) + if (!getLangOpts().CPlusPlus || !getLangOpts().NeXTRuntime) return 0; const ObjCPropertyDecl *PD = PID->getPropertyDecl(); QualType Ty = PD->getType(); diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 16812e295775..3e5c4a2a93a1 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -641,7 +641,7 @@ class CGObjCGNUstep : public CGObjCGNU { SlotLookupSuperFn.init(&CGM, "objc_slot_lookup_super", SlotTy, PtrToObjCSuperTy, SelectorTy, NULL); // If we're in ObjC++ mode, then we want to make - if (CGM.getLangOptions().CPlusPlus) { + if (CGM.getLangOpts().CPlusPlus) { llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext); // void *__cxa_begin_catch(void *e) EnterCatchFn.init(&CGM, "__cxa_begin_catch", PtrTy, PtrTy, NULL); @@ -773,7 +773,7 @@ CGObjCGNU::CGObjCGNU(CodeGenModule &cgm, unsigned runtimeABIVersion, IMPTy = llvm::PointerType::getUnqual(llvm::FunctionType::get(IdTy, IMPArgs, true)); - const LangOptions &Opts = CGM.getLangOptions(); + const LangOptions &Opts = CGM.getLangOpts(); if ((Opts.getGC() != LangOptions::NonGC) || Opts.ObjCAutoRefCount) RuntimeVersion = 10; @@ -882,14 +882,14 @@ llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl } llvm::Constant *CGObjCGNU::GetEHType(QualType T) { - if (!CGM.getLangOptions().CPlusPlus) { + if (!CGM.getLangOpts().CPlusPlus) { if (T->isObjCIdType() || T->isObjCQualifiedIdType()) { // With the old ABI, there was only one kind of catchall, which broke // foreign exceptions. With the new ABI, we use __objc_id_typeinfo as // a pointer indicating object catchalls, and NULL to indicate real // catchalls - if (CGM.getLangOptions().ObjCNonFragileABI) { + if (CGM.getLangOpts().ObjCNonFragileABI) { return MakeConstantString("@id"); } else { return 0; @@ -973,7 +973,7 @@ llvm::Constant *CGObjCGNU::GenerateConstantString(const StringLiteral *SL) { if (old != ObjCStrings.end()) return old->getValue(); - StringRef StringClass = CGM.getLangOptions().ObjCConstantStringClass; + StringRef StringClass = CGM.getLangOpts().ObjCConstantStringClass; if (StringClass.empty()) StringClass = "NXConstantString"; @@ -1016,7 +1016,7 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF, const CallArgList &CallArgs, const ObjCMethodDecl *Method) { CGBuilderTy &Builder = CGF.Builder; - if (CGM.getLangOptions().getGC() == LangOptions::GCOnly) { + if (CGM.getLangOpts().getGC() == LangOptions::GCOnly) { if (Sel == RetainSel || Sel == AutoreleaseSel) { return RValue::get(EnforceType(Builder, Receiver, CGM.getTypes().ConvertType(ResultType))); @@ -1119,7 +1119,7 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF, CGBuilderTy &Builder = CGF.Builder; // Strip out message sends to retain / release in GC mode - if (CGM.getLangOptions().getGC() == LangOptions::GCOnly) { + if (CGM.getLangOpts().getGC() == LangOptions::GCOnly) { if (Sel == RetainSel || Sel == AutoreleaseSel) { return RValue::get(EnforceType(Builder, Receiver, CGM.getTypes().ConvertType(ResultType))); @@ -1983,7 +1983,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { Context.getASTObjCInterfaceLayout(SuperClassDecl).getSize().getQuantity(); // For non-fragile ivars, set the instance size to 0 - {the size of just this // class}. The runtime will then set this to the correct value on load. - if (CGM.getContext().getLangOptions().ObjCNonFragileABI) { + if (CGM.getContext().getLangOpts().ObjCNonFragileABI) { instanceSize = 0 - (instanceSize - superInstanceSize); } @@ -1998,7 +1998,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { // Get the offset uint64_t BaseOffset = ComputeIvarBaseOffset(CGM, OID, IVD); uint64_t Offset = BaseOffset; - if (CGM.getContext().getLangOptions().ObjCNonFragileABI) { + if (CGM.getContext().getLangOpts().ObjCNonFragileABI) { Offset = BaseOffset - superInstanceSize; } llvm::Constant *OffsetValue = llvm::ConstantInt::get(IntTy, Offset); @@ -2192,7 +2192,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { ConstantStrings.size() + 1); ConstantStrings.push_back(NULLPtr); - StringRef StringClass = CGM.getLangOptions().ObjCConstantStringClass; + StringRef StringClass = CGM.getLangOpts().ObjCConstantStringClass; if (StringClass.empty()) StringClass = "NXConstantString"; @@ -2320,12 +2320,12 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { Elements.push_back(SymTab); if (RuntimeVersion >= 10) - switch (CGM.getLangOptions().getGC()) { + switch (CGM.getLangOpts().getGC()) { case LangOptions::GCOnly: Elements.push_back(llvm::ConstantInt::get(IntTy, 2)); break; case LangOptions::NonGC: - if (CGM.getLangOptions().ObjCAutoRefCount) + if (CGM.getLangOpts().ObjCAutoRefCount) Elements.push_back(llvm::ConstantInt::get(IntTy, 1)); else Elements.push_back(llvm::ConstantInt::get(IntTy, 0)); @@ -2592,7 +2592,7 @@ llvm::GlobalVariable *CGObjCGNU::ObjCIvarOffsetVariable( // to replace it with the real version for a library. In non-PIC code you // must compile with the fragile ABI if you want to use ivars from a // GCC-compiled class. - if (CGM.getLangOptions().PICLevel) { + if (CGM.getLangOpts().PICLevel) { llvm::GlobalVariable *IvarOffsetGV = new llvm::GlobalVariable(TheModule, Int32Ty, false, llvm::GlobalValue::PrivateLinkage, OffsetGuess, Name+".guess"); @@ -2638,7 +2638,7 @@ static const ObjCInterfaceDecl *FindIvarInterface(ASTContext &Context, llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGenFunction &CGF, const ObjCInterfaceDecl *Interface, const ObjCIvarDecl *Ivar) { - if (CGM.getLangOptions().ObjCNonFragileABI) { + if (CGM.getLangOpts().ObjCNonFragileABI) { Interface = FindIvarInterface(CGM.getContext(), Interface, Ivar); if (RuntimeVersion < 10) return CGF.Builder.CreateZExtOrBitCast( @@ -2660,7 +2660,7 @@ llvm::Value *CGObjCGNU::EmitIvarOffset(CodeGenFunction &CGF, CGObjCRuntime * clang::CodeGen::CreateGNUObjCRuntime(CodeGenModule &CGM) { - if (CGM.getLangOptions().ObjCNonFragileABI) + if (CGM.getLangOpts().ObjCNonFragileABI) return new CGObjCGNUstep(CGM); return new CGObjCGCC(CGM); } diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index a408681aadc6..ece778cc12b8 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -1615,7 +1615,7 @@ llvm::Constant *CGObjCMac::GetEHType(QualType T) { llvm::Constant *CGObjCCommonMac::GenerateConstantString( const StringLiteral *SL) { - return (CGM.getLangOptions().NoConstantCFStrings == 0 ? + return (CGM.getLangOpts().NoConstantCFStrings == 0 ? CGM.GetAddrOfConstantCFString(SL) : CGM.GetAddrOfConstantString(SL)); } @@ -1747,7 +1747,7 @@ CGObjCCommonMac::EmitMessageSend(CodeGen::CodeGenFunction &CGF, } bool requiresnullCheck = false; - if (CGM.getLangOptions().ObjCAutoRefCount && Method) + if (CGM.getLangOpts().ObjCAutoRefCount && Method) for (ObjCMethodDecl::param_const_iterator i = Method->param_begin(), e = Method->param_end(); i != e; ++i) { const ParmVarDecl *ParamDecl = (*i); @@ -1789,8 +1789,8 @@ llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM, const CGBlockInfo &blockInfo) { llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy); - if (CGM.getLangOptions().getGC() == LangOptions::NonGC && - !CGM.getLangOptions().ObjCAutoRefCount) + if (CGM.getLangOpts().getGC() == LangOptions::NonGC && + !CGM.getLangOpts().ObjCAutoRefCount) return nullPtr; bool hasUnion = false; @@ -1858,7 +1858,7 @@ llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM, std::string BitMap; llvm::Constant *C = BuildIvarLayoutBitmap(BitMap); - if (CGM.getLangOptions().ObjCGCBitmapPrint) { + if (CGM.getLangOpts().ObjCGCBitmapPrint) { printf("\n block variable layout for block: "); const unsigned char *s = (unsigned char*)BitMap.c_str(); for (unsigned i = 0, e = BitMap.size(); i < e; i++) @@ -3630,7 +3630,7 @@ void CGObjCCommonMac::EmitImageInfo() { Mod.addModuleFlag(llvm::Module::Error, "Objective-C Image Info Section", llvm::MDString::get(VMContext,Section)); - if (CGM.getLangOptions().getGC() == LangOptions::NonGC) { + if (CGM.getLangOpts().getGC() == LangOptions::NonGC) { // Non-GC overrides those files which specify GC. Mod.addModuleFlag(llvm::Module::Override, "Objective-C Garbage Collection", (uint32_t)0); @@ -3640,7 +3640,7 @@ void CGObjCCommonMac::EmitImageInfo() { "Objective-C Garbage Collection", eImageInfo_GarbageCollected); - if (CGM.getLangOptions().getGC() == LangOptions::GCOnly) { + if (CGM.getLangOpts().getGC() == LangOptions::GCOnly) { // Add the ObjC GC Only value. Mod.addModuleFlag(llvm::Module::Error, "Objective-C GC Only", eImageInfo_GCOnly); @@ -3837,7 +3837,7 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI, return; unsigned WordSizeInBits = CGM.getContext().getTargetInfo().getPointerWidth(0); unsigned ByteSizeInBits = CGM.getContext().getTargetInfo().getCharWidth(); - if (!RD && CGM.getLangOptions().ObjCAutoRefCount) { + if (!RD && CGM.getLangOpts().ObjCAutoRefCount) { const FieldDecl *FirstField = RecFields[0]; FirstFieldDelta = ComputeIvarBaseOffset(CGM, OI, cast(FirstField)); @@ -4131,13 +4131,13 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout( bool hasUnion = false; llvm::Type *PtrTy = CGM.Int8PtrTy; - if (CGM.getLangOptions().getGC() == LangOptions::NonGC && - !CGM.getLangOptions().ObjCAutoRefCount) + if (CGM.getLangOpts().getGC() == LangOptions::NonGC && + !CGM.getLangOpts().ObjCAutoRefCount) return llvm::Constant::getNullValue(PtrTy); const ObjCInterfaceDecl *OI = OMD->getClassInterface(); SmallVector RecFields; - if (CGM.getLangOptions().ObjCAutoRefCount) { + if (CGM.getLangOpts().ObjCAutoRefCount) { for (const ObjCIvarDecl *IVD = OI->all_declared_ivar_begin(); IVD; IVD = IVD->getNextIvar()) RecFields.push_back(cast(IVD)); @@ -4169,7 +4169,7 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout( std::string BitMap; llvm::Constant *C = BuildIvarLayoutBitmap(BitMap); - if (CGM.getLangOptions().ObjCGCBitmapPrint) { + if (CGM.getLangOpts().ObjCGCBitmapPrint) { printf("\n%s ivar layout for class '%s': ", ForStrongLayout ? "strong" : "weak", OMD->getClassInterface()->getName().data()); @@ -4891,7 +4891,7 @@ bool CGObjCNonFragileABIMac::isVTableDispatchedSelector(Selector Sel) { // These are vtable-based if GC is disabled. // Optimistically use vtable dispatch for hybrid compiles. - if (CGM.getLangOptions().getGC() != LangOptions::GCOnly) { + if (CGM.getLangOpts().getGC() != LangOptions::GCOnly) { VTableDispatchMethods.insert(GetNullarySelector("retain")); VTableDispatchMethods.insert(GetNullarySelector("release")); VTableDispatchMethods.insert(GetNullarySelector("autorelease")); @@ -4907,7 +4907,7 @@ bool CGObjCNonFragileABIMac::isVTableDispatchedSelector(Selector Sel) { // These are vtable-based if GC is enabled. // Optimistically use vtable dispatch for hybrid compiles. - if (CGM.getLangOptions().getGC() != LangOptions::NonGC) { + if (CGM.getLangOpts().getGC() != LangOptions::NonGC) { VTableDispatchMethods.insert(GetNullarySelector("hash")); VTableDispatchMethods.insert(GetUnarySelector("addObject")); @@ -4961,7 +4961,7 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( std::string ClassName = ID->getNameAsString(); llvm::Constant *Values[10]; // 11 for 64bit targets! - if (CGM.getLangOptions().ObjCAutoRefCount) + if (CGM.getLangOpts().ObjCAutoRefCount) flags |= CLS_COMPILED_BY_ARC; Values[ 0] = llvm::ConstantInt::get(ObjCTypes.IntTy, flags); @@ -5877,7 +5877,7 @@ CGObjCNonFragileABIMac::EmitVTableMessageSend(CodeGenFunction &CGF, } bool requiresnullCheck = false; - if (CGM.getLangOptions().ObjCAutoRefCount && method) + if (CGM.getLangOpts().ObjCAutoRefCount && method) for (ObjCMethodDecl::param_const_iterator i = method->param_begin(), e = method->param_end(); i != e; ++i) { const ParmVarDecl *ParamDecl = (*i); @@ -6344,7 +6344,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID, ID->getIdentifier()->getName())); } - if (CGM.getLangOptions().getVisibilityMode() == HiddenVisibility) + if (CGM.getLangOpts().getVisibilityMode() == HiddenVisibility) Entry->setVisibility(llvm::GlobalValue::HiddenVisibility); Entry->setAlignment(CGM.getTargetData().getABITypeAlignment( ObjCTypes.EHTypeTy)); @@ -6363,7 +6363,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID, CodeGen::CGObjCRuntime * CodeGen::CreateMacObjCRuntime(CodeGen::CodeGenModule &CGM) { - if (CGM.getLangOptions().ObjCNonFragileABI) + if (CGM.getLangOpts().ObjCNonFragileABI) return new CGObjCNonFragileABIMac(CGM); return new CGObjCMac(CGM); } diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp index 17557cf103e2..93700960df23 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.cpp +++ b/clang/lib/CodeGen/CGObjCRuntime.cpp @@ -310,7 +310,7 @@ void CGObjCRuntime::EmitAtSynchronizedStmt(CodeGenFunction &CGF, // ARC release and lock-release cleanups. const Expr *lockExpr = S.getSynchExpr(); llvm::Value *lock; - if (CGF.getLangOptions().ObjCAutoRefCount) { + if (CGF.getLangOpts().ObjCAutoRefCount) { lock = CGF.EmitARCRetainScalarExpr(lockExpr); lock = CGF.EmitObjCConsumeObject(lockExpr->getType(), lock); } else { diff --git a/clang/lib/CodeGen/CGRTTI.cpp b/clang/lib/CodeGen/CGRTTI.cpp index a8c4ac46349e..19973b46b7cd 100644 --- a/clang/lib/CodeGen/CGRTTI.cpp +++ b/clang/lib/CodeGen/CGRTTI.cpp @@ -249,7 +249,7 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM, QualType Ty) { ASTContext &Context = CGM.getContext(); // If RTTI is disabled, don't consider key functions. - if (!Context.getLangOptions().RTTI) return false; + if (!Context.getLangOpts().RTTI) return false; if (const RecordType *RecordTy = dyn_cast(Ty)) { const CXXRecordDecl *RD = cast(RecordTy->getDecl()); @@ -326,7 +326,7 @@ getTypeInfoLinkage(CodeGenModule &CGM, QualType Ty) { return llvm::GlobalValue::InternalLinkage; case ExternalLinkage: - if (!CGM.getLangOptions().RTTI) { + if (!CGM.getLangOpts().RTTI) { // RTTI is not enabled, which means that this type info struct is going // to be used for exception handling. Give it linkonce_odr linkage. return llvm::GlobalValue::LinkOnceODRLinkage; @@ -982,10 +982,10 @@ llvm::Constant *CodeGenModule::GetAddrOfRTTIDescriptor(QualType Ty, // Return a bogus pointer if RTTI is disabled, unless it's for EH. // FIXME: should we even be calling this method if RTTI is disabled // and it's not for EH? - if (!ForEH && !getContext().getLangOptions().RTTI) + if (!ForEH && !getContext().getLangOpts().RTTI) return llvm::Constant::getNullValue(Int8PtrTy); - if (ForEH && Ty->isObjCObjectPointerType() && !Features.NeXTRuntime) + if (ForEH && Ty->isObjCObjectPointerType() && !LangOpts.NeXTRuntime) return ObjCRuntime->GetEHType(Ty); return RTTIBuilder(*this).BuildTypeInfo(Ty); diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index 4878bd237174..1193e974e195 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -972,7 +972,7 @@ void CGRecordLayoutBuilder::CheckZeroInitializable(QualType T) { return; // Can only have member pointers if we're compiling C++. - if (!Types.getContext().getLangOptions().CPlusPlus) + if (!Types.getContext().getLangOpts().CPlusPlus) return; const Type *elementType = T->getBaseElementTypeUnsafe(); @@ -1017,7 +1017,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, RL->BitFields.swap(Builder.BitFields); // Dump the layout, if requested. - if (getContext().getLangOptions().DumpRecordLayouts) { + if (getContext().getLangOpts().DumpRecordLayouts) { llvm::errs() << "\n*** Dumping IRgen Record Layout\n"; llvm::errs() << "Record: "; D->dump(); diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index d87202ee59f5..b2da32bb529e 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -1370,7 +1370,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, StringRef StrVal = Str->getString(); if (!StrVal.empty()) { const SourceManager &SM = CGF.CGM.getContext().getSourceManager(); - const LangOptions &LangOpts = CGF.CGM.getLangOptions(); + const LangOptions &LangOpts = CGF.CGM.getLangOpts(); // Add the location of the start of each subsequent line of the asm to the // MDNode. diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 77e9fb3ca84c..e262de110e7e 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -52,7 +52,7 @@ bool CodeGenVTables::ShouldEmitVTableInThisTU(const CXXRecordDecl *RD) { // If we're building with optimization, we always emit VTables since that // allows for virtual function calls to be devirtualized. // (We don't want to do this in -fapple-kext mode however). - if (CGM.getCodeGenOpts().OptimizationLevel && !CGM.getLangOptions().AppleKext) + if (CGM.getCodeGenOpts().OptimizationLevel && !CGM.getLangOpts().AppleKext) return true; return KeyFunction->hasBody(); diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 47176bd8ecc3..b80ceddbe373 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -40,7 +40,7 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm) CXXVTTValue(0), OutermostConditional(0), TerminateLandingPad(0), TerminateHandler(0), TrapBB(0) { - CatchUndefined = getContext().getLangOptions().CatchUndefined; + CatchUndefined = getContext().getLangOpts().CatchUndefined; CGM.getCXXABI().getMangleContext().startNewFunction(); } @@ -274,7 +274,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, break; } - if (getContext().getLangOptions().OpenCL) { + if (getContext().getLangOpts().OpenCL) { // Add metadata for a kernel function. if (const FunctionDecl *FD = dyn_cast_or_null(D)) if (FD->hasAttr()) { @@ -340,7 +340,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // Tell the epilog emitter to autorelease the result. We do this // now so that various specialized functions can suppress it // during their IR-generation. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && !CurFnInfo->isReturnsRetained() && RetTy->isObjCRetainableType()) AutoreleaseResult = true; @@ -442,7 +442,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, EmitDestructorBody(Args); else if (isa(FD)) EmitConstructorBody(Args); - else if (getContext().getLangOptions().CUDA && + else if (getContext().getLangOpts().CUDA && !CGM.getCodeGenOpts().CUDAIsDevice && FD->hasAttr()) CGM.getCUDARuntime().EmitDeviceStubBody(*this, Args); @@ -731,7 +731,7 @@ static void emitNonZeroVLAInit(CodeGenFunction &CGF, QualType baseType, void CodeGenFunction::EmitNullInitialization(llvm::Value *DestPtr, QualType Ty) { // Ignore empty classes in C++. - if (getContext().getLangOptions().CPlusPlus) { + if (getContext().getLangOpts().CPlusPlus) { if (const RecordType *RT = Ty->getAs()) { if (cast(RT->getDecl())->isEmpty()) return; diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 4be5beb46451..e0e6501b19e2 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1210,7 +1210,7 @@ public: return CGM.getCodeGenOpts().OptimizationLevel == 0; } - const LangOptions &getLangOptions() const { return CGM.getLangOptions(); } + const LangOptions &getLangOpts() const { return CGM.getLangOpts(); } /// Returns a pointer to the function's exception object and selector slot, /// which is assigned in every landing pad. @@ -1278,9 +1278,9 @@ public: return false; case QualType::DK_cxx_destructor: case QualType::DK_objc_weak_lifetime: - return getLangOptions().Exceptions; + return getLangOpts().Exceptions; case QualType::DK_objc_strong_lifetime: - return getLangOptions().Exceptions && + return getLangOpts().Exceptions && CGM.getCodeGenOpts().ObjCAutoRefCountExceptions; } llvm_unreachable("bad destruction kind"); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 0399ec479e7e..5fdb427e27c9 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -64,7 +64,7 @@ static CGCXXABI &createCXXABI(CodeGenModule &CGM) { CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, llvm::Module &M, const llvm::TargetData &TD, DiagnosticsEngine &diags) - : Context(C), Features(C.getLangOptions()), CodeGenOpts(CGO), TheModule(M), + : Context(C), LangOpts(C.getLangOpts()), CodeGenOpts(CGO), TheModule(M), TheTargetData(TD), TheTargetCodeGenInfo(0), Diags(diags), ABI(createCXXABI(*this)), Types(*this), @@ -95,16 +95,16 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, Int8PtrTy = Int8Ty->getPointerTo(0); Int8PtrPtrTy = Int8PtrTy->getPointerTo(0); - if (Features.ObjC1) + if (LangOpts.ObjC1) createObjCRuntime(); - if (Features.OpenCL) + if (LangOpts.OpenCL) createOpenCLRuntime(); - if (Features.CUDA) + if (LangOpts.CUDA) createCUDARuntime(); // Enable TBAA unless it's suppressed. if (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0) - TBAA = new CodeGenTBAA(Context, VMContext, getLangOptions(), + TBAA = new CodeGenTBAA(Context, VMContext, getLangOpts(), ABI.getMangleContext()); // If debug info or coverage generation is enabled, create the CGDebugInfo @@ -115,7 +115,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, Block.GlobalUniqueCount = 0; - if (C.getLangOptions().ObjCAutoRefCount) + if (C.getLangOpts().ObjCAutoRefCount) ARCData = new ARCEntrypoints(); RRData = new RREntrypoints(); } @@ -133,7 +133,7 @@ CodeGenModule::~CodeGenModule() { } void CodeGenModule::createObjCRuntime() { - if (!Features.NeXTRuntime) + if (!LangOpts.NeXTRuntime) ObjCRuntime = CreateGNUObjCRuntime(*this); else ObjCRuntime = CreateMacObjCRuntime(*this); @@ -296,7 +296,7 @@ void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV, // If there's a key function, there may be translation units // that don't have the key function's definition. But ignore // this if we're emitting RTTI under -fno-rtti. - if (!(TVK != TVK_ForRTTI) || Features.RTTI) { + if (!(TVK != TVK_ForRTTI) || LangOpts.RTTI) { if (Context.getKeyFunction(RD)) return; } @@ -434,7 +434,7 @@ CodeGenModule::getFunctionLinkage(const FunctionDecl *D) { // merged with other definitions. c) C++ has the ODR, so we know the // definition is dependable. if (Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation) - return !Context.getLangOptions().AppleKext + return !Context.getLangOpts().AppleKext ? llvm::Function::LinkOnceODRLinkage : llvm::Function::InternalLinkage; @@ -443,7 +443,7 @@ CodeGenModule::getFunctionLinkage(const FunctionDecl *D) { // and must all be equivalent. However, we are not allowed to // throw away these explicit instantiations. if (Linkage == GVA_ExplicitTemplateInstantiation) - return !Context.getLangOptions().AppleKext + return !Context.getLangOpts().AppleKext ? llvm::Function::WeakODRLinkage : llvm::Function::ExternalLinkage; @@ -478,16 +478,16 @@ void CodeGenModule::SetLLVMFunctionAttributes(const Decl *D, /// except under the fragile ObjC ABI with only ObjC exceptions /// enabled. This means, for example, that C with -fexceptions /// enables this. -static bool hasUnwindExceptions(const LangOptions &Features) { +static bool hasUnwindExceptions(const LangOptions &LangOpts) { // If exceptions are completely disabled, obviously this is false. - if (!Features.Exceptions) return false; + if (!LangOpts.Exceptions) return false; // If C++ exceptions are enabled, this is true. - if (Features.CXXExceptions) return true; + if (LangOpts.CXXExceptions) return true; // If ObjC exceptions are enabled, this depends on the ABI. - if (Features.ObjCExceptions) { - if (!Features.ObjCNonFragileABI) return false; + if (LangOpts.ObjCExceptions) { + if (!LangOpts.ObjCNonFragileABI) return false; } return true; @@ -498,7 +498,7 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, if (CodeGenOpts.UnwindTables) F->setHasUWTable(); - if (!hasUnwindExceptions(Features)) + if (!hasUnwindExceptions(LangOpts)) F->addFnAttr(llvm::Attribute::NoUnwind); if (D->hasAttr()) { @@ -518,12 +518,12 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, if (isa(D) || isa(D)) F->setUnnamedAddr(true); - if (Features.getStackProtector() == LangOptions::SSPOn) + if (LangOpts.getStackProtector() == LangOptions::SSPOn) F->addFnAttr(llvm::Attribute::StackProtect); - else if (Features.getStackProtector() == LangOptions::SSPReq) + else if (LangOpts.getStackProtector() == LangOptions::SSPReq) F->addFnAttr(llvm::Attribute::StackProtectReq); - if (Features.AddressSanitizer) { + if (LangOpts.AddressSanitizer) { // When AddressSanitizer is enabled, set AddressSafety attribute // unless __attribute__((no_address_safety_analysis)) is used. if (!D->hasAttr()) @@ -752,7 +752,7 @@ void CodeGenModule::AddGlobalAnnotations(const ValueDecl *D, bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) { // Never defer when EmitAllDecls is specified. - if (Features.EmitAllDecls) + if (LangOpts.EmitAllDecls) return false; return !getContext().DeclMustBeEmitted(Global); @@ -796,7 +796,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { return EmitAliasDefinition(GD); // If this is CUDA, be selective about which declarations we emit. - if (Features.CUDA) { + if (LangOpts.CUDA) { if (CodeGenOpts.CUDAIsDevice) { if (!Global->hasAttr() && !Global->hasAttr() && @@ -848,7 +848,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { // If we're deferring emission of a C++ variable with an // initializer, remember the order in which it appeared in the file. - if (getLangOptions().CPlusPlus && isa(Global) && + if (getLangOpts().CPlusPlus && isa(Global) && cast(Global)->hasInit()) { DelayedCXXInitPosition[Global] = CXXGlobalInits.size(); CXXGlobalInits.push_back(0); @@ -1048,7 +1048,7 @@ CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, // // We also don't emit a definition for a function if it's going to be an entry // in a vtable, unless it's already marked as used. - } else if (getLangOptions().CPlusPlus && D.getDecl()) { + } else if (getLangOpts().CPlusPlus && D.getDecl()) { // Look for a declaration that's lexically in a record. const FunctionDecl *FD = cast(D.getDecl()); do { @@ -1110,7 +1110,7 @@ bool CodeGenModule::isTypeConstant(QualType Ty, bool ExcludeCtor) { if (!Ty.isConstant(Context) && !Ty->isReferenceType()) return false; - if (Context.getLangOptions().CPlusPlus) { + if (Context.getLangOpts().CPlusPlus) { if (const CXXRecordDecl *Record = Context.getBaseElementType(Ty)->getAsCXXRecordDecl()) return ExcludeCtor && !Record->hasMutableFields() && @@ -1309,19 +1309,19 @@ CodeGenModule::getVTableLinkage(const CXXRecordDecl *RD) { return llvm::GlobalVariable::AvailableExternallyLinkage; if (KeyFunction->isInlined()) - return !Context.getLangOptions().AppleKext ? + return !Context.getLangOpts().AppleKext ? llvm::GlobalVariable::LinkOnceODRLinkage : llvm::Function::InternalLinkage; return llvm::GlobalVariable::ExternalLinkage; case TSK_ImplicitInstantiation: - return !Context.getLangOptions().AppleKext ? + return !Context.getLangOpts().AppleKext ? llvm::GlobalVariable::LinkOnceODRLinkage : llvm::Function::InternalLinkage; case TSK_ExplicitInstantiationDefinition: - return !Context.getLangOptions().AppleKext ? + return !Context.getLangOpts().AppleKext ? llvm::GlobalVariable::WeakODRLinkage : llvm::Function::InternalLinkage; @@ -1329,13 +1329,13 @@ CodeGenModule::getVTableLinkage(const CXXRecordDecl *RD) { // FIXME: Use available_externally linkage. However, this currently // breaks LLVM's build due to undefined symbols. // return llvm::GlobalVariable::AvailableExternallyLinkage; - return !Context.getLangOptions().AppleKext ? + return !Context.getLangOpts().AppleKext ? llvm::GlobalVariable::LinkOnceODRLinkage : llvm::Function::InternalLinkage; } } - if (Context.getLangOptions().AppleKext) + if (Context.getLangOpts().AppleKext) return llvm::Function::InternalLinkage; switch (RD->getTemplateSpecializationKind()) { @@ -1515,7 +1515,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { if (D->getType()->isReferenceType()) T = D->getType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Init = EmitNullConstant(T); NeedsGlobalCtor = true; } else { @@ -1526,7 +1526,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { // We don't need an initializer, so remove the entry for the delayed // initializer position (just in case this entry was delayed) if we // also don't need to register a destructor. - if (getLangOptions().CPlusPlus && !NeedsGlobalDtor) + if (getLangOpts().CPlusPlus && !NeedsGlobalDtor) DelayedCXXInitPosition.erase(D); } } @@ -1622,7 +1622,7 @@ CodeGenModule::GetLLVMLinkageVarDefinition(const VarDecl *D, } else if (Linkage == GVA_TemplateInstantiation || Linkage == GVA_ExplicitTemplateInstantiation) return llvm::GlobalVariable::WeakODRLinkage; - else if (!getLangOptions().CPlusPlus && + else if (!getLangOpts().CPlusPlus && ((!CodeGenOpts.NoCommon && !D->getAttr()) || D->getAttr()) && !D->hasExternalStorage() && !D->getInit() && @@ -2036,7 +2036,7 @@ static RecordDecl * CreateRecordDecl(const ASTContext &Ctx, RecordDecl::TagKind TK, DeclContext *DC, IdentifierInfo *Id) { SourceLocation Loc; - if (Ctx.getLangOptions().CPlusPlus) + if (Ctx.getLangOpts().CPlusPlus) return CXXRecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id); else return RecordDecl::Create(Ctx, TK, DC, Loc, Loc, Id); @@ -2056,10 +2056,10 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) { // If we don't already have it, get _NSConstantStringClassReference. if (!ConstantStringClassRef) { - std::string StringClass(getLangOptions().ObjCConstantStringClass); + std::string StringClass(getLangOpts().ObjCConstantStringClass); llvm::Type *Ty = getTypes().ConvertType(getContext().IntTy); llvm::Constant *GV; - if (Features.ObjCNonFragileABI) { + if (LangOpts.ObjCNonFragileABI) { std::string str = StringClass.empty() ? "OBJC_CLASS_$_NSConstantString" : "OBJC_CLASS_$_" + StringClass; @@ -2126,7 +2126,7 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) { llvm::GlobalValue::LinkageTypes Linkage; bool isConstant; Linkage = llvm::GlobalValue::PrivateLinkage; - isConstant = !Features.WritableStrings; + isConstant = !LangOpts.WritableStrings; llvm::GlobalVariable *GV = new llvm::GlobalVariable(getModule(), C->getType(), isConstant, Linkage, C, @@ -2147,7 +2147,7 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) { "_unnamed_nsstring_"); // FIXME. Fix section. if (const char *Sect = - Features.ObjCNonFragileABI + LangOpts.ObjCNonFragileABI ? getContext().getTargetInfo().getNSStringNonFragileABISection() : getContext().getTargetInfo().getNSStringSection()) GV->setSection(Sect); @@ -2250,7 +2250,7 @@ CodeGenModule::GetAddrOfConstantStringFromLiteral(const StringLiteral *S) { llvm::Constant *C = GetConstantArrayFromStringLiteral(S); llvm::GlobalVariable *GV = new llvm::GlobalVariable(getModule(),C->getType(), - !Features.WritableStrings, + !LangOpts.WritableStrings, llvm::GlobalValue::PrivateLinkage, C,".str"); @@ -2306,7 +2306,7 @@ llvm::Constant *CodeGenModule::GetAddrOfConstantString(StringRef Str, GlobalName = ".str"; // Don't share any string literals if strings aren't constant. - if (Features.WritableStrings) + if (LangOpts.WritableStrings) return GenerateStringLiteral(Str, false, *this, GlobalName, Alignment); llvm::StringMapEntry &Entry = @@ -2530,7 +2530,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { case Decl::ObjCImplementation: { ObjCImplementationDecl *OMD = cast(D); - if (Features.ObjCNonFragileABI2 && OMD->hasSynthBitfield()) + if (LangOpts.ObjCNonFragileABI2 && OMD->hasSynthBitfield()) Context.ResetObjCLayout(OMD->getClassInterface()); EmitObjCPropertyImplementations(OMD); EmitObjCIvarInitializations(OMD); diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index be0727eaeeb7..8f9cdcd9a953 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -215,7 +215,7 @@ class CodeGenModule : public CodeGenTypeCache { typedef std::vector > CtorList; ASTContext &Context; - const LangOptions &Features; + const LangOptions &LangOpts; const CodeGenOptions &CodeGenOpts; llvm::Module &TheModule; const llvm::TargetData &TheTargetData; @@ -388,7 +388,7 @@ public: CGCXXABI &getCXXABI() { return ABI; } ARCEntrypoints &getARCEntrypoints() const { - assert(getLangOptions().ObjCAutoRefCount && ARCData != 0); + assert(getLangOpts().ObjCAutoRefCount && ARCData != 0); return *ARCData; } @@ -433,7 +433,7 @@ public: ASTContext &getContext() const { return Context; } const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; } - const LangOptions &getLangOptions() const { return Features; } + const LangOptions &getLangOpts() const { return LangOpts; } llvm::Module &getModule() const { return TheModule; } CodeGenTypes &getTypes() { return Types; } CodeGenVTables &getVTables() { return VTables; } diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 2ceb3fd2ebf4..b47da73c1d62 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -651,7 +651,7 @@ CodeGenTypes::getCGRecordLayout(const RecordDecl *RD) { bool CodeGenTypes::isZeroInitializable(QualType T) { // No need to check for member pointers when not compiling C++. - if (!Context.getLangOptions().CPlusPlus) + if (!Context.getLangOpts().CPlusPlus) return true; T = Context.getBaseElementType(T); diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 68f2f1df7256..6fcf83d5ace1 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -805,7 +805,7 @@ bool ItaniumCXXABI::NeedsArrayCookie(const CXXNewExpr *expr) { // Automatic Reference Counting: // We need an array cookie for pointers with strong or weak lifetime. QualType AllocatedType = expr->getAllocatedType(); - if (getContext().getLangOptions().ObjCAutoRefCount && + if (getContext().getLangOpts().ObjCAutoRefCount && AllocatedType->isObjCLifetimeType()) { switch (AllocatedType.getObjCLifetime()) { case Qualifiers::OCL_None: @@ -1071,7 +1071,7 @@ void ItaniumCXXABI::EmitGuardedInit(CodeGenFunction &CGF, // We only need to use thread-safe statics for local variables; // global initialization is always single-threaded. bool threadsafe = - (getContext().getLangOptions().ThreadsafeStatics && D.isLocalVarDecl()); + (getContext().getLangOpts().ThreadsafeStatics && D.isLocalVarDecl()); llvm::IntegerType *GuardTy; diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp index bcd3c0c5608a..ea2389e66b5a 100644 --- a/clang/lib/CodeGen/ModuleBuilder.cpp +++ b/clang/lib/CodeGen/ModuleBuilder.cpp @@ -79,7 +79,7 @@ namespace { // In C++, we may have member functions that need to be emitted at this // point. - if (Ctx->getLangOptions().CPlusPlus && !D->isDependentContext()) { + if (Ctx->getLangOpts().CPlusPlus && !D->isDependentContext()) { for (DeclContext::decl_iterator M = D->decls_begin(), MEnd = D->decls_end(); M != MEnd; ++M) diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 5950c539c303..3ed1778cc90f 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -2882,7 +2882,7 @@ void PTXABIInfo::computeInfo(CGFunctionInfo &FI) const { // Calling convention as default by an ABI. llvm::CallingConv::ID DefaultCC; - const LangOptions &LangOpts = getContext().getLangOptions(); + const LangOptions &LangOpts = getContext().getLangOpts(); if (LangOpts.OpenCL || LangOpts.CUDA) { // If we are in OpenCL or CUDA mode, then default to device functions DefaultCC = llvm::CallingConv::PTX_Device; @@ -2913,7 +2913,7 @@ void PTXTargetCodeGenInfo::SetTargetAttributes(const Decl *D, llvm::Function *F = cast(GV); // Perform special handling in OpenCL mode - if (M.getLangOptions().OpenCL) { + if (M.getLangOpts().OpenCL) { // Use OpenCL function attributes to set proper calling conventions // By default, all functions are device functions if (FD->hasAttr()) { @@ -2925,7 +2925,7 @@ void PTXTargetCodeGenInfo::SetTargetAttributes(const Decl *D, } // Perform special handling in CUDA mode. - if (M.getLangOptions().CUDA) { + if (M.getLangOpts().CUDA) { // CUDA __global__ functions get a kernel calling convention. Since // __global__ functions cannot be called from the device, we do not // need to set the noinline attribute. @@ -3420,7 +3420,7 @@ void TCETargetCodeGenInfo::SetTargetAttributes(const Decl *D, llvm::Function *F = cast(GV); - if (M.getLangOptions().OpenCL) { + if (M.getLangOpts().OpenCL) { if (FD->hasAttr()) { // OpenCL C Kernel functions are not subject to inlining F->addFnAttr(llvm::Attribute::NoInline); diff --git a/clang/lib/Edit/Commit.cpp b/clang/lib/Edit/Commit.cpp index e0250ccf0563..c45ee1f850af 100644 --- a/clang/lib/Edit/Commit.cpp +++ b/clang/lib/Edit/Commit.cpp @@ -36,7 +36,7 @@ CharSourceRange Commit::Edit::getInsertFromRange(SourceManager &SM) const { } Commit::Commit(EditedSource &Editor) - : SourceMgr(Editor.getSourceManager()), LangOpts(Editor.getLangOptions()), + : SourceMgr(Editor.getSourceManager()), LangOpts(Editor.getLangOpts()), PPRec(Editor.getPreprocessingRecord()), Editor(&Editor), IsCommitable(true) { } diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp index a09276803452..7cff6afeae26 100644 --- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp +++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp @@ -392,7 +392,7 @@ static bool getLiteralInfo(SourceRange literalRange, return false; StringRef text = Lexer::getSourceText( CharSourceRange::getTokenRange(literalRange), - Ctx.getSourceManager(), Ctx.getLangOptions()); + Ctx.getSourceManager(), Ctx.getLangOpts()); if (text.empty()) return false; diff --git a/clang/lib/Frontend/ASTMerge.cpp b/clang/lib/Frontend/ASTMerge.cpp index f3e6ea85be83..9feb3de4f0db 100644 --- a/clang/lib/Frontend/ASTMerge.cpp +++ b/clang/lib/Frontend/ASTMerge.cpp @@ -34,7 +34,7 @@ bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI, void ASTMergeAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); CI.getDiagnostics().getClient()->BeginSourceFile( - CI.getASTContext().getLangOptions()); + CI.getASTContext().getLangOpts()); CI.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument, &CI.getASTContext()); IntrusiveRefCntPtr diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 82e338278053..7514d8adc386 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -364,7 +364,7 @@ void ASTUnit::CacheCodeCompletionResults() { CachedResult.Completion = Results[I].CreateCodeCompletionString(*TheSema, *CachedCompletionAllocator); CachedResult.ShowInContexts = getDeclShowContexts(Results[I].Declaration, - Ctx->getLangOptions(), + Ctx->getLangOpts(), IsNestedNameSpecifier); CachedResult.Priority = Results[I].Priority; CachedResult.Kind = Results[I].CursorKind; @@ -397,7 +397,7 @@ void ASTUnit::CacheCodeCompletionResults() { CachedCompletionResults.push_back(CachedResult); /// Handle nested-name-specifiers in C++. - if (TheSema->Context.getLangOptions().CPlusPlus && + if (TheSema->Context.getLangOpts().CPlusPlus && IsNestedNameSpecifier && !Results[I].StartsNestedNameSpecifier) { // The contexts in which a nested-name-specifier can appear in C++. unsigned NNSContexts @@ -2033,7 +2033,7 @@ namespace { | (1LL << (CodeCompletionContext::CCC_ParenthesizedExpression - 1)) | (1LL << (CodeCompletionContext::CCC_Recovery - 1)); - if (AST.getASTContext().getLangOptions().CPlusPlus) + if (AST.getASTContext().getLangOpts().CPlusPlus) NormalContexts |= (1LL << (CodeCompletionContext::CCC_EnumTag - 1)) | (1LL << (CodeCompletionContext::CCC_UnionTag - 1)) | (1LL << (CodeCompletionContext::CCC_ClassOrStructTag - 1)); @@ -2124,7 +2124,7 @@ static void CalculateHiddenNames(const CodeCompletionContext &Context, unsigned HiddenIDNS = (Decl::IDNS_Type | Decl::IDNS_Member | Decl::IDNS_Namespace | Decl::IDNS_Ordinary | Decl::IDNS_NonMemberOperator); - if (Ctx.getLangOptions().CPlusPlus) + if (Ctx.getLangOpts().CPlusPlus) HiddenIDNS |= Decl::IDNS_Tag; Hiding = (IDNS & HiddenIDNS); } @@ -2184,7 +2184,7 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S, if (!Context.getPreferredType().isNull()) { if (C->Kind == CXCursor_MacroDefinition) { Priority = getMacroUsagePriority(C->Completion->getTypedText(), - S.getLangOptions(), + S.getLangOpts(), Context.getPreferredType()->isAnyPointerType()); } else if (C->Type) { CanQualType Expected diff --git a/clang/lib/Frontend/CacheTokens.cpp b/clang/lib/Frontend/CacheTokens.cpp index e74529d7e995..58a6b8d19e14 100644 --- a/clang/lib/Frontend/CacheTokens.cpp +++ b/clang/lib/Frontend/CacheTokens.cpp @@ -467,7 +467,7 @@ void PTHWriter::GeneratePTH(const std::string &MainFile) { // Iterate over all the files in SourceManager. Create a lexer // for each file and cache the tokens. SourceManager &SM = PP.getSourceManager(); - const LangOptions &LOpts = PP.getLangOptions(); + const LangOptions &LOpts = PP.getLangOpts(); for (SourceManager::fileinfo_iterator I = SM.fileinfo_begin(), E = SM.fileinfo_end(); I != E; ++I) { diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp index c46743d13f1c..dbb06bd23cdc 100644 --- a/clang/lib/Frontend/ChainedIncludesSource.cpp +++ b/clang/lib/Frontend/ChainedIncludesSource.cpp @@ -116,7 +116,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { if (firstInclude) { Preprocessor &PP = Clang->getPreprocessor(); PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(), - PP.getLangOptions()); + PP.getLangOpts()); } else { assert(!serialBufs.empty()); SmallVector bufs; diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index f687ccb22b4e..fccee89e06f5 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -284,7 +284,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!CI.hasASTContext() || !CI.getASTContext().getExternalSource()) { Preprocessor &PP = CI.getPreprocessor(); PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(), - PP.getLangOptions()); + PP.getLangOpts()); } // If there is a layout overrides file, attach an external AST source that diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index a4e168b702b6..737ee4a098bb 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -364,7 +364,7 @@ void DumpRawTokensAction::ExecuteAction() { // Start lexing the specified input file. const llvm::MemoryBuffer *FromFile = SM.getBuffer(SM.getMainFileID()); - Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOptions()); + Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOpts()); RawLex.SetKeepWhitespaceMode(true); Token RawTok; diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 2caab7c5dd36..37e89173abc6 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -632,7 +632,7 @@ void clang::InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &InitOpts, const HeaderSearchOptions &HSOpts, const FrontendOptions &FEOpts) { - const LangOptions &LangOpts = PP.getLangOptions(); + const LangOptions &LangOpts = PP.getLangOpts(); std::string PredefineBuffer; PredefineBuffer.reserve(4080); llvm::raw_string_ostream Predefines(PredefineBuffer); @@ -644,7 +644,7 @@ void clang::InitializePreprocessor(Preprocessor &PP, // Emit line markers for various builtin sections of the file. We don't do // this in asm preprocessor mode, because "# 4" is not a line marker directive // in this mode. - if (!PP.getLangOptions().AsmPreprocessor) + if (!PP.getLangOpts().AsmPreprocessor) Builder.append("# 1 \"\" 3"); // Install things like __POWERPC__, __GNUC__, etc into the macro table. @@ -669,12 +669,12 @@ void clang::InitializePreprocessor(Preprocessor &PP, // Even with predefines off, some macros are still predefined. // These should all be defined in the preprocessor according to the // current language configuration. - InitializeStandardPredefinedMacros(PP.getTargetInfo(), PP.getLangOptions(), + InitializeStandardPredefinedMacros(PP.getTargetInfo(), PP.getLangOpts(), FEOpts, Builder); // Add on the predefines from the driver. Wrap in a #line directive to report // that they come from the command line. - if (!PP.getLangOptions().AsmPreprocessor) + if (!PP.getLangOpts().AsmPreprocessor) Builder.append("# 1 \"\" 1"); // Process #define's and #undef's in the order they are given. @@ -702,7 +702,7 @@ void clang::InitializePreprocessor(Preprocessor &PP, } // Exit the command line and go back to (2 is LC_LEAVE). - if (!PP.getLangOptions().AsmPreprocessor) + if (!PP.getLangOpts().AsmPreprocessor) Builder.append("# 1 \"\" 2"); // Instruct the preprocessor to skip the preamble. @@ -714,6 +714,6 @@ void clang::InitializePreprocessor(Preprocessor &PP, // Initialize the header search object. ApplyHeaderSearchOptions(PP.getHeaderSearchInfo(), HSOpts, - PP.getLangOptions(), + PP.getLangOpts(), PP.getTargetInfo().getTriple()); } diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index f62ca579d109..9e1587c8fa2f 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -108,7 +108,7 @@ public: Initialized = false; // If we're in microsoft mode, use normal #line instead of line markers. - UseLineDirective = PP.getLangOptions().MicrosoftExt; + UseLineDirective = PP.getLangOpts().MicrosoftExt; } void SetEmittedTokensOnThisLine() { EmittedTokensOnThisLine = true; } diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp index 67bc5efa1a56..552282dafb34 100644 --- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -348,7 +348,7 @@ static void FindExpectedDiags(Preprocessor &PP, ExpectedData &ED, FileID FID) { SourceManager& SM = PP.getSourceManager(); // Create a lexer to lex all the tokens of the main file in raw mode. const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID); - Lexer RawLex(FID, FromFile, SM, PP.getLangOptions()); + Lexer RawLex(FID, FromFile, SM, PP.getLangOpts()); // Return comments as tokens, this is how we find expected diagnostics. RawLex.SetCommentRetentionState(true); diff --git a/clang/lib/Index/ASTLocation.cpp b/clang/lib/Index/ASTLocation.cpp index 2d5dc88f8466..fce6099dac2c 100644 --- a/clang/lib/Index/ASTLocation.cpp +++ b/clang/lib/Index/ASTLocation.cpp @@ -89,7 +89,7 @@ void ASTLocation::print(raw_ostream &OS) const { case N_Stmt: OS << "[Stmt: " << AsStmt()->getStmtClassName() << " "; - AsStmt()->printPretty(OS, Ctx, 0, PrintingPolicy(Ctx.getLangOptions())); + AsStmt()->printPretty(OS, Ctx, 0, PrintingPolicy(Ctx.getLangOpts())); break; case N_NamedRef: diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 0b342389a035..a49ab048f689 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -117,7 +117,7 @@ void Lexer::InitLexer(const char *BufStart, const char *BufPtr, Lexer::Lexer(FileID FID, const llvm::MemoryBuffer *InputFile, Preprocessor &PP) : PreprocessorLexer(&PP, FID), FileLoc(PP.getSourceManager().getLocForStartOfFile(FID)), - Features(PP.getLangOptions()) { + LangOpts(PP.getLangOpts()) { InitLexer(InputFile->getBufferStart(), InputFile->getBufferStart(), InputFile->getBufferEnd()); @@ -129,9 +129,9 @@ Lexer::Lexer(FileID FID, const llvm::MemoryBuffer *InputFile, Preprocessor &PP) /// Lexer constructor - Create a new raw lexer object. This object is only /// suitable for calls to 'LexRawToken'. This lexer assumes that the text /// range will outlive it, so it doesn't take ownership of it. -Lexer::Lexer(SourceLocation fileloc, const LangOptions &features, +Lexer::Lexer(SourceLocation fileloc, const LangOptions &langOpts, const char *BufStart, const char *BufPtr, const char *BufEnd) - : FileLoc(fileloc), Features(features) { + : FileLoc(fileloc), LangOpts(langOpts) { InitLexer(BufStart, BufPtr, BufEnd); @@ -143,8 +143,8 @@ Lexer::Lexer(SourceLocation fileloc, const LangOptions &features, /// suitable for calls to 'LexRawToken'. This lexer assumes that the text /// range will outlive it, so it doesn't take ownership of it. Lexer::Lexer(FileID FID, const llvm::MemoryBuffer *FromFile, - const SourceManager &SM, const LangOptions &features) - : FileLoc(SM.getLocForStartOfFile(FID)), Features(features) { + const SourceManager &SM, const LangOptions &langOpts) + : FileLoc(SM.getLocForStartOfFile(FID)), LangOpts(langOpts) { InitLexer(FromFile->getBufferStart(), FromFile->getBufferStart(), FromFile->getBufferEnd()); @@ -287,7 +287,7 @@ StringRef Lexer::getSpelling(SourceLocation loc, /// wants to get the true, uncanonicalized, spelling of things like digraphs /// UCNs, etc. std::string Lexer::getSpelling(const Token &Tok, const SourceManager &SourceMgr, - const LangOptions &Features, bool *Invalid) { + const LangOptions &LangOpts, bool *Invalid) { assert((int)Tok.getLength() >= 0 && "Token character range is bogus!"); // If this token contains nothing interesting, return it directly. @@ -309,7 +309,7 @@ std::string Lexer::getSpelling(const Token &Tok, const SourceManager &SourceMgr, for (const char *Ptr = TokStart, *End = TokStart+Tok.getLength(); Ptr != End; ) { unsigned CharSize; - Result.push_back(Lexer::getCharAndSizeNoWarn(Ptr, CharSize, Features)); + Result.push_back(Lexer::getCharAndSizeNoWarn(Ptr, CharSize, LangOpts)); Ptr += CharSize; } assert(Result.size() != unsigned(Tok.getLength()) && @@ -329,7 +329,7 @@ std::string Lexer::getSpelling(const Token &Tok, const SourceManager &SourceMgr, /// if an internal buffer is returned. unsigned Lexer::getSpelling(const Token &Tok, const char *&Buffer, const SourceManager &SourceMgr, - const LangOptions &Features, bool *Invalid) { + const LangOptions &LangOpts, bool *Invalid) { assert((int)Tok.getLength() >= 0 && "Token character range is bogus!"); const char *TokStart = 0; @@ -369,7 +369,7 @@ unsigned Lexer::getSpelling(const Token &Tok, const char *&Buffer, for (const char *Ptr = TokStart, *End = TokStart+Tok.getLength(); Ptr != End; ) { unsigned CharSize; - *OutBuf++ = Lexer::getCharAndSizeNoWarn(Ptr, CharSize, Features); + *OutBuf++ = Lexer::getCharAndSizeNoWarn(Ptr, CharSize, LangOpts); Ptr += CharSize; } assert(unsigned(OutBuf-Buffer) != Tok.getLength() && @@ -508,13 +508,13 @@ namespace { std::pair Lexer::ComputePreamble(const llvm::MemoryBuffer *Buffer, - const LangOptions &Features, unsigned MaxLines) { + const LangOptions &LangOpts, unsigned MaxLines) { // Create a lexer starting at the beginning of the file. Note that we use a // "fake" file source location at offset 1 so that the lexer will track our // position within the file. const unsigned StartOffset = 1; SourceLocation StartLoc = SourceLocation::getFromRawEncoding(StartOffset); - Lexer TheLexer(StartLoc, Features, Buffer->getBufferStart(), + Lexer TheLexer(StartLoc, LangOpts, Buffer->getBufferStart(), Buffer->getBufferStart(), Buffer->getBufferEnd()); bool InPreprocessorDirective = false; @@ -658,7 +658,7 @@ Lexer::ComputePreamble(const llvm::MemoryBuffer *Buffer, SourceLocation Lexer::AdvanceToTokenCharacter(SourceLocation TokStart, unsigned CharNo, const SourceManager &SM, - const LangOptions &Features) { + const LangOptions &LangOpts) { // Figure out how many physical characters away the specified expansion // character is. This needs to take into consideration newlines and // trigraphs. @@ -684,7 +684,7 @@ SourceLocation Lexer::AdvanceToTokenCharacter(SourceLocation TokStart, // lexer to parse it correctly. for (; CharNo; --CharNo) { unsigned Size; - Lexer::getCharAndSizeNoWarn(TokPtr, Size, Features); + Lexer::getCharAndSizeNoWarn(TokPtr, Size, LangOpts); TokPtr += Size; PhysOffset += Size; } @@ -716,16 +716,16 @@ SourceLocation Lexer::AdvanceToTokenCharacter(SourceLocation TokStart, /// a source location pointing to the last character in the token, etc. SourceLocation Lexer::getLocForEndOfToken(SourceLocation Loc, unsigned Offset, const SourceManager &SM, - const LangOptions &Features) { + const LangOptions &LangOpts) { if (Loc.isInvalid()) return SourceLocation(); if (Loc.isMacroID()) { - if (Offset > 0 || !isAtEndOfMacroExpansion(Loc, SM, Features, &Loc)) + if (Offset > 0 || !isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc)) return SourceLocation(); // Points inside the macro expansion. } - unsigned Len = Lexer::MeasureTokenLength(Loc, SM, Features); + unsigned Len = Lexer::MeasureTokenLength(Loc, SM, LangOpts); if (Len > Offset) Len = Len - Offset; else @@ -1212,7 +1212,7 @@ static char DecodeTrigraphChar(const char *CP, Lexer *L) { char Res = GetTrigraphCharForLetter(*CP); if (!Res || !L) return Res; - if (!L->getFeatures().Trigraphs) { + if (!L->getLangOpts().Trigraphs) { if (!L->isLexingRawMode()) L->Diag(CP-2, diag::trigraph_ignored); return 0; @@ -1405,7 +1405,7 @@ Slash: /// NOTE: When this method is updated, getCharAndSizeSlow (above) should /// be updated to match. char Lexer::getCharAndSizeSlowNoWarn(const char *Ptr, unsigned &Size, - const LangOptions &Features) { + const LangOptions &LangOpts) { // If we have a slash, look for an escaped newline. if (Ptr[0] == '\\') { ++Size; @@ -1427,7 +1427,7 @@ Slash: return ' '; // Use slow version to accumulate a correct size field. - return getCharAndSizeSlowNoWarn(Ptr, Size, Features); + return getCharAndSizeSlowNoWarn(Ptr, Size, LangOpts); } // Otherwise, this is not an escaped newline, just return the slash. @@ -1435,7 +1435,7 @@ Slash: } // If this is a trigraph, process it. - if (Features.Trigraphs && Ptr[0] == '?' && Ptr[1] == '?') { + if (LangOpts.Trigraphs && Ptr[0] == '?' && Ptr[1] == '?') { // If this is actually a legal trigraph (not something like "??x"), return // it. if (char C = GetTrigraphCharForLetter(Ptr[2])) { @@ -1478,7 +1478,7 @@ void Lexer::LexIdentifier(Token &Result, const char *CurPtr) { // // TODO: Could merge these checks into a CharInfo flag to make the comparison // cheaper - if (C != '\\' && C != '?' && (C != '$' || !Features.DollarIdents)) { + if (C != '\\' && C != '?' && (C != '$' || !LangOpts.DollarIdents)) { FinishIdentifier: const char *IdStart = BufferPtr; FormTokenWithChars(Result, CurPtr, tok::raw_identifier); @@ -1507,7 +1507,7 @@ FinishIdentifier: while (1) { if (C == '$') { // If we hit a $ and they are not supported in identifiers, we are done. - if (!Features.DollarIdents) goto FinishIdentifier; + if (!LangOpts.DollarIdents) goto FinishIdentifier; // Otherwise, emit a diagnostic and continue. if (!isLexingRawMode()) @@ -1533,12 +1533,12 @@ FinishIdentifier: /// isHexaLiteral - Return true if Start points to a hex constant. /// in microsoft mode (where this is supposed to be several different tokens). -static bool isHexaLiteral(const char *Start, const LangOptions &Features) { +static bool isHexaLiteral(const char *Start, const LangOptions &LangOpts) { unsigned Size; - char C1 = Lexer::getCharAndSizeNoWarn(Start, Size, Features); + char C1 = Lexer::getCharAndSizeNoWarn(Start, Size, LangOpts); if (C1 != '0') return false; - char C2 = Lexer::getCharAndSizeNoWarn(Start + Size, Size, Features); + char C2 = Lexer::getCharAndSizeNoWarn(Start + Size, Size, LangOpts); return (C2 == 'x' || C2 == 'X'); } @@ -1559,7 +1559,7 @@ void Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { if ((C == '-' || C == '+') && (PrevCh == 'E' || PrevCh == 'e')) { // If we are in Microsoft mode, don't continue if the constant is hex. // For example, MSVC will accept the following as 3 tokens: 0x1234567e+1 - if (!Features.MicrosoftExt || !isHexaLiteral(BufferPtr, Features)) + if (!LangOpts.MicrosoftExt || !isHexaLiteral(BufferPtr, LangOpts)) return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); } @@ -1576,13 +1576,13 @@ void Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { /// LexUDSuffix - Lex the ud-suffix production for user-defined literal suffixes /// in C++11, or warn on a ud-suffix in C++98. const char *Lexer::LexUDSuffix(Token &Result, const char *CurPtr) { - assert(getFeatures().CPlusPlus); + assert(getLangOpts().CPlusPlus); // Maximally munch an identifier. FIXME: UCNs. unsigned Size; char C = getCharAndSize(CurPtr, Size); if (isIdentifierHead(C)) { - if (!getFeatures().CPlusPlus0x) { + if (!getLangOpts().CPlusPlus0x) { if (!isLexingRawMode()) Diag(CurPtr, C == '_' ? diag::warn_cxx11_compat_user_defined_literal @@ -1632,7 +1632,7 @@ void Lexer::LexStringLiteral(Token &Result, const char *CurPtr, if (C == '\n' || C == '\r' || // Newline. (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. - if (!isLexingRawMode() && !Features.AsmPreprocessor) + if (!isLexingRawMode() && !LangOpts.AsmPreprocessor) Diag(BufferPtr, diag::warn_unterminated_string); FormTokenWithChars(Result, CurPtr-1, tok::unknown); return; @@ -1651,7 +1651,7 @@ void Lexer::LexStringLiteral(Token &Result, const char *CurPtr, } // If we are in C++11, lex the optional ud-suffix. - if (getFeatures().CPlusPlus) + if (getLangOpts().CPlusPlus) CurPtr = LexUDSuffix(Result, CurPtr); // If a nul character existed in the string, warn about it. @@ -1734,7 +1734,7 @@ void Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, } // If we are in C++11, lex the optional ud-suffix. - if (getFeatures().CPlusPlus) + if (getLangOpts().CPlusPlus) CurPtr = LexUDSuffix(Result, CurPtr); // Update the location of token as well as BufferPtr. @@ -1790,7 +1790,7 @@ void Lexer::LexCharConstant(Token &Result, const char *CurPtr, char C = getAndAdvanceChar(CurPtr, Result); if (C == '\'') { - if (!isLexingRawMode() && !Features.AsmPreprocessor) + if (!isLexingRawMode() && !LangOpts.AsmPreprocessor) Diag(BufferPtr, diag::err_empty_character); FormTokenWithChars(Result, CurPtr, tok::unknown); return; @@ -1804,7 +1804,7 @@ void Lexer::LexCharConstant(Token &Result, const char *CurPtr, C = getAndAdvanceChar(CurPtr, Result); } else if (C == '\n' || C == '\r' || // Newline. (C == 0 && CurPtr-1 == BufferEnd)) { // End of file. - if (!isLexingRawMode() && !Features.AsmPreprocessor) + if (!isLexingRawMode() && !LangOpts.AsmPreprocessor) Diag(BufferPtr, diag::warn_unterminated_char); FormTokenWithChars(Result, CurPtr-1, tok::unknown); return; @@ -1821,7 +1821,7 @@ void Lexer::LexCharConstant(Token &Result, const char *CurPtr, } // If we are in C++11, lex the optional ud-suffix. - if (getFeatures().CPlusPlus) + if (getLangOpts().CPlusPlus) CurPtr = LexUDSuffix(Result, CurPtr); // If a nul character existed in the character, warn about it. @@ -1889,12 +1889,12 @@ bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr) { bool Lexer::SkipBCPLComment(Token &Result, const char *CurPtr) { // If BCPL comments aren't explicitly enabled for this language, emit an // extension warning. - if (!Features.BCPLComment && !isLexingRawMode()) { + if (!LangOpts.BCPLComment && !isLexingRawMode()) { Diag(BufferPtr, diag::ext_bcpl_comment); // Mark them enabled so we only emit one warning for this translation // unit. - Features.BCPLComment = true; + LangOpts.BCPLComment = true; } // Scan over the body of the comment. The common case, when scanning, is that @@ -2081,7 +2081,7 @@ static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, // If no trigraphs are enabled, warn that we ignored this trigraph and // ignore this * character. - if (!L->getFeatures().Trigraphs) { + if (!L->getLangOpts().Trigraphs) { if (!L->isLexingRawMode()) L->Diag(CurPtr, diag::trigraph_ignored_block_comment); return false; @@ -2600,7 +2600,7 @@ LexNextToken: case 26: // DOS & CP/M EOF: "^Z". // If we're in Microsoft extensions mode, treat this as end of file. - if (Features.MicrosoftExt) { + if (LangOpts.MicrosoftExt) { // Read the PP instance variable into an automatic variable, because // LexEndOfFile will often delete 'this'. Preprocessor *PPCache = PP; @@ -2653,7 +2653,7 @@ LexNextToken: // If the next token is obviously a // or /* */ comment, skip it efficiently // too (without going through the big switch stmt). if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && - Features.BCPLComment && !Features.TraditionalCPP) { + LangOpts.BCPLComment && !LangOpts.TraditionalCPP) { if (SkipBCPLComment(Result, CurPtr+2)) return; // There is a token to return. goto SkipIgnoredUnits; @@ -2678,7 +2678,7 @@ LexNextToken: // Notify MIOpt that we read a non-whitespace/non-comment token. MIOpt.ReadToken(); - if (Features.CPlusPlus0x) { + if (LangOpts.CPlusPlus0x) { Char = getCharAndSize(CurPtr, SizeTmp); // UTF-16 string literal @@ -2730,7 +2730,7 @@ LexNextToken: // Notify MIOpt that we read a non-whitespace/non-comment token. MIOpt.ReadToken(); - if (Features.CPlusPlus0x) { + if (LangOpts.CPlusPlus0x) { Char = getCharAndSize(CurPtr, SizeTmp); // UTF-32 string literal @@ -2758,7 +2758,7 @@ LexNextToken: // Notify MIOpt that we read a non-whitespace/non-comment token. MIOpt.ReadToken(); - if (Features.CPlusPlus0x) { + if (LangOpts.CPlusPlus0x) { Char = getCharAndSize(CurPtr, SizeTmp); if (Char == '"') @@ -2781,7 +2781,7 @@ LexNextToken: tok::wide_string_literal); // Wide raw string literal. - if (Features.CPlusPlus0x && Char == 'R' && + if (LangOpts.CPlusPlus0x && Char == 'R' && getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == '"') return LexRawStringLiteral(Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), @@ -2809,7 +2809,7 @@ LexNextToken: return LexIdentifier(Result, CurPtr); case '$': // $ in identifiers. - if (Features.DollarIdents) { + if (LangOpts.DollarIdents) { if (!isLexingRawMode()) Diag(CurPtr-1, diag::ext_dollar_in_identifier); // Notify MIOpt that we read a non-whitespace/non-comment token. @@ -2861,7 +2861,7 @@ LexNextToken: MIOpt.ReadToken(); return LexNumericConstant(Result, ConsumeChar(CurPtr, SizeTmp, Result)); - } else if (Features.CPlusPlus && Char == '*') { + } else if (LangOpts.CPlusPlus && Char == '*') { Kind = tok::periodstar; CurPtr += SizeTmp; } else if (Char == '.' && @@ -2910,7 +2910,7 @@ LexNextToken: if (Char == '-') { // -- CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); Kind = tok::minusminus; - } else if (Char == '>' && Features.CPlusPlus && + } else if (Char == '>' && LangOpts.CPlusPlus && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '*') { // C++ ->* CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), SizeTmp2, Result); @@ -2948,9 +2948,9 @@ LexNextToken: // "foo". Check to see if the character after the second slash is a '*'. // If so, we will lex that as a "/" instead of the start of a comment. // However, we never do this in -traditional-cpp mode. - if ((Features.BCPLComment || + if ((LangOpts.BCPLComment || getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*') && - !Features.TraditionalCPP) { + !LangOpts.TraditionalCPP) { if (SkipBCPLComment(Result, ConsumeChar(CurPtr, SizeTmp, Result))) return; // There is a token to return. @@ -2979,17 +2979,17 @@ LexNextToken: if (Char == '=') { Kind = tok::percentequal; CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); - } else if (Features.Digraphs && Char == '>') { + } else if (LangOpts.Digraphs && Char == '>') { Kind = tok::r_brace; // '%>' -> '}' CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); - } else if (Features.Digraphs && Char == ':') { + } else if (LangOpts.Digraphs && Char == ':') { CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); Char = getCharAndSize(CurPtr, SizeTmp); if (Char == '%' && getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == ':') { Kind = tok::hashhash; // '%:%:' -> '##' CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), SizeTmp2, Result); - } else if (Char == '@' && Features.MicrosoftExt) {// %:@ -> #@ -> Charize + } else if (Char == '@' && LangOpts.MicrosoftExt) {// %:@ -> #@ -> Charize CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); if (!isLexingRawMode()) Diag(BufferPtr, diag::ext_charize_microsoft); @@ -3044,7 +3044,7 @@ LexNextToken: // If this is '<<<<' and we're in a Perforce-style conflict marker, // ignore it. goto LexNextToken; - } else if (Features.CUDA && After == '<') { + } else if (LangOpts.CUDA && After == '<') { Kind = tok::lesslessless; CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), SizeTmp2, Result); @@ -3055,8 +3055,8 @@ LexNextToken: } else if (Char == '=') { CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); Kind = tok::lessequal; - } else if (Features.Digraphs && Char == ':') { // '<:' -> '[' - if (Features.CPlusPlus0x && + } else if (LangOpts.Digraphs && Char == ':') { // '<:' -> '[' + if (LangOpts.CPlusPlus0x && getCharAndSize(CurPtr + SizeTmp, SizeTmp2) == ':') { // C++0x [lex.pptoken]p3: // Otherwise, if the next three characters are <:: and the subsequent @@ -3075,7 +3075,7 @@ LexNextToken: CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); Kind = tok::l_square; - } else if (Features.Digraphs && Char == '%') { // '<%' -> '{' + } else if (LangOpts.Digraphs && Char == '%') { // '<%' -> '{' CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); Kind = tok::l_brace; } else { @@ -3100,7 +3100,7 @@ LexNextToken: } else if (After == '>' && HandleEndOfConflictMarker(CurPtr-1)) { // If this is '>>>>>>>' and we're in a conflict marker, ignore it. goto LexNextToken; - } else if (Features.CUDA && After == '>') { + } else if (LangOpts.CUDA && After == '>') { Kind = tok::greatergreatergreater; CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), SizeTmp2, Result); @@ -3139,10 +3139,10 @@ LexNextToken: break; case ':': Char = getCharAndSize(CurPtr, SizeTmp); - if (Features.Digraphs && Char == '>') { + if (LangOpts.Digraphs && Char == '>') { Kind = tok::r_square; // ':>' -> ']' CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); - } else if (Features.CPlusPlus && Char == ':') { + } else if (LangOpts.CPlusPlus && Char == ':') { Kind = tok::coloncolon; CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); } else { @@ -3173,7 +3173,7 @@ LexNextToken: if (Char == '#') { Kind = tok::hashhash; CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); - } else if (Char == '@' && Features.MicrosoftExt) { // #@ -> Charize + } else if (Char == '@' && LangOpts.MicrosoftExt) { // #@ -> Charize Kind = tok::hashat; if (!isLexingRawMode()) Diag(BufferPtr, diag::ext_charize_microsoft); @@ -3209,7 +3209,7 @@ LexNextToken: case '@': // Objective C support. - if (CurPtr[-1] == '@' && Features.ObjC1) + if (CurPtr[-1] == '@' && LangOpts.ObjC1) Kind = tok::at; else Kind = tok::unknown; diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index ae8157dabf65..c1d228b87989 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -482,7 +482,7 @@ NumericLiteralParser(const char *begin, const char *end, continue; // Success. case 'i': case 'I': - if (PP.getLangOptions().MicrosoftExt) { + if (PP.getLangOpts().MicrosoftExt) { if (isFPConstant || isLong || isLongLong) break; // Allow i8, i16, i32, i64, and i128. @@ -542,7 +542,7 @@ NumericLiteralParser(const char *begin, const char *end, } if (s != ThisTokEnd) { - if (PP.getLangOptions().CPlusPlus0x && s == SuffixBegin && *s == '_') { + if (PP.getLangOpts().CPlusPlus0x && s == SuffixBegin && *s == '_') { // We have a ud-suffix! By C++11 [lex.ext]p10, ud-suffixes not starting // with an '_' are ill-formed. saw_ud_suffix = true; @@ -608,7 +608,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { } s = first_non_digit; - if (!PP.getLangOptions().HexFloats) + if (!PP.getLangOpts().HexFloats) PP.Diag(TokLoc, diag::ext_hexconstant_invalid); } else if (saw_period) { PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin), @@ -902,7 +902,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, unsigned short UcnLen = 0; if (!ProcessUCNEscape(TokBegin, begin, end, *buffer_begin, UcnLen, FullSourceLoc(Loc, PP.getSourceManager()), - &PP.getDiagnostics(), PP.getLangOptions(), + &PP.getDiagnostics(), PP.getLangOpts(), true)) { HadError = true; @@ -967,7 +967,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, // character constants are not sign extended in the this implementation: // '\xFF\xFF' = 65536 and '\x0\xFF' = 255, which matches GCC. if (isAscii() && NumCharsSoFar == 1 && (Value & 128) && - PP.getLangOptions().CharIsSigned) + PP.getLangOpts().CharIsSigned) Value = (signed char)Value; } @@ -1027,7 +1027,7 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end, StringLiteralParser:: StringLiteralParser(const Token *StringToks, unsigned NumStringToks, Preprocessor &PP, bool Complain) - : SM(PP.getSourceManager()), Features(PP.getLangOptions()), + : SM(PP.getSourceManager()), Features(PP.getLangOpts()), Target(PP.getTargetInfo()), Diags(Complain ? &PP.getDiagnostics() : 0), MaxTokenLength(0), SizeBound(0), CharByteWidth(0), Kind(tok::unknown), ResultPtr(ResultBuf.data()), hadError(false), Pascal(false) { diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 7345ef219736..53bb5c354e95 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -124,7 +124,7 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) { const IdentifierInfo &Info = Identifiers.get(Spelling); // Allow #defining |and| and friends in microsoft mode. - if (Info.isCPlusPlusOperatorKeyword() && getLangOptions().MicrosoftMode) { + if (Info.isCPlusPlusOperatorKeyword() && getLangOpts().MicrosoftMode) { MacroNameTok.setIdentifierInfo(getIdentifierInfo(Spelling)); return; } @@ -181,7 +181,7 @@ void Preprocessor::CheckEndOfDirective(const char *DirType, bool EnableMacros) { // trouble than it is worth to insert /**/ and check that there is no /**/ // in the range also. FixItHint Hint; - if ((Features.GNUMode || Features.C99 || Features.CPlusPlus) && + if ((LangOpts.GNUMode || LangOpts.C99 || LangOpts.CPlusPlus) && !CurTokenLexer) Hint = FixItHint::CreateInsertion(Tmp.getLocation(),"//"); Diag(Tmp, diag::ext_pp_extra_tokens_at_eol) << DirType << Hint; @@ -619,7 +619,7 @@ TryAgain: setCodeCompletionReached(); return; case tok::numeric_constant: // # 7 GNU line marker directive. - if (getLangOptions().AsmPreprocessor) + if (getLangOpts().AsmPreprocessor) break; // # 4 is not a preprocessor directive in .S files. return HandleDigitDirective(Result); default: @@ -690,12 +690,12 @@ TryAgain: break; case tok::pp___public_macro: - if (getLangOptions().Modules) + if (getLangOpts().Modules) return HandleMacroPublicDirective(Result); break; case tok::pp___private_macro: - if (getLangOptions().Modules) + if (getLangOpts().Modules) return HandleMacroPrivateDirective(Result); break; } @@ -706,7 +706,7 @@ TryAgain: // directives. This is important because # may be a comment or introduce // various pseudo-ops. Just return the # token and push back the following // token to be lexed next time. - if (getLangOptions().AsmPreprocessor) { + if (getLangOpts().AsmPreprocessor) { Token *Toks = new Token[2]; // Return the # and the token after it. Toks[0] = SavedHash; @@ -805,11 +805,11 @@ void Preprocessor::HandleLineDirective(Token &Tok) { // Enforce C99 6.10.4p3: "The digit sequence shall not specify ... a // number greater than 2147483647". C90 requires that the line # be <= 32767. unsigned LineLimit = 32768U; - if (Features.C99 || Features.CPlusPlus0x) + if (LangOpts.C99 || LangOpts.CPlusPlus0x) LineLimit = 2147483648U; if (LineNo >= LineLimit) Diag(DigitTok, diag::ext_pp_line_too_big) << LineLimit; - else if (Features.CPlusPlus0x && LineNo >= 32768U) + else if (LangOpts.CPlusPlus0x && LineNo >= 32768U) Diag(DigitTok, diag::warn_cxx98_compat_pp_line_too_big); int FilenameID = -1; @@ -1334,7 +1334,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, const FileEntry *File = LookupFile( Filename, isAngled, LookupFrom, CurDir, Callbacks ? &SearchPath : NULL, Callbacks ? &RelativePath : NULL, - getLangOptions().Modules? &SuggestedModule : 0); + getLangOpts().Modules? &SuggestedModule : 0); if (Callbacks) { if (!File) { @@ -1348,7 +1348,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // Try the lookup again, skipping the cache. File = LookupFile(Filename, isAngled, LookupFrom, CurDir, 0, 0, - getLangOptions().Modules? &SuggestedModule : 0, + getLangOpts().Modules? &SuggestedModule : 0, /*SkipCache*/true); } } @@ -1410,9 +1410,9 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // Determine whether we are actually building the module that this // include directive maps to. bool BuildingImportedModule - = Path[0].first->getName() == getLangOptions().CurrentModule; + = Path[0].first->getName() == getLangOpts().CurrentModule; - if (!BuildingImportedModule && getLangOptions().ObjC2) { + if (!BuildingImportedModule && getLangOpts().ObjC2) { // If we're not building the imported module, warn that we're going // to automatically turn this inclusion directive into a module import. // We only do this in Objective-C, where we have a module-import syntax. @@ -1488,7 +1488,7 @@ void Preprocessor::HandleIncludeNextDirective(SourceLocation HashLoc, /// void Preprocessor::HandleImportDirective(SourceLocation HashLoc, Token &ImportTok) { - if (!Features.ObjC1) // #import is standard for ObjC. + if (!LangOpts.ObjC1) // #import is standard for ObjC. Diag(ImportTok, diag::ext_pp_import_directive); return HandleIncludeDirective(HashLoc, ImportTok, 0, true); @@ -1544,8 +1544,8 @@ bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) { Diag(Tok, diag::err_pp_expected_ident_in_arg_list); return true; case tok::ellipsis: // #define X(... -> C99 varargs - if (!Features.C99) - Diag(Tok, Features.CPlusPlus0x ? + if (!LangOpts.C99) + Diag(Tok, LangOpts.CPlusPlus0x ? diag::warn_cxx98_compat_variadic_macro : diag::ext_variadic_macro); @@ -1671,7 +1671,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { // Read the first token after the arg list for down below. LexUnexpandedToken(Tok); - } else if (Features.C99 || Features.CPlusPlus0x) { + } else if (LangOpts.C99 || LangOpts.CPlusPlus0x) { // C99 requires whitespace between the macro definition and the body. Emit // a diagnostic for something like "#define X+". Diag(Tok, diag::ext_c99_whitespace_required_after_macro_name); @@ -1736,7 +1736,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { // the '#' because '#' is often a comment character. However, change // the kind of the token to tok::unknown so that the preprocessor isn't // confused. - if (getLangOptions().AsmPreprocessor && Tok.isNot(tok::eod)) { + if (getLangOpts().AsmPreprocessor && Tok.isNot(tok::eod)) { LastTok.setKind(tok::unknown); } else { Diag(Tok, diag::err_pp_stringize_not_parameter); diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp index ae2f5c1ab234..7cac63eb0f53 100644 --- a/clang/lib/Lex/PPExpressions.cpp +++ b/clang/lib/Lex/PPExpressions.cpp @@ -220,8 +220,8 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, PP.Diag(PeekTok, diag::err_pp_invalid_udl) << /*integer*/1; // long long is a C99 feature. - if (!PP.getLangOptions().C99 && Literal.isLongLong) - PP.Diag(PeekTok, PP.getLangOptions().CPlusPlus0x ? + if (!PP.getLangOpts().C99 && Literal.isLongLong) + PP.Diag(PeekTok, PP.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_longlong : diag::ext_longlong); // Parse the integer literal into Result. @@ -290,7 +290,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, Val = Literal.getValue(); // Set the signedness. UTF-16 and UTF-32 are always unsigned if (!Literal.isUTF16() && !Literal.isUTF32()) - Val.setIsUnsigned(!PP.getLangOptions().CharIsSigned); + Val.setIsUnsigned(!PP.getLangOpts().CharIsSigned); if (Result.Val.getBitWidth() > Val.getBitWidth()) { Result.Val = Val.extend(Result.Val.getBitWidth()); @@ -654,7 +654,7 @@ static bool EvaluateDirectiveSubExpr(PPValue &LHS, unsigned MinPrec, case tok::comma: // Comma is invalid in pp expressions in c89/c++ mode, but is valid in C99 // if not being evaluated. - if (!PP.getLangOptions().C99 || ValueLive) + if (!PP.getLangOpts().C99 || ValueLive) PP.Diag(OpLoc, diag::ext_pp_comma_expr) << LHS.getRange() << RHS.getRange(); Res = RHS.Val; // LHS = LHS,RHS -> RHS. diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 26e0ffb5d417..bc04bc95a7f5 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -101,7 +101,7 @@ void Preprocessor::RegisterBuiltinMacros() { Ident__has_warning = RegisterBuiltinMacro(*this, "__has_warning"); // Microsoft Extensions. - if (Features.MicrosoftExt) + if (LangOpts.MicrosoftExt) Ident__pragma = RegisterBuiltinMacro(*this, "__pragma"); else Ident__pragma = 0; @@ -433,8 +433,8 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName, // Empty arguments are standard in C99 and C++0x, and are supported as an extension in // other modes. - if (ArgTokens.size() == ArgTokenStart && !Features.C99) - Diag(Tok, Features.CPlusPlus0x ? + if (ArgTokens.size() == ArgTokenStart && !LangOpts.C99) + Diag(Tok, LangOpts.CPlusPlus0x ? diag::warn_cxx98_compat_empty_fnmacro_arg : diag::ext_empty_fnmacro_arg); @@ -588,7 +588,7 @@ static void ComputeDATE_TIME(SourceLocation &DATELoc, SourceLocation &TIMELoc, /// HasFeature - Return true if we recognize and implement the feature /// specified by the identifier as a standard language feature. static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { - const LangOptions &LangOpts = PP.getLangOptions(); + const LangOptions &LangOpts = PP.getLangOpts(); StringRef Feature = II->getName(); // Normalize the feature name, __foo__ becomes foo. @@ -732,7 +732,7 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) { DiagnosticsEngine::Ext_Error) return false; - const LangOptions &LangOpts = PP.getLangOptions(); + const LangOptions &LangOpts = PP.getLangOpts(); StringRef Extension = II->getName(); // Normalize the extension name, __foo__ becomes foo. diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 404feaab46f7..5d65cc4f23b1 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -1230,7 +1230,7 @@ void Preprocessor::RegisterBuiltinPragmas() { AddPragmaHandler("STDC", new PragmaSTDC_UnknownHandler()); // MS extensions. - if (Features.MicrosoftExt) { + if (LangOpts.MicrosoftExt) { AddPragmaHandler(new PragmaCommentHandler()); AddPragmaHandler(new PragmaIncludeAliasHandler()); } diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 06914c7cdcc9..6142436e6d19 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -55,7 +55,7 @@ Preprocessor::Preprocessor(DiagnosticsEngine &diags, LangOptions &opts, IdentifierInfoLookup* IILookup, bool OwnsHeaders, bool DelayInitialization) - : Diags(&diags), Features(opts), Target(target),FileMgr(Headers.getFileMgr()), + : Diags(&diags), LangOpts(opts), Target(target),FileMgr(Headers.getFileMgr()), SourceMgr(SM), HeaderInfo(Headers), TheModuleLoader(TheModuleLoader), ExternalSource(0), Identifiers(opts, IILookup), CodeComplete(0), @@ -153,7 +153,7 @@ void Preprocessor::Initialize(const TargetInfo &Target) { // Initialize builtin macros like __LINE__ and friends. RegisterBuiltinMacros(); - if(Features.Borland) { + if(LangOpts.Borland) { Ident__exception_info = getIdentifierInfo("_exception_info"); Ident___exception_info = getIdentifierInfo("__exception_info"); Ident_GetExceptionInfo = getIdentifierInfo("GetExceptionInformation"); @@ -382,10 +382,10 @@ void Preprocessor::CreateString(const char *Buf, unsigned Len, Token &Tok, } Module *Preprocessor::getCurrentModule() { - if (getLangOptions().CurrentModule.empty()) + if (getLangOpts().CurrentModule.empty()) return 0; - return getHeaderSearchInfo().lookupModule(getLangOptions().CurrentModule); + return getHeaderSearchInfo().lookupModule(getLangOpts().CurrentModule); } //===----------------------------------------------------------------------===// @@ -572,7 +572,7 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { // keyword when we're in a caching lexer, because caching lexers only get // used in contexts where import declarations are disallowed. if (II.isModulesImport() && !InMacroArgs && !DisableMacroExpansion && - getLangOptions().Modules && CurLexerKind != CLK_CachingLexer) { + getLangOpts().Modules && CurLexerKind != CLK_CachingLexer) { ModuleImportLoc = Identifier.getLocation(); ModuleImportPath.clear(); ModuleImportExpectsIdentifier = true; diff --git a/clang/lib/Lex/TokenConcatenation.cpp b/clang/lib/Lex/TokenConcatenation.cpp index ca7e55d863c0..84a46ed3779b 100644 --- a/clang/lib/Lex/TokenConcatenation.cpp +++ b/clang/lib/Lex/TokenConcatenation.cpp @@ -45,7 +45,7 @@ static bool IsStringPrefix(StringRef Str, bool CPlusPlus0x) { /// IsIdentifierStringPrefix - Return true if the spelling of the token /// is literally 'L', 'u', 'U', or 'u8'. Including raw versions. bool TokenConcatenation::IsIdentifierStringPrefix(const Token &Tok) const { - const LangOptions &LangOpts = PP.getLangOptions(); + const LangOptions &LangOpts = PP.getLangOpts(); if (!Tok.needsCleaning()) { if (Tok.getLength() < 1 || Tok.getLength() > 3) @@ -86,7 +86,7 @@ TokenConcatenation::TokenConcatenation(Preprocessor &pp) : PP(pp) { TokenInfo[tok::arrow ] |= aci_custom_firstchar; // These tokens have custom code in C++11 mode. - if (PP.getLangOptions().CPlusPlus0x) { + if (PP.getLangOpts().CPlusPlus0x) { TokenInfo[tok::string_literal ] |= aci_custom; TokenInfo[tok::wide_string_literal ] |= aci_custom; TokenInfo[tok::utf8_string_literal ] |= aci_custom; @@ -205,7 +205,7 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, case tok::wide_char_constant: case tok::utf16_char_constant: case tok::utf32_char_constant: - if (!PP.getLangOptions().CPlusPlus0x) + if (!PP.getLangOpts().CPlusPlus0x) return false; // In C++11, a string or character literal followed by an identifier is a @@ -240,11 +240,11 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, case tok::numeric_constant: return isalnum(FirstChar) || Tok.is(tok::numeric_constant) || FirstChar == '+' || FirstChar == '-' || FirstChar == '.' || - (PP.getLangOptions().CPlusPlus0x && FirstChar == '_'); + (PP.getLangOpts().CPlusPlus0x && FirstChar == '_'); case tok::period: // ..., .*, .1234 return (FirstChar == '.' && PrevPrevTok.is(tok::period)) || isdigit(FirstChar) || - (PP.getLangOptions().CPlusPlus && FirstChar == '*'); + (PP.getLangOpts().CPlusPlus && FirstChar == '*'); case tok::amp: // && return FirstChar == '&'; case tok::plus: // ++ @@ -263,10 +263,10 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, return FirstChar == '>' || FirstChar == ':'; case tok::colon: // ::, :> return FirstChar == '>' || - (PP.getLangOptions().CPlusPlus && FirstChar == ':'); + (PP.getLangOpts().CPlusPlus && FirstChar == ':'); case tok::hash: // ##, #@, %:%: return FirstChar == '#' || FirstChar == '@' || FirstChar == '%'; case tok::arrow: // ->* - return PP.getLangOptions().CPlusPlus && FirstChar == '*'; + return PP.getLangOpts().CPlusPlus && FirstChar == '*'; } } diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index 5102cce3c8b8..696754c74167 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -527,7 +527,7 @@ bool TokenLexer::PasteTokens(Token &Tok) { // Make a lexer to lex this string from. Lex just this one token. // Make a lexer object so that we lex and expand the paste result. Lexer TL(SourceMgr.getLocForStartOfFile(LocFileID), - PP.getLangOptions(), ScratchBufStart, + PP.getLangOpts(), ScratchBufStart, ResultTokStrPtr, ResultTokStrPtr+LHSLen+RHSLen); // Lex a token in raw mode. This way it won't look up identifiers @@ -546,14 +546,14 @@ bool TokenLexer::PasteTokens(Token &Tok) { if (isInvalid) { // Test for the Microsoft extension of /##/ turning into // here on the // error path. - if (PP.getLangOptions().MicrosoftExt && Tok.is(tok::slash) && + if (PP.getLangOpts().MicrosoftExt && Tok.is(tok::slash) && RHS.is(tok::slash)) { HandleMicrosoftCommentPaste(Tok); return true; } // Do not emit the error when preprocessing assembler code. - if (!PP.getLangOptions().AsmPreprocessor) { + if (!PP.getLangOpts().AsmPreprocessor) { // Explicitly convert the token location to have proper expansion // information so that the user knows where it came from. SourceManager &SM = PP.getSourceManager(); @@ -563,7 +563,7 @@ bool TokenLexer::PasteTokens(Token &Tok) { // error to a warning that defaults to an error. This allows // disabling it. PP.Diag(Loc, - PP.getLangOptions().MicrosoftExt ? diag::err_pp_bad_paste_ms + PP.getLangOpts().MicrosoftExt ? diag::err_pp_bad_paste_ms : diag::err_pp_bad_paste) << Buffer.str(); } diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 6fe33f4860de..7ee74ecc7696 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -74,7 +74,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, bool Delete = false; SourceLocation KWLoc; if (Tok.is(tok::kw_delete)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_deleted_function : diag::ext_deleted_function); @@ -82,7 +82,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Actions.SetDeclDeleted(FnD, KWLoc); Delete = true; } else if (Tok.is(tok::kw_default)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_defaulted_function : diag::ext_defaulted_function); @@ -107,7 +107,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, // In delayed template parsing mode, if we are within a class template // or if we are about to parse function member template then consume // the tokens and store them for parsing at the end of the translation unit. - if (getLang().DelayedTemplateParsing && + if (getLangOpts().DelayedTemplateParsing && ((Actions.CurContext->isDependentContext() || TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) && !Actions.IsInsideALocalClassWithinATemplateFunction())) { @@ -632,7 +632,7 @@ bool Parser::ConsumeAndStoreFunctionPrologue(CachedTokens &Toks) { ConsumeBrace(); // In C++03, this has to be the start of the function body, which // means the initializer is malformed; we'll diagnose it later. - if (!getLang().CPlusPlus0x) + if (!getLangOpts().CPlusPlus0x) return false; } diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 2eb66d50d821..12866b91272b 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -934,7 +934,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(StmtVector &Stmts, break; case tok::kw_inline: // Could be the start of an inline namespace. Allowed as an ext in C++03. - if (getLang().CPlusPlus && NextToken().is(tok::kw_namespace)) { + if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_namespace)) { ProhibitAttributes(attrs); SourceLocation InlineLoc = ConsumeToken(); SingleDecl = ParseNamespace(Context, DeclEnd, InlineLoc); @@ -1023,14 +1023,14 @@ bool Parser::MightBeDeclarator(unsigned Context) { case tok::amp: case tok::ampamp: - return getLang().CPlusPlus; + return getLangOpts().CPlusPlus; case tok::l_square: // Might be an attribute on an unnamed bit-field. - return Context == Declarator::MemberContext && getLang().CPlusPlus0x && + return Context == Declarator::MemberContext && getLangOpts().CPlusPlus0x && NextToken().is(tok::l_square); case tok::colon: // Might be a typo for '::' or an unnamed bit-field. - return Context == Declarator::MemberContext || getLang().CPlusPlus; + return Context == Declarator::MemberContext || getLangOpts().CPlusPlus; case tok::identifier: switch (NextToken().getKind()) { @@ -1057,10 +1057,10 @@ bool Parser::MightBeDeclarator(unsigned Context) { // and in block scope it's probably a label. Inside a class definition, // this is a bit-field. return Context == Declarator::MemberContext || - (getLang().CPlusPlus && Context == Declarator::FileContext); + (getLangOpts().CPlusPlus && Context == Declarator::FileContext); case tok::identifier: // Possible virt-specifier. - return getLang().CPlusPlus0x && isCXX0XVirtSpecifier(NextToken()); + return getLangOpts().CPlusPlus0x && isCXX0XVirtSpecifier(NextToken()); default: return false; @@ -1324,7 +1324,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, else Diag(ConsumeToken(), diag::err_default_special_members); } else { - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { EnterScope(0); Actions.ActOnCXXEnterDeclInitializer(getCurScope(), ThisDecl); } @@ -1337,7 +1337,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, ExprResult Init(ParseInitializer()); - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl); ExitScope(); } @@ -1357,7 +1357,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, ExprVector Exprs(Actions); CommaLocsTy CommaLocs; - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { EnterScope(0); Actions.ActOnCXXEnterDeclInitializer(getCurScope(), ThisDecl); } @@ -1365,7 +1365,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, if (ParseExpressionList(Exprs, CommaLocs)) { SkipUntil(tok::r_paren); - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl); ExitScope(); } @@ -1376,7 +1376,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, assert(!Exprs.empty() && Exprs.size()-1 == CommaLocs.size() && "Unexpected number of commas!"); - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl); ExitScope(); } @@ -1387,7 +1387,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, Actions.AddInitializerToDecl(ThisDecl, Initializer.take(), /*DirectInit=*/true, TypeContainsAuto); } - } else if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + } else if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { // Parse C++0x braced-init-list. Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); @@ -1544,7 +1544,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, if (TagName) { Diag(Loc, diag::err_use_of_tag_name_without_tag) - << Tok.getIdentifierInfo() << TagName << getLang().CPlusPlus + << Tok.getIdentifierInfo() << TagName << getLangOpts().CPlusPlus << FixItHint::CreateInsertion(Tok.getLocation(),FixitTagName); // Parse this as a tag as if the missing tag were present. @@ -1632,7 +1632,7 @@ ExprResult Parser::ParseAlignArgument(SourceLocation Start, } else ER = ParseConstantExpression(); - if (getLang().CPlusPlus0x && Tok.is(tok::ellipsis)) + if (getLangOpts().CPlusPlus0x && Tok.is(tok::ellipsis)) EllipsisLoc = ConsumeToken(); return ER; @@ -1930,7 +1930,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // Objective-C supports syntax of the form 'id' where 'id' // is a specific typedef and 'itf' where 'itf' is an // Objective-C interface. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); continue; @@ -1959,7 +1959,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, case tok::identifier: { // In C++, check to see if this is a scope specifier like foo::bar::, if // so handle it as such. This is important for ctor parsing. - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (TryAnnotateCXXScopeToken(true)) { if (!DS.hasTypeSpecifier()) DS.SetTypeSpecError(); @@ -1993,7 +1993,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // If we're in a context where the identifier could be a class name, // check whether this is a constructor declaration. - if (getLang().CPlusPlus && DSContext == DSC_class && + if (getLangOpts().CPlusPlus && DSContext == DSC_class && Actions.isCurrentClassName(*Tok.getIdentifierInfo(), getCurScope()) && isConstructorDeclarator()) goto DoneWithDeclSpec; @@ -2009,7 +2009,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // Objective-C supports syntax of the form 'id' where 'id' // is a specific typedef and 'itf' where 'itf' is an // Objective-C interface. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); // Need to support trailing type qualifiers (e.g. "id

const"). @@ -2029,7 +2029,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // If we're in a context where the template-id could be a // constructor name or specialization, check whether this is a // constructor declaration. - if (getLang().CPlusPlus && DSContext == DSC_class && + if (getLangOpts().CPlusPlus && DSContext == DSC_class && Actions.isCurrentClassName(*TemplateId->Name, getCurScope()) && isConstructorDeclarator()) goto DoneWithDeclSpec; @@ -2098,7 +2098,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, PrevSpec, DiagID); break; case tok::kw_auto: - if (getLang().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { if (isKnownToBeTypeSpecifier(GetLookAheadToken(1))) { isInvalid = DS.SetStorageClassSpec(Actions, DeclSpec::SCS_auto, Loc, PrevSpec, DiagID); @@ -2137,7 +2137,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // alignment-specifier case tok::kw__Alignas: - if (!getLang().C11) + if (!getLangOpts().C11) Diag(Tok, diag::ext_c11_alignas); ParseAlignmentSpecifier(DS.getAttributes()); continue; @@ -2289,15 +2289,15 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // cv-qualifier: case tok::kw_const: isInvalid = DS.SetTypeQual(DeclSpec::TQ_const, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_volatile: isInvalid = DS.SetTypeQual(DeclSpec::TQ_volatile, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_restrict: isInvalid = DS.SetTypeQual(DeclSpec::TQ_restrict, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; // C++ typename-specifier: @@ -2329,7 +2329,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // OpenCL qualifiers: case tok::kw_private: - if (!getLang().OpenCL) + if (!getLangOpts().OpenCL) goto DoneWithDeclSpec; case tok::kw___private: case tok::kw___global: @@ -2345,7 +2345,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // GCC ObjC supports types like "" as a synonym for // "id". This is hopelessly old fashioned and dangerous, // but we support it. - if (DS.hasTypeSpecifier() || !getLang().ObjC1) + if (DS.hasTypeSpecifier() || !getLangOpts().ObjC1) goto DoneWithDeclSpec; if (!ParseObjCProtocolQualifiers(DS)) @@ -2476,7 +2476,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // is a specific typedef and 'itf' where 'itf' is an // Objective-C interface. If we don't have Objective-C or a '<', this is // just a normal reference to a typedef name. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); return true; @@ -2583,15 +2583,15 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // cv-qualifier: case tok::kw_const: isInvalid = DS.SetTypeQual(DeclSpec::TQ_const , Loc, PrevSpec, - DiagID, getLang()); + DiagID, getLangOpts()); break; case tok::kw_volatile: isInvalid = DS.SetTypeQual(DeclSpec::TQ_volatile, Loc, PrevSpec, - DiagID, getLang()); + DiagID, getLangOpts()); break; case tok::kw_restrict: isInvalid = DS.SetTypeQual(DeclSpec::TQ_restrict, Loc, PrevSpec, - DiagID, getLang()); + DiagID, getLangOpts()); break; // GNU typeof support. @@ -2615,7 +2615,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // OpenCL qualifiers: case tok::kw_private: - if (!getLang().OpenCL) + if (!getLangOpts().OpenCL) return false; case tok::kw___private: case tok::kw___global: @@ -2633,7 +2633,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // illegal, so we can assume an auto type specifier was intended even in // C++98. In C++98 mode, DeclSpec::Finish will produce an appropriate // extension diagnostic. - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; isInvalid = DS.SetTypeSpecType(DeclSpec::TST_auto, Loc, PrevSpec, DiagID); @@ -2779,7 +2779,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, // Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in // C++. - if (Tok.is(tok::r_brace) && !getLang().CPlusPlus) { + if (Tok.is(tok::r_brace) && !getLangOpts().CPlusPlus) { Diag(Tok, diag::ext_empty_struct_union) << (TagType == TST_union); Diag(Tok, diag::warn_empty_struct_union_compat) << (TagType == TST_union); } @@ -2916,7 +2916,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, SourceLocation ScopedEnumKWLoc; bool IsScopedUsingClassTag = false; - if (getLang().CPlusPlus0x && + if (getLangOpts().CPlusPlus0x && (Tok.is(tok::kw_class) || Tok.is(tok::kw_struct))) { Diag(Tok, diag::warn_cxx98_compat_scoped_enum); IsScopedUsingClassTag = Tok.is(tok::kw_class); @@ -2932,10 +2932,10 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, ParseMicrosoftDeclSpec(attrs); bool AllowFixedUnderlyingType - = getLang().CPlusPlus0x || getLang().MicrosoftExt || getLang().ObjC2; + = getLangOpts().CPlusPlus0x || getLangOpts().MicrosoftExt || getLangOpts().ObjC2; CXXScopeSpec &SS = DS.getTypeSpecScope(); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // "enum foo : bar;" is not a potential typo for "enum foo::bar;" // if a fixed underlying type is allowed. ColonProtectionRAIIObject X(*this, AllowFixedUnderlyingType); @@ -3022,9 +3022,9 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, // underlying type. // FIXME: The standard is not entirely clear on how to disambiguate in // this case. - if ((getLang().CPlusPlus && + if ((getLangOpts().CPlusPlus && isCXXDeclarationSpecifier(TPResult::True()) != TPResult::True()) || - (!getLang().CPlusPlus && !isDeclarationSpecifier(true))) { + (!getLangOpts().CPlusPlus && !isDeclarationSpecifier(true))) { // We'll parse this as a bitfield later. PossibleBitfield = true; TPA.Revert(); @@ -3042,10 +3042,10 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, SourceRange Range; BaseType = ParseTypeName(&Range); - if (!getLang().CPlusPlus0x && !getLang().ObjC2) + if (!getLangOpts().CPlusPlus0x && !getLangOpts().ObjC2) Diag(StartLoc, diag::ext_ms_enum_fixed_underlying_type) << Range; - if (getLang().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(StartLoc, diag::warn_cxx98_compat_enum_fixed_underlying_type); } } @@ -3169,7 +3169,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { T.consumeOpen(); // C does not allow an empty enumerator-list, C++ does [dcl.enum]. - if (Tok.is(tok::r_brace) && !getLang().CPlusPlus) + if (Tok.is(tok::r_brace) && !getLangOpts().CPlusPlus) Diag(Tok, diag::error_empty_enum); SmallVector EnumConstantDecls; @@ -3220,11 +3220,11 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { SourceLocation CommaLoc = ConsumeToken(); if (Tok.isNot(tok::identifier)) { - if (!getLang().C99 && !getLang().CPlusPlus0x) + if (!getLangOpts().C99 && !getLangOpts().CPlusPlus0x) Diag(CommaLoc, diag::ext_enumerator_list_comma) - << getLang().CPlusPlus + << getLangOpts().CPlusPlus << FixItHint::CreateRemoval(CommaLoc); - else if (getLang().CPlusPlus0x) + else if (getLangOpts().CPlusPlus0x) Diag(CommaLoc, diag::warn_cxx98_compat_enumerator_list_comma) << FixItHint::CreateRemoval(CommaLoc); } @@ -3255,7 +3255,7 @@ bool Parser::isTypeQualifier() const { // type-qualifier only in OpenCL case tok::kw_private: - return getLang().OpenCL; + return getLangOpts().OpenCL; // type-qualifier case tok::kw_const: @@ -3390,7 +3390,7 @@ bool Parser::isTypeSpecifierQualifier() { // GNU ObjC bizarre protocol extension: with implicit 'id'. case tok::less: - return getLang().ObjC1; + return getLangOpts().ObjC1; case tok::kw___cdecl: case tok::kw___stdcall: @@ -3413,7 +3413,7 @@ bool Parser::isTypeSpecifierQualifier() { return true; case tok::kw_private: - return getLang().OpenCL; + return getLangOpts().OpenCL; // C11 _Atomic() case tok::kw__Atomic: @@ -3431,11 +3431,11 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { default: return false; case tok::kw_private: - return getLang().OpenCL; + return getLangOpts().OpenCL; case tok::identifier: // foo::bar // Unfortunate hack to support "Class.factoryMethod" notation. - if (getLang().ObjC1 && NextToken().is(tok::period)) + if (getLangOpts().ObjC1 && NextToken().is(tok::period)) return false; if (TryAltiVecVectorToken()) return true; @@ -3545,7 +3545,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { // GNU ObjC bizarre protocol extension: with implicit 'id'. case tok::less: - return getLang().ObjC1; + return getLangOpts().ObjC1; // typedef-name case tok::annot_typename: @@ -3642,7 +3642,7 @@ bool Parser::isConstructorDeclarator() { void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, bool VendorAttributesAllowed, bool CXX0XAttributesAllowed) { - if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) { + if (getLangOpts().CPlusPlus0x && isCXX0XAttributeSpecifier()) { SourceLocation Loc = Tok.getLocation(); ParsedAttributesWithRange attrs(AttrFactory); ParseCXX0XAttributes(attrs); @@ -3667,20 +3667,20 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, case tok::kw_const: isInvalid = DS.SetTypeQual(DeclSpec::TQ_const , Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_volatile: isInvalid = DS.SetTypeQual(DeclSpec::TQ_volatile, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_restrict: isInvalid = DS.SetTypeQual(DeclSpec::TQ_restrict, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; // OpenCL qualifiers: case tok::kw_private: - if (!getLang().OpenCL) + if (!getLangOpts().OpenCL) goto DoneWithTypeQuals; case tok::kw___private: case tok::kw___global: @@ -3777,7 +3777,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, // C++ member pointers start with a '::' or a nested-name. // Member pointers get special handling, since there's no place for the // scope spec in the generic path below. - if (getLang().CPlusPlus && + if (getLangOpts().CPlusPlus && (Tok.is(tok::coloncolon) || Tok.is(tok::identifier) || Tok.is(tok::annot_cxxscope))) { bool EnteringContext = D.getContext() == Declarator::FileContext || @@ -3816,9 +3816,9 @@ void Parser::ParseDeclaratorInternal(Declarator &D, tok::TokenKind Kind = Tok.getKind(); // Not a pointer, C++ reference, or block. if (Kind != tok::star && Kind != tok::caret && - (Kind != tok::amp || !getLang().CPlusPlus) && + (Kind != tok::amp || !getLangOpts().CPlusPlus) && // We parse rvalue refs in C++03, because otherwise the errors are scary. - (Kind != tok::ampamp || !getLang().CPlusPlus)) { + (Kind != tok::ampamp || !getLangOpts().CPlusPlus)) { if (DirectDeclParser) (this->*DirectDeclParser)(D); return; @@ -3859,7 +3859,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, // Complain about rvalue references in C++03, but then go on and build // the declarator. if (Kind == tok::ampamp) - Diag(Loc, getLang().CPlusPlus0x ? + Diag(Loc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_rvalue_reference : diag::ext_rvalue_reference); @@ -3946,7 +3946,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, void Parser::ParseDirectDeclarator(Declarator &D) { DeclaratorScopeObj DeclScopeObj(*this, D.getCXXScopeSpec()); - if (getLang().CPlusPlus && D.mayHaveIdentifier()) { + if (getLangOpts().CPlusPlus && D.mayHaveIdentifier()) { // ParseDeclaratorInternal might already have parsed the scope. if (D.getCXXScopeSpec().isEmpty()) { bool EnteringContext = D.getContext() == Declarator::FileContext || @@ -4013,7 +4013,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) { goto PastIdentifier; } } else if (Tok.is(tok::identifier) && D.mayHaveIdentifier()) { - assert(!getLang().CPlusPlus && + assert(!getLangOpts().CPlusPlus && "There's a C++-specific check for tok::identifier above"); assert(Tok.getIdentifierInfo() && "Not an identifier?"); D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation()); @@ -4047,8 +4047,8 @@ void Parser::ParseDirectDeclarator(Declarator &D) { if (D.getContext() == Declarator::MemberContext) Diag(Tok, diag::err_expected_member_name_or_semi) << D.getDeclSpec().getSourceRange(); - else if (getLang().CPlusPlus) - Diag(Tok, diag::err_expected_unqualified_id) << getLang().CPlusPlus; + else if (getLangOpts().CPlusPlus) + Diag(Tok, diag::err_expected_unqualified_id) << getLangOpts().CPlusPlus; else Diag(Tok, diag::err_expected_ident_lparen); D.SetIdentifier(0, Tok.getLocation()); @@ -4072,7 +4072,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) { // The paren may be part of a C++ direct initializer, eg. "int x(1);". // In such a case, check if we actually have a function declarator; if it // is not, the declarator has been fully parsed. - if (getLang().CPlusPlus && D.mayBeFollowedByCXXDirectInit()) { + if (getLangOpts().CPlusPlus && D.mayBeFollowedByCXXDirectInit()) { // When not in file scope, warn for ambiguous function declarators, just // in case the author intended it as a variable definition. bool warnIfAmbiguous = D.getContext() != Declarator::FileContext; @@ -4152,7 +4152,7 @@ void Parser::ParseParenDeclarator(Declarator &D) { // paren, because we haven't seen the identifier yet. isGrouping = true; } else if (Tok.is(tok::r_paren) || // 'int()' is a function. - (getLang().CPlusPlus && Tok.is(tok::ellipsis)) || // C++ int(...) + (getLangOpts().CPlusPlus && Tok.is(tok::ellipsis)) || // C++ int(...) isDeclarationSpecifier()) { // 'int(int)' is a function. // This handles C99 6.7.5.3p11: in "typedef int X; void foo(X)", X is // considered to be a type, not a K&R identifier-list. @@ -4258,13 +4258,13 @@ void Parser::ParseFunctionDeclarator(Declarator &D, else if (RequiresArg) Diag(Tok, diag::err_argument_required_after_attribute); - HasProto = ParamInfo.size() || getLang().CPlusPlus; + HasProto = ParamInfo.size() || getLangOpts().CPlusPlus; // If we have the closing ')', eat it. Tracker.consumeClose(); EndLoc = Tracker.getCloseLocation(); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { MaybeParseCXX0XAttributes(attrs); // Parse cv-qualifier-seq[opt]. @@ -4277,7 +4277,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, // Parse ref-qualifier[opt]. if (Tok.is(tok::amp) || Tok.is(tok::ampamp)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_ref_qualifier : diag::ext_ref_qualifier); @@ -4295,7 +4295,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, EndLoc = ESpecRange.getEnd(); // Parse trailing-return-type[opt]. - if (getLang().CPlusPlus0x && Tok.is(tok::arrow)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::arrow)) { Diag(Tok, diag::warn_cxx98_compat_trailing_return_type); SourceRange Range; TrailingReturnType = ParseTrailingReturnType(Range).get(); @@ -4335,7 +4335,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, /// Note that identifier-lists are only allowed for normal declarators, not for /// abstract-declarators. bool Parser::isFunctionDeclaratorIdentifierList() { - return !getLang().CPlusPlus + return !getLangOpts().CPlusPlus && Tok.is(tok::identifier) && !TryAltiVecVectorToken() // K&R identifier lists can't have typedefs as identifiers, per C99 @@ -4460,7 +4460,7 @@ void Parser::ParseParameterDeclarationClause( DeclSpec DS(AttrFactory); // Skip any Microsoft attributes before a param. - if (getLang().MicrosoftExt && Tok.is(tok::l_square)) + if (getLangOpts().MicrosoftExt && Tok.is(tok::l_square)) ParseMicrosoftAttributes(DS.getAttributes()); SourceLocation DSStart = Tok.getLocation(); @@ -4570,7 +4570,7 @@ void Parser::ParseParameterDeclarationClause( if (Tok.is(tok::ellipsis)) { EllipsisLoc = ConsumeToken(); // Consume the ellipsis. - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // We have ellipsis without a preceding ',', which is ill-formed // in C. Complain and provide the fix. Diag(EllipsisLoc, diag::err_missing_comma_before_ellipsis) @@ -4668,7 +4668,7 @@ void Parser::ParseBracketDeclarator(Declarator &D) { // Parse the constant-expression or assignment-expression now (depending // on dialect). - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { NumElements = ParseConstantExpression(); } else { EnterExpressionEvaluationContext Unevaluated(Actions, diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 89f024637e59..5b68c7a78453 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -150,7 +150,7 @@ Decl *Parser::ParseNamespace(unsigned Context, // If we're still good, complain about inline namespaces in non-C++0x now. if (InlineLoc.isValid()) - Diag(InlineLoc, getLang().CPlusPlus0x ? + Diag(InlineLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_inline_namespace : diag::ext_inline_namespace); // Enter a scope for the namespace. @@ -490,7 +490,7 @@ Decl *Parser::ParseUsingDeclaration(unsigned Context, // Where can GNU attributes appear? ConsumeToken(); - Diag(Tok.getLocation(), getLang().CPlusPlus0x ? + Diag(Tok.getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_alias_declaration : diag::ext_alias_declaration); @@ -593,7 +593,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){ assert((Tok.is(tok::kw_static_assert) || Tok.is(tok::kw__Static_assert)) && "Not a static_assert declaration"); - if (Tok.is(tok::kw__Static_assert) && !getLang().C11) + if (Tok.is(tok::kw__Static_assert) && !getLangOpts().C11) Diag(Tok, diag::ext_c11_static_assert); if (Tok.is(tok::kw_static_assert)) Diag(Tok, diag::warn_cxx98_compat_static_assert); @@ -1020,7 +1020,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, // Parse the (optional) nested-name-specifier. CXXScopeSpec &SS = DS.getTypeSpecScope(); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // "FOO : BAR" is not a potential typo for "FOO::BAR". ColonProtectionRAIIObject X(*this); @@ -1041,7 +1041,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, Name = Tok.getIdentifierInfo(); NameLoc = ConsumeToken(); - if (Tok.is(tok::less) && getLang().CPlusPlus) { + if (Tok.is(tok::less) && getLangOpts().CPlusPlus) { // The name was supposed to refer to a template, but didn't. // Eat the template argument list and try to continue parsing this as // a class (or template thereof). @@ -1130,7 +1130,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, if (SuppressDeclarations) TUK = Sema::TUK_Reference; else if (Tok.is(tok::l_brace) || - (getLang().CPlusPlus && Tok.is(tok::colon)) || + (getLangOpts().CPlusPlus && Tok.is(tok::colon)) || isCXX0XFinalKeyword()) { if (DS.isFriendSpecified()) { // C++ [class.friend]p2: @@ -1313,9 +1313,9 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, // If there is a body, parse it and inform the actions module. if (TUK == Sema::TUK_Definition) { assert(Tok.is(tok::l_brace) || - (getLang().CPlusPlus && Tok.is(tok::colon)) || + (getLangOpts().CPlusPlus && Tok.is(tok::colon)) || isCXX0XFinalKeyword()); - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) ParseCXXMemberSpecification(StartLoc, TagType, TagOrTempResult.get()); else ParseStructUnionBody(StartLoc, TagType, TagOrTempResult.get()); @@ -1397,7 +1397,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, case tok::r_brace: // struct bar { struct foo {...} } // Missing ';' at end of struct is accepted as an extension in C mode. - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) ExpectedSemi = false; break; } @@ -1576,7 +1576,7 @@ void Parser::HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo, /// override /// final VirtSpecifiers::Specifier Parser::isCXX0XVirtSpecifier(const Token &Tok) const { - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) return VirtSpecifiers::VS_None; if (Tok.is(tok::identifier)) { @@ -1617,7 +1617,7 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) { << PrevSpec << FixItHint::CreateRemoval(Tok.getLocation()); - Diag(Tok.getLocation(), getLang().CPlusPlus0x ? + Diag(Tok.getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_override_control_keyword : diag::ext_override_control_keyword) << VirtSpecifiers::getSpecifierName(Specifier); @@ -1628,7 +1628,7 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) { /// isCXX0XFinalKeyword - Determine whether the next token is a C++0x /// contextual 'final' keyword. bool Parser::isCXX0XFinalKeyword() const { - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; if (!Tok.is(tok::identifier)) @@ -1683,7 +1683,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, const ParsedTemplateInfo &TemplateInfo, ParsingDeclRAIIObject *TemplateDiags) { if (Tok.is(tok::at)) { - if (getLang().ObjC1 && NextToken().isObjCAtKeyword(tok::objc_defs)) + if (getLangOpts().ObjC1 && NextToken().isObjCAtKeyword(tok::objc_defs)) Diag(Tok, diag::err_at_defs_cxx); else Diag(Tok, diag::err_at_in_class); @@ -1842,7 +1842,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // MSVC permits pure specifier on inline functions declared at class scope. // Hence check for =0 before checking for function definition. - if (getLang().MicrosoftExt && Tok.is(tok::equal) && + if (getLangOpts().MicrosoftExt && Tok.is(tok::equal) && DeclaratorInfo.isFunctionDeclarator() && NextToken().is(tok::numeric_constant)) { EqualLoc = ConsumeToken(); @@ -1859,7 +1859,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // In C++11, a non-function declarator followed by an open brace is a // braced-init-list for an in-class member initialization, not an // erroneous function definition. - if (Tok.is(tok::l_brace) && !getLang().CPlusPlus0x) { + if (Tok.is(tok::l_brace) && !getLangOpts().CPlusPlus0x) { DefinitionKind = FDK_Definition; } else if (DeclaratorInfo.isFunctionDeclarator()) { if (Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try)) { @@ -2006,7 +2006,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // Handle the initializer. if (HasDeferredInitializer) { // The initializer was deferred; parse it and cache the tokens. - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_nonstatic_member_init : diag::ext_nonstatic_member_init); @@ -2212,11 +2212,11 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, SourceLocation FinalLoc; // Parse the optional 'final' keyword. - if (getLang().CPlusPlus && Tok.is(tok::identifier)) { + if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) { assert(isCXX0XFinalKeyword() && "not a class definition"); FinalLoc = ConsumeToken(); - Diag(FinalLoc, getLang().CPlusPlus0x ? + Diag(FinalLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_override_control_keyword : diag::ext_override_control_keyword) << "final"; } @@ -2256,7 +2256,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) { // Each iteration of this loop reads one member-declaration. - if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || + if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { ParseMicrosoftIfExistsClassDeclaration((DeclSpec::TST)TagType, CurAS); continue; @@ -2483,7 +2483,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { // Parse the '('. - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); ExprResult InitList = ParseBraceInitializer(); @@ -2522,7 +2522,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { EllipsisLoc); } - Diag(Tok, getLang().CPlusPlus0x ? diag::err_expected_lparen_or_lbrace + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::err_expected_lparen_or_lbrace : diag::err_expected_lparen); return true; } @@ -2630,7 +2630,7 @@ ExceptionSpecificationType Parser::ParseDynamicExceptionSpecification( // can throw anything". if (Tok.is(tok::ellipsis)) { SourceLocation EllipsisLoc = ConsumeToken(); - if (!getLang().MicrosoftExt) + if (!getLangOpts().MicrosoftExt) Diag(EllipsisLoc, diag::ext_ellipsis_exception_spec); T.consumeClose(); SpecificationRange.setEnd(T.getCloseLocation()); diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index c4627f1bbae6..888e84f25327 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -268,7 +268,7 @@ ExprResult Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { prec::Level NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator, - getLang().CPlusPlus0x); + getLangOpts().CPlusPlus0x); SourceLocation ColonLoc; while (1) { @@ -358,10 +358,10 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { // they only appear on the RHS of assignments later. ExprResult RHS; bool RHSIsInitList = false; - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { RHS = ParseBraceInitializer(); RHSIsInitList = true; - } else if (getLang().CPlusPlus && NextTokPrec <= prec::Conditional) + } else if (getLangOpts().CPlusPlus && NextTokPrec <= prec::Conditional) RHS = ParseAssignmentExpression(); else RHS = ParseCastExpression(false); @@ -373,7 +373,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { // operator immediately to the right of the RHS. prec::Level ThisPrec = NextTokPrec; NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator, - getLang().CPlusPlus0x); + getLangOpts().CPlusPlus0x); // Assignment and conditional expressions are right-associative. bool isRightAssoc = ThisPrec == prec::Conditional || @@ -401,7 +401,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { LHS = ExprError(); NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator, - getLang().CPlusPlus0x); + getLangOpts().CPlusPlus0x); } assert(NextTokPrec <= ThisPrec && "Recursion didn't work!"); @@ -666,7 +666,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // If this expression is limited to being a unary-expression, the parent can // not start a cast expression. ParenParseOption ParenExprType = - (isUnaryExpression && !getLang().CPlusPlus)? CompoundLiteral : CastExpr; + (isUnaryExpression && !getLangOpts().CPlusPlus)? CompoundLiteral : CastExpr; ParsedType CastTy; SourceLocation RParenLoc; @@ -728,7 +728,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // constant: enumeration-constant // Turn a potentially qualified name into a annot_typename or // annot_cxxscope if it would be valid. This handles things like x::y, etc. - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Avoid the unnecessary parse-time lookup in the common case // where the syntax forbids a type. const Token &Next = NextToken(); @@ -751,7 +751,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, SourceLocation ILoc = ConsumeToken(); // Support 'Class.property' and 'super.property' notation. - if (getLang().ObjC1 && Tok.is(tok::period) && + if (getLangOpts().ObjC1 && Tok.is(tok::period) && (Actions.getTypeName(II, ILoc, getCurScope()) || // Allow the base to be 'super' if in an objc-method. (&II == Ident_super && getCurScope()->isInObjcMethodScope()))) { @@ -759,7 +759,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // Allow either an identifier or the keyword 'class' (in C++). if (Tok.isNot(tok::identifier) && - !(getLang().CPlusPlus && Tok.is(tok::kw_class))) { + !(getLangOpts().CPlusPlus && Tok.is(tok::kw_class))) { Diag(Tok, diag::err_expected_property_name); return ExprError(); } @@ -775,7 +775,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // the token sequence is ill-formed. However, if there's a ':' or ']' after // that identifier, this is probably a message send with a missing open // bracket. Treat it as such. - if (getLang().ObjC1 && &II == Ident_super && !InMessageExpression && + if (getLangOpts().ObjC1 && &II == Ident_super && !InMessageExpression && getCurScope()->isInObjcMethodScope() && ((Tok.is(tok::identifier) && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) || @@ -790,7 +790,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // send that's missing the opening '['. Recovery // appropriately. Also take this path if we're performing code // completion after an Objective-C class name. - if (getLang().ObjC1 && + if (getLangOpts().ObjC1 && ((Tok.is(tok::identifier) && !InMessageExpression) || Tok.is(tok::code_completion))) { const Token& Next = NextToken(); @@ -875,7 +875,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // ++ cast-expression // -- cast-expression SourceLocation SavedLoc = ConsumeToken(); - Res = ParseCastExpression(!getLang().CPlusPlus); + Res = ParseCastExpression(!getLangOpts().CPlusPlus); if (!Res.isInvalid()) Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get()); return move(Res); @@ -996,7 +996,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, case tok::kw_typename: case tok::kw_typeof: case tok::kw___vector: { - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { Diag(Tok, diag::err_expected_expression); return ExprError(); } @@ -1014,7 +1014,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, DeclSpec DS(AttrFactory); ParseCXXSimpleTypeSpecifier(DS); if (Tok.isNot(tok::l_paren) && - (!getLang().CPlusPlus0x || Tok.isNot(tok::l_brace))) + (!getLangOpts().CPlusPlus0x || Tok.isNot(tok::l_brace))) return ExprError(Diag(Tok, diag::err_expected_lparen_after_type) << DS.getSourceRange()); @@ -1198,8 +1198,8 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, return ExprError(); } case tok::l_square: - if (getLang().CPlusPlus0x) { - if (getLang().ObjC1) { + if (getLangOpts().CPlusPlus0x) { + if (getLangOpts().ObjC1) { // C++11 lambda expressions and Objective-C message sends both start with a // square bracket. There are three possibilities here: // we have a valid lambda expression, we have an invalid lambda @@ -1213,7 +1213,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, Res = ParseLambdaExpression(); break; } - if (getLang().ObjC1) { + if (getLangOpts().ObjC1) { Res = ParseObjCMessageExpression(); break; } @@ -1265,7 +1265,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // If we see identifier: after an expression, and we're not already in a // message send, then this is probably a message send with a missing // opening bracket '['. - if (getLang().ObjC1 && !InMessageExpression && + if (getLangOpts().ObjC1 && !InMessageExpression && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) { LHS = ParseObjCMessageExpressionBody(SourceLocation(), SourceLocation(), ParsedType(), LHS.get()); @@ -1283,7 +1283,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // actually another message send. In this case, do some look-ahead to see // if the contents of the square brackets are obviously not a valid // expression and recover by pretending there is no suffix. - if (getLang().ObjC1 && Tok.isAtStartOfLine() && + if (getLangOpts().ObjC1 && Tok.isAtStartOfLine() && isSimpleObjCMessageExpression()) return move(LHS); @@ -1291,7 +1291,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { T.consumeOpen(); Loc = T.getOpenLocation(); ExprResult Idx; - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); Idx = ParseBraceInitializer(); } else @@ -1411,7 +1411,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { CXXScopeSpec SS; ParsedType ObjectType; bool MayBePseudoDestructor = false; - if (getLang().CPlusPlus && !LHS.isInvalid()) { + if (getLangOpts().CPlusPlus && !LHS.isInvalid()) { LHS = Actions.ActOnStartCXXMemberReference(getCurScope(), LHS.take(), OpLoc, OpKind, ObjectType, MayBePseudoDestructor); @@ -1449,7 +1449,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // FIXME: Add support for explicit call of template constructor. SourceLocation TemplateKWLoc; UnqualifiedId Name; - if (getLang().ObjC2 && OpKind == tok::period && Tok.is(tok::kw_class)) { + if (getLangOpts().ObjC2 && OpKind == tok::period && Tok.is(tok::kw_class)) { // Objective-C++: // After a '.' in a member access expression, treat the keyword // 'class' as if it were an identifier. @@ -1464,7 +1464,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { /*EnteringContext=*/false, /*AllowDestructorName=*/true, /*AllowConstructorName=*/ - getLang().MicrosoftExt, + getLangOpts().MicrosoftExt, ObjectType, TemplateKWLoc, Name)) LHS = ExprError(); @@ -1524,7 +1524,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok, // If the operand doesn't start with an '(', it must be an expression. if (Tok.isNot(tok::l_paren)) { isCastExpr = false; - if (OpTok.is(tok::kw_typeof) && !getLang().CPlusPlus) { + if (OpTok.is(tok::kw_typeof) && !getLangOpts().CPlusPlus) { Diag(Tok,diag::err_expected_lparen_after_id) << OpTok.getIdentifierInfo(); return ExprError(); } @@ -1549,7 +1549,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok, return ExprEmpty(); } - if (getLang().CPlusPlus || OpTok.isNot(tok::kw_typeof)) { + if (getLangOpts().CPlusPlus || OpTok.isNot(tok::kw_typeof)) { // GNU typeof in C requires the expression to be parenthesized. Not so for // sizeof/alignof or in C++. Therefore, the parenthesized expression is // the start of a unary-expression, but doesn't include any postfix @@ -1898,12 +1898,12 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, } // Diagnose use of bridge casts in non-arc mode. - bool BridgeCast = (getLang().ObjC2 && + bool BridgeCast = (getLangOpts().ObjC2 && (Tok.is(tok::kw___bridge) || Tok.is(tok::kw___bridge_transfer) || Tok.is(tok::kw___bridge_retained) || Tok.is(tok::kw___bridge_retain))); - if (BridgeCast && !getLang().ObjCAutoRefCount) { + if (BridgeCast && !getLangOpts().ObjCAutoRefCount) { StringRef BridgeCastName = Tok.getName(); SourceLocation BridgeKeywordLoc = ConsumeToken(); if (!PP.getSourceManager().isInSystemHeader(BridgeKeywordLoc)) @@ -1984,7 +1984,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, // this is probably an Objective-C message send where the leading '[' is // missing. Recover as if that were the case. if (!DeclaratorInfo.isInvalidType() && Tok.is(tok::identifier) && - !InMessageExpression && getLang().ObjC1 && + !InMessageExpression && getLangOpts().ObjC1 && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) { TypeResult Ty; { @@ -2027,7 +2027,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, } // Reject the cast of super idiom in ObjC. - if (Tok.is(tok::identifier) && getLang().ObjC1 && + if (Tok.is(tok::identifier) && getLangOpts().ObjC1 && Tok.getIdentifierInfo() == Ident_super && getCurScope()->isInObjcMethodScope() && GetLookAheadToken(1).isNot(tok::period)) { @@ -2098,7 +2098,7 @@ Parser::ParseCompoundLiteralExpression(ParsedType Ty, SourceLocation LParenLoc, SourceLocation RParenLoc) { assert(Tok.is(tok::l_brace) && "Not a compound literal!"); - if (!getLang().C99) // Compound literals don't exist in C90. + if (!getLangOpts().C99) // Compound literals don't exist in C90. Diag(LParenLoc, diag::ext_c99_compound_literal); ExprResult Result = ParseInitializer(); if (!Result.isInvalid() && Ty) @@ -2144,7 +2144,7 @@ ExprResult Parser::ParseGenericSelectionExpression() { assert(Tok.is(tok::kw__Generic) && "_Generic keyword expected"); SourceLocation KeyLoc = ConsumeToken(); - if (!getLang().C11) + if (!getLangOpts().C11) Diag(KeyLoc, diag::ext_c11_generic_selection); BalancedDelimiterTracker T(*this, tok::l_paren); @@ -2262,7 +2262,7 @@ bool Parser::ParseExpressionList(SmallVectorImpl &Exprs, } ExprResult Expr; - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); Expr = ParseBraceInitializer(); } else diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index 847b3964fb50..325c398f343b 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -138,7 +138,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, bool EnteringContext, bool *MayBePseudoDestructor, bool IsTypename) { - assert(getLang().CPlusPlus && + assert(getLangOpts().CPlusPlus && "Call sites of this function should be guarded by checking for C++"); if (Tok.is(tok::annot_cxxscope)) { @@ -416,7 +416,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, // parse correctly as a template, so suggest the keyword 'template' // before 'getAs' and treat this as a dependent template name. unsigned DiagID = diag::err_missing_dependent_template_keyword; - if (getLang().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_missing_dependent_template_keyword; Diag(Tok.getLocation(), DiagID) @@ -578,7 +578,7 @@ ExprResult Parser::ParseLambdaExpression() { /// /// If we are not looking at a lambda expression, returns ExprError(). ExprResult Parser::TryParseLambdaExpression() { - assert(getLang().CPlusPlus0x + assert(getLangOpts().CPlusPlus0x && Tok.is(tok::l_square) && "Not at the start of a possible lambda expression."); @@ -657,7 +657,7 @@ llvm::Optional Parser::ParseLambdaIntroducer(LambdaIntroducer &Intro){ if (Tok.is(tok::code_completion)) { // If we're in Objective-C++ and we have a bare '[', then this is more // likely to be a message receiver. - if (getLang().ObjC1 && first) + if (getLangOpts().ObjC1 && first) Actions.CodeCompleteObjCMessageReceiver(getCurScope()); else Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro, @@ -1225,7 +1225,7 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) { ParsedType TypeRep = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get(); assert((Tok.is(tok::l_paren) || - (getLang().CPlusPlus0x && Tok.is(tok::l_brace))) + (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace))) && "Expected '(' or '{'!"); if (Tok.is(tok::l_brace)) { @@ -1350,7 +1350,7 @@ bool Parser::ParseCXXCondition(ExprResult &ExprOut, ConsumeToken(); ExprResult InitExpr = ExprError(); - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok.getLocation(), diag::warn_cxx98_compat_generalized_initializer_lists); InitExpr = ParseBraceInitializer(); @@ -1467,7 +1467,7 @@ void Parser::ParseCXXSimpleTypeSpecifier(DeclSpec &DS) { // is a specific typedef and 'itf' where 'itf' is an // Objective-C interface. If we don't have Objective-C or a '<', this is // just a normal reference to a typedef name. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); DS.Finish(Diags, PP); @@ -1904,7 +1904,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, // literal-operator-id: [C++0x 13.5.8] // operator "" identifier - if (getLang().CPlusPlus0x && isTokenStringLiteral()) { + if (getLangOpts().CPlusPlus0x && isTokenStringLiteral()) { Diag(Tok.getLocation(), diag::warn_cxx98_compat_literal_operator); SourceLocation DiagLoc; @@ -1936,7 +1936,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, SuffixLoc = Lexer::AdvanceToTokenCharacter(TokLocs[Literal.getUDSuffixToken()], Literal.getUDSuffixOffset(), - PP.getSourceManager(), getLang()); + PP.getSourceManager(), getLangOpts()); // This form is not permitted by the standard (yet). DiagLoc = SuffixLoc; DiagId = diag::err_literal_operator_missing_space; @@ -2041,7 +2041,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, // Handle 'A::template B'. This is for template-ids which have not // already been annotated by ParseOptionalCXXScopeSpecifier(). bool TemplateSpecified = false; - if (getLang().CPlusPlus && Tok.is(tok::kw_template) && + if (getLangOpts().CPlusPlus && Tok.is(tok::kw_template) && (ObjectType || SS.isSet())) { TemplateSpecified = true; TemplateKWLoc = ConsumeToken(); @@ -2055,7 +2055,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, IdentifierInfo *Id = Tok.getIdentifierInfo(); SourceLocation IdLoc = ConsumeToken(); - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // If we're not in C++, only identifiers matter. Record the // identifier and return. Result.setIdentifier(Id, IdLoc); @@ -2152,7 +2152,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, return false; } - if (getLang().CPlusPlus && + if (getLangOpts().CPlusPlus && (AllowDestructorName || SS.isSet()) && Tok.is(tok::tilde)) { // C++ [expr.unary.op]p10: // There is an ambiguity in the unary-expression ~X(), where X is a @@ -2203,7 +2203,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, } Diag(Tok, diag::err_expected_unqualified_id) - << getLang().CPlusPlus; + << getLangOpts().CPlusPlus; return true; } @@ -2333,7 +2333,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) { Initializer = Actions.ActOnParenListExpr(ConstructorLParen, ConstructorRParen, move_arg(ConstructorArgs)); - } else if (Tok.is(tok::l_brace) && getLang().CPlusPlus0x) { + } else if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus0x) { Diag(Tok.getLocation(), diag::warn_cxx98_compat_generalized_initializer_lists); Initializer = ParseBraceInitializer(); @@ -2724,7 +2724,7 @@ ExprResult Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType, ParsedType &CastTy, BalancedDelimiterTracker &Tracker) { - assert(getLang().CPlusPlus && "Should only be called for C++!"); + assert(getLangOpts().CPlusPlus && "Should only be called for C++!"); assert(ExprType == CastExpr && "Compound literals are not ambiguous!"); assert(isTypeIdInParens() && "Not a type-id!"); diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp index d5e06f7fd88f..d4fc9056e400 100644 --- a/clang/lib/Parse/ParseInit.cpp +++ b/clang/lib/Parse/ParseInit.cpp @@ -33,7 +33,7 @@ bool Parser::MayBeDesignationStart() { return true; case tok::l_square: { // designator: array-designator - if (!PP.getLangOptions().CPlusPlus0x) + if (!PP.getLangOpts().CPlusPlus0x) return true; // C++11 lambda expressions and C99 designators can be ambiguous all the @@ -223,7 +223,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { // send) or send to 'super', parse this as a message send // expression. We handle C++ and C separately, since C++ requires // much more complicated parsing. - if (getLang().ObjC1 && getLang().CPlusPlus) { + if (getLangOpts().ObjC1 && getLangOpts().CPlusPlus) { // Send to 'super'. if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super && NextToken().isNot(tok::period) && @@ -258,7 +258,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { // adopt the expression for further analysis below. // FIXME: potentially-potentially evaluated expression above? Idx = ExprResult(static_cast(TypeOrExpr)); - } else if (getLang().ObjC1 && Tok.is(tok::identifier)) { + } else if (getLangOpts().ObjC1 && Tok.is(tok::identifier)) { IdentifierInfo *II = Tok.getIdentifierInfo(); SourceLocation IILoc = Tok.getLocation(); ParsedType ReceiverType; @@ -316,7 +316,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { // tokens are '...' or ']' or an objc message send. If this is an objc // message send, handle it now. An objc-message send is the start of // an assignment-expression production. - if (getLang().ObjC1 && Tok.isNot(tok::ellipsis) && + if (getLangOpts().ObjC1 && Tok.isNot(tok::ellipsis) && Tok.isNot(tok::r_square)) { CheckArrayDesignatorSyntax(*this, Tok.getLocation(), Desig); return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, @@ -404,7 +404,7 @@ ExprResult Parser::ParseBraceInitializer() { if (Tok.is(tok::r_brace)) { // Empty initializers are a C++ feature and a GNU extension to C. - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) Diag(LBraceLoc, diag::ext_gnu_empty_initializer); // Match the '}'. return Actions.ActOnInitList(LBraceLoc, MultiExprArg(Actions), @@ -415,7 +415,7 @@ ExprResult Parser::ParseBraceInitializer() { while (1) { // Handle Microsoft __if_exists/if_not_exists if necessary. - if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || + if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { if (ParseMicrosoftIfExistsBraceInitializer(InitExprs, InitExprsOk)) { if (Tok.isNot(tok::comma)) break; diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index cc2efd843fef..c664c64b6736 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -65,7 +65,7 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() { SingleDecl = ParseObjCPropertyDynamic(AtLoc); break; case tok::objc___experimental_modules_import: - if (getLang().Modules) + if (getLangOpts().Modules) return ParseModuleImport(AtLoc); // Fall through @@ -203,7 +203,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc, categoryId = Tok.getIdentifierInfo(); categoryLoc = ConsumeToken(); } - else if (!getLang().ObjC2) { + else if (!getLangOpts().ObjC2) { Diag(Tok, diag::err_expected_ident); // missing category name. return 0; } @@ -477,7 +477,7 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, break; case tok::objc_property: - if (!getLang().ObjC2) + if (!getLangOpts().ObjC2) Diag(AtLoc, diag::err_objc_properties_require_objc2); ObjCDeclSpec OCDS; @@ -778,7 +778,7 @@ bool Parser::isTokIdentifier_in() const { // FIXME: May have to do additional look-ahead to only allow for // valid tokens following an 'in'; such as an identifier, unary operators, // '[' etc. - return (getLang().ObjC2 && Tok.is(tok::identifier) && + return (getLangOpts().ObjC2 && Tok.is(tok::identifier) && Tok.getIdentifierInfo() == ObjCTypeQuals[objc_in]); } @@ -981,7 +981,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // If attributes exist before the method, parse them. ParsedAttributes methodAttrs(AttrFactory); - if (getLang().ObjC2) + if (getLangOpts().ObjC2) MaybeParseGNUAttributes(methodAttrs); if (Tok.is(tok::code_completion)) { @@ -1007,7 +1007,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, SmallVector CParamInfo; if (Tok.isNot(tok::colon)) { // If attributes exist after the method, parse them. - if (getLang().ObjC2) + if (getLangOpts().ObjC2) MaybeParseGNUAttributes(methodAttrs); Selector Sel = PP.getSelectorTable().getNullarySelector(SelIdent); @@ -1050,7 +1050,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // If attributes exist before the argument name, parse them. // Regardless, collect all the attributes we've parsed so far. ArgInfo.ArgAttrs = 0; - if (getLang().ObjC2) { + if (getLangOpts().ObjC2) { MaybeParseGNUAttributes(paramAttrs); ArgInfo.ArgAttrs = paramAttrs.getList(); } @@ -1129,7 +1129,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // FIXME: Add support for optional parameter list... // If attributes exist after the method, parse them. - if (getLang().ObjC2) + if (getLangOpts().ObjC2) MaybeParseGNUAttributes(methodAttrs); if (KeyIdents.size() == 0) @@ -1205,7 +1205,7 @@ ParseObjCProtocolReferences(SmallVectorImpl &Protocols, /// in a decl-specifier-seq, starting at the '<'. bool Parser::ParseObjCProtocolQualifiers(DeclSpec &DS) { assert(Tok.is(tok::less) && "Protocol qualifiers start with '<'"); - assert(getLang().ObjC1 && "Protocol qualifiers only exist in Objective-C"); + assert(getLangOpts().ObjC1 && "Protocol qualifiers only exist in Objective-C"); SourceLocation LAngleLoc, EndProtoLoc; SmallVector ProtocolDecl; SmallVector ProtocolLocs; @@ -2175,14 +2175,14 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) { /// This routine will only return true for a subset of valid message-send /// expressions. bool Parser::isSimpleObjCMessageExpression() { - assert(Tok.is(tok::l_square) && getLang().ObjC1 && + assert(Tok.is(tok::l_square) && getLangOpts().ObjC1 && "Incorrect start for isSimpleObjCMessageExpression"); return GetLookAheadToken(1).is(tok::identifier) && GetLookAheadToken(2).is(tok::identifier); } bool Parser::isStartOfObjCClassMessageMissingOpenBracket() { - if (!getLang().ObjC1 || !NextToken().is(tok::identifier) || + if (!getLangOpts().ObjC1 || !NextToken().is(tok::identifier) || InMessageExpression) return false; @@ -2231,7 +2231,7 @@ ExprResult Parser::ParseObjCMessageExpression() { InMessageExpressionRAIIObject InMessage(*this, true); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // We completely separate the C and C++ cases because C++ requires // more complicated (read: slower) parsing. @@ -2647,7 +2647,7 @@ ExprResult Parser::ParseObjCDictionaryLiteral(SourceLocation AtLoc) { // Parse the ellipsis that designates this as a pack expansion. SourceLocation EllipsisLoc; - if (Tok.is(tok::ellipsis) && getLang().CPlusPlus) + if (Tok.is(tok::ellipsis) && getLangOpts().CPlusPlus) EllipsisLoc = ConsumeToken(); // We have a valid expression. Collect it in a vector so we can diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp index fef3af249c54..eb13e0d3574a 100644 --- a/clang/lib/Parse/ParsePragma.cpp +++ b/clang/lib/Parse/ParsePragma.cpp @@ -143,7 +143,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, // In MSVC/gcc, #pragma pack(4) sets the alignment without affecting // the push/pop stack. // In Apple gcc, #pragma pack(4) is equivalent to #pragma pack(push, 4) - if (PP.getLangOptions().ApplePragmaPack) + if (PP.getLangOpts().ApplePragmaPack) Kind = Sema::PPK_Push; } else if (Tok.is(tok::identifier)) { const IdentifierInfo *II = Tok.getIdentifierInfo(); @@ -194,7 +194,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, } } } - } else if (PP.getLangOptions().ApplePragmaPack) { + } else if (PP.getLangOpts().ApplePragmaPack) { // In MSVC/gcc, #pragma pack() resets the alignment without affecting // the push/pop stack. // In Apple gcc #pragma pack() is equivalent to #pragma pack(pop). diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index cd80c4c96929..5fe5e6a2b6a5 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -116,7 +116,7 @@ Retry: IdentifierInfo *Name = Tok.getIdentifierInfo(); SourceLocation NameLoc = Tok.getLocation(); - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) CheckForTemplateAndDigraph(Next, ParsedType(), /*EnteringContext=*/false, *Name, SS); @@ -207,7 +207,7 @@ Retry: } default: { - if ((getLang().CPlusPlus || !OnlyStatement) && isDeclarationStatement()) { + if ((getLangOpts().CPlusPlus || !OnlyStatement) && isDeclarationStatement()) { SourceLocation DeclStart = Tok.getLocation(), DeclEnd; DeclGroupPtrTy Decl = ParseDeclaration(Stmts, Declarator::BlockContext, DeclEnd, attrs); @@ -399,14 +399,14 @@ StmtResult Parser::ParseSEHExceptBlock(SourceLocation ExceptLoc) { ParseScope ExpectScope(this, Scope::DeclScope | Scope::ControlScope); - if (getLang().Borland) { + if (getLangOpts().Borland) { Ident__exception_info->setIsPoisoned(false); Ident___exception_info->setIsPoisoned(false); Ident_GetExceptionInfo->setIsPoisoned(false); } ExprResult FilterExpr(ParseExpression()); - if (getLang().Borland) { + if (getLangOpts().Borland) { Ident__exception_info->setIsPoisoned(true); Ident___exception_info->setIsPoisoned(true); Ident_GetExceptionInfo->setIsPoisoned(true); @@ -770,7 +770,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { continue; } - if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || + if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { ParseMicrosoftIfExistsStatement(Stmts); continue; @@ -855,7 +855,7 @@ bool Parser::ParseParenExprOrCondition(ExprResult &ExprResult, BalancedDelimiterTracker T(*this, tok::l_paren); T.consumeOpen(); - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) ParseCXXCondition(ExprResult, DeclResult, Loc, ConvertToBoolean); else { ExprResult = ParseExpression(); @@ -904,7 +904,7 @@ StmtResult Parser::ParseIfStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXX = getLang().C99 || getLang().CPlusPlus; + bool C99orCXX = getLangOpts().C99 || getLangOpts().CPlusPlus; // C99 6.8.4p3 - In C99, the if statement is a block. This is not // the case for C90. @@ -1038,7 +1038,7 @@ StmtResult Parser::ParseSwitchStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXX = getLang().C99 || getLang().CPlusPlus; + bool C99orCXX = getLangOpts().C99 || getLangOpts().CPlusPlus; // C99 6.8.4p3 - In C99, the switch statement is a block. This is // not the case for C90. Start the switch scope. @@ -1130,7 +1130,7 @@ StmtResult Parser::ParseWhileStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXX = getLang().C99 || getLang().CPlusPlus; + bool C99orCXX = getLangOpts().C99 || getLangOpts().CPlusPlus; // C99 6.8.5p5 - In C99, the while statement is a block. This is not // the case for C90. Start the loop scope. @@ -1200,7 +1200,7 @@ StmtResult Parser::ParseDoStatement(ParsedAttributes &attrs) { // C99 6.8.5p5 - In C99, the do statement is a block. This is not // the case for C90. Start the loop scope. unsigned ScopeFlags; - if (getLang().C99) + if (getLangOpts().C99) ScopeFlags = Scope::BreakScope | Scope::ContinueScope | Scope::DeclScope; else ScopeFlags = Scope::BreakScope | Scope::ContinueScope; @@ -1216,7 +1216,7 @@ StmtResult Parser::ParseDoStatement(ParsedAttributes &attrs) { // which is entered and exited each time through the loop. // ParseScope InnerScope(this, Scope::DeclScope, - (getLang().C99 || getLang().CPlusPlus) && + (getLangOpts().C99 || getLangOpts().CPlusPlus) && Tok.isNot(tok::l_brace)); // Read the body statement. @@ -1287,7 +1287,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXXorObjC = getLang().C99 || getLang().CPlusPlus || getLang().ObjC1; + bool C99orCXXorObjC = getLangOpts().C99 || getLangOpts().CPlusPlus || getLangOpts().ObjC1; // C99 6.8.5p5 - In C99, the for statement is a block. This is not // the case for C90. Start the loop scope. @@ -1348,7 +1348,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, MaybeParseCXX0XAttributes(attrs); // In C++0x, "for (T NS:a" might not be a typo for :: - bool MightBeForRangeStmt = getLang().CPlusPlus; + bool MightBeForRangeStmt = getLangOpts().CPlusPlus; ColonProtectionRAIIObject ColonProtection(*this, MightBeForRangeStmt); SourceLocation DeclStart = Tok.getLocation(), DeclEnd; @@ -1360,7 +1360,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, FirstPart = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation()); if (ForRangeInit.ParsedForRangeDecl()) { - Diag(ForRangeInit.ColonLoc, getLang().CPlusPlus0x ? + Diag(ForRangeInit.ColonLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_for_range : diag::ext_for_range); ForRange = true; @@ -1404,7 +1404,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, return StmtError(); } Collection = ParseExpression(); - } else if (getLang().CPlusPlus0x && Tok.is(tok::colon) && FirstPart.get()) { + } else if (getLangOpts().CPlusPlus0x && Tok.is(tok::colon) && FirstPart.get()) { // User tried to write the reasonable, but ill-formed, for-range-statement // for (expr : expr) { ... } Diag(Tok, diag::err_for_range_expected_decl) @@ -1431,7 +1431,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, // missing both semicolons. } else { ExprResult Second; - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) ParseCXXCondition(Second, SecondVar, ForLoc, true); else { Second = ParseExpression(); @@ -1605,10 +1605,10 @@ StmtResult Parser::ParseReturnStatement(ParsedAttributes &attrs) { return StmtError(); } - if (Tok.is(tok::l_brace) && getLang().CPlusPlus) { + if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus) { R = ParseInitializer(); if (R.isUsable()) - Diag(R.get()->getLocStart(), getLang().CPlusPlus0x ? + Diag(R.get()->getLocStart(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_generalized_initializer_lists : diag::ext_generalized_initializer_lists) << R.get()->getSourceRange(); @@ -1771,7 +1771,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { assert(Tok.is(tok::kw_asm) && "Not an asm stmt"); SourceLocation AsmLoc = ConsumeToken(); - if (getLang().MicrosoftExt && Tok.isNot(tok::l_paren) && !isTypeQualifier()) { + if (getLangOpts().MicrosoftExt && Tok.isNot(tok::l_paren) && !isTypeQualifier()) { msAsm = true; return ParseMicrosoftAsmStatement(AsmLoc); } diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index 84b967e213be..305f07bc90e5 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -478,7 +478,7 @@ Decl *Parser::ParseTypeParameter(unsigned Depth, unsigned Position) { EllipsisLoc = ConsumeToken(); Diag(EllipsisLoc, - getLang().CPlusPlus0x + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_variadic_templates : diag::ext_variadic_templates); } @@ -553,7 +553,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { EllipsisLoc = ConsumeToken(); Diag(EllipsisLoc, - getLang().CPlusPlus0x + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_variadic_templates : diag::ext_variadic_templates); } @@ -716,7 +716,7 @@ Parser::ParseTemplateIdAfterTemplateName(TemplateTy Template, if (NextToken().is(tok::greater) || NextToken().is(tok::greatergreater)) ReplaceStr = "> > "; - Diag(Tok.getLocation(), getLang().CPlusPlus0x ? + Diag(Tok.getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_two_right_angle_brackets : diag::err_two_right_angle_brackets_need_space) << FixItHint::CreateReplacement(SourceRange(Tok.getLocation()), @@ -776,7 +776,7 @@ bool Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK, SourceLocation TemplateKWLoc, UnqualifiedId &TemplateName, bool AllowTypeAnnotation) { - assert(getLang().CPlusPlus && "Can only annotate template-ids in C++"); + assert(getLangOpts().CPlusPlus && "Can only annotate template-ids in C++"); assert(Template && Tok.is(tok::less) && "Parser isn't at the beginning of a template-id"); diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp index 92ae770fa09f..1e30c7fff69c 100644 --- a/clang/lib/Parse/ParseTentative.cpp +++ b/clang/lib/Parse/ParseTentative.cpp @@ -149,7 +149,7 @@ Parser::TPResult Parser::TryParseSimpleDeclaration(bool AllowForRangeDecl) { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } @@ -258,7 +258,7 @@ bool Parser::isCXXConditionDeclaration() { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } assert(Tok.is(tok::l_paren) && "Expected '('"); @@ -276,7 +276,7 @@ bool Parser::isCXXConditionDeclaration() { if (Tok.is(tok::equal) || Tok.is(tok::kw_asm) || Tok.is(tok::kw___attribute)) TPR = TPResult::True(); - else if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) + else if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) TPR = TPResult::True(); else TPR = TPResult::False(); @@ -335,7 +335,7 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } @@ -360,7 +360,7 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) { // ',', this is a type-id. Otherwise, it's an expression. } else if (Context == TypeIdAsTemplateArgument && (Tok.is(tok::greater) || Tok.is(tok::comma) || - (getLang().CPlusPlus0x && Tok.is(tok::greatergreater)))) { + (getLangOpts().CPlusPlus0x && Tok.is(tok::greatergreater)))) { TPR = TPResult::True(); isAmbiguous = true; @@ -430,7 +430,7 @@ bool Parser::isCXX0XAttributeSpecifier (bool CheckClosing, return false; // No tentative parsing if we don't need to look for ]] - if (!CheckClosing && !getLang().ObjC1) + if (!CheckClosing && !getLangOpts().ObjC1) return true; struct TentativeReverter { @@ -1005,7 +1005,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { case tok::annot_typename: case_typename: // In Objective-C, we might have a protocol-qualified type. - if (getLang().ObjC1 && NextToken().is(tok::less)) { + if (getLangOpts().ObjC1 && NextToken().is(tok::less)) { // Tentatively parse the TentativeParsingAction PA(*this); ConsumeToken(); // The type token @@ -1022,7 +1022,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { if (isFollowedByParen) return TPResult::Ambiguous(); - if (getLang().CPlusPlus0x && isFollowedByBrace) + if (getLangOpts().CPlusPlus0x && isFollowedByBrace) return BracedCastResult; return TPResult::True(); @@ -1053,7 +1053,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { // enum E : int { a = 4 }; // enum // enum E : int { 4 }; // bit-field // }; - if (getLang().CPlusPlus0x && NextToken().is(tok::l_brace)) + if (getLangOpts().CPlusPlus0x && NextToken().is(tok::l_brace)) return BracedCastResult; if (isStartOfObjCClassMessageMissingOpenBracket()) @@ -1080,7 +1080,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { if (isFollowedByParen) return TPResult::Ambiguous(); - if (getLang().CPlusPlus0x && isFollowedByBrace) + if (getLangOpts().CPlusPlus0x && isFollowedByBrace) return BracedCastResult; return TPResult::True(); @@ -1150,7 +1150,7 @@ Parser::TPResult Parser::TryParseDeclarationSpecifier() { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 725a8f8c30b8..9613ad0f8538 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -25,7 +25,7 @@ using namespace clang; IdentifierInfo *Parser::getSEHExceptKeyword() { // __except is accepted as a (contextual) keyword - if (!Ident__except && (getLang().MicrosoftExt || getLang().Borland)) + if (!Ident__except && (getLangOpts().MicrosoftExt || getLangOpts().Borland)) Ident__except = PP.getIdentifierInfo("__except"); return Ident__except; @@ -70,7 +70,7 @@ Parser::Parser(Preprocessor &pp, Sema &actions) FPContractHandler.reset(new PragmaFPContractHandler(actions, *this)); PP.AddPragmaHandler("STDC", FPContractHandler.get()); - if (getLang().OpenCL) { + if (getLangOpts().OpenCL) { OpenCLExtensionHandler.reset( new PragmaOpenCLExtensionHandler(actions, *this)); PP.AddPragmaHandler("OPENCL", OpenCLExtensionHandler.get()); @@ -388,7 +388,7 @@ Parser::~Parser() { PP.RemovePragmaHandler(RedefineExtnameHandler.get()); RedefineExtnameHandler.reset(); - if (getLang().OpenCL) { + if (getLangOpts().OpenCL) { PP.RemovePragmaHandler("OPENCL", OpenCLExtensionHandler.get()); OpenCLExtensionHandler.reset(); PP.RemovePragmaHandler("OPENCL", FPContractHandler.get()); @@ -411,12 +411,12 @@ void Parser::Initialize() { ConsumeToken(); if (Tok.is(tok::eof) && - !getLang().CPlusPlus) // Empty source file is an extension in C + !getLangOpts().CPlusPlus) // Empty source file is an extension in C Diag(Tok, diag::ext_empty_source_file); // Initialization for Objective-C context sensitive keywords recognition. // Referenced in Parser::ParseObjCTypeQualifierList. - if (getLang().ObjC1) { + if (getLangOpts().ObjC1) { ObjCTypeQuals[objc_in] = &PP.getIdentifierTable().get("in"); ObjCTypeQuals[objc_out] = &PP.getIdentifierTable().get("out"); ObjCTypeQuals[objc_inout] = &PP.getIdentifierTable().get("inout"); @@ -431,7 +431,7 @@ void Parser::Initialize() { Ident_super = &PP.getIdentifierTable().get("super"); - if (getLang().AltiVec) { + if (getLangOpts().AltiVec) { Ident_vector = &PP.getIdentifierTable().get("vector"); Ident_pixel = &PP.getIdentifierTable().get("pixel"); } @@ -447,7 +447,7 @@ void Parser::Initialize() { Ident___exception_code = Ident___exception_info = Ident___abnormal_termination = 0; Ident_GetExceptionCode = Ident_GetExceptionInfo = Ident_AbnormalTermination = 0; - if(getLang().Borland) { + if(getLangOpts().Borland) { Ident__exception_info = PP.getIdentifierInfo("_exception_info"); Ident___exception_info = PP.getIdentifierInfo("__exception_info"); Ident_GetExceptionInfo = PP.getIdentifierInfo("GetExceptionInformation"); @@ -481,7 +481,7 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result) { Result = DeclGroupPtrTy(); if (Tok.is(tok::eof)) { // Late template parsing can begin. - if (getLang().DelayedTemplateParsing) + if (getLangOpts().DelayedTemplateParsing) Actions.SetLateTemplateParser(LateTemplateParserCallback, this); Actions.ActOnEndOfTranslationUnit(); @@ -553,7 +553,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, HandlePragmaPack(); return DeclGroupPtrTy(); case tok::semi: - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_top_level_semi : diag::ext_top_level_semi) << FixItHint::CreateRemoval(Tok.getLocation()); @@ -592,7 +592,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, return ParseObjCAtDirectives(); case tok::minus: case tok::plus: - if (!getLang().ObjC1) { + if (!getLangOpts().ObjC1) { Diag(Tok, diag::err_expected_external_declaration); ConsumeToken(); return DeclGroupPtrTy(); @@ -622,7 +622,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, case tok::kw_static: // Parse (then ignore) 'static' prior to a template instantiation. This is // a GCC extension that we intentionally do not support. - if (getLang().CPlusPlus && NextToken().is(tok::kw_template)) { + if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_template)) { Diag(ConsumeToken(), diag::warn_static_inline_explicit_inst_ignored) << 0; SourceLocation DeclEnd; @@ -632,7 +632,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, goto dont_know; case tok::kw_inline: - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { tok::TokenKind NextKind = NextToken().getKind(); // Inline namespaces. Allowed as an extension even in C++03. @@ -655,11 +655,11 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, goto dont_know; case tok::kw_extern: - if (getLang().CPlusPlus && NextToken().is(tok::kw_template)) { + if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_template)) { // Extern templates SourceLocation ExternLoc = ConsumeToken(); SourceLocation TemplateLoc = ConsumeToken(); - Diag(ExternLoc, getLang().CPlusPlus0x ? + Diag(ExternLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_extern_template : diag::ext_extern_template) << SourceRange(ExternLoc, TemplateLoc); SourceLocation DeclEnd; @@ -695,7 +695,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, /// declarator, continues a declaration or declaration list. bool Parser::isDeclarationAfterDeclarator() { // Check for '= delete' or '= default' - if (getLang().CPlusPlus && Tok.is(tok::equal)) { + if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) { const Token &KW = NextToken(); if (KW.is(tok::kw_default) || KW.is(tok::kw_delete)) return false; @@ -706,7 +706,7 @@ bool Parser::isDeclarationAfterDeclarator() { Tok.is(tok::semi) || // int X(); -> not a function def Tok.is(tok::kw_asm) || // int X() __asm__ -> not a function def Tok.is(tok::kw___attribute) || // int X() __attr__ -> not a function def - (getLang().CPlusPlus && + (getLangOpts().CPlusPlus && Tok.is(tok::l_paren)); // int X(0) -> not a function def [C++] } @@ -718,11 +718,11 @@ bool Parser::isStartOfFunctionDefinition(const ParsingDeclarator &Declarator) { return true; // Handle K&R C argument lists: int X(f) int f; {} - if (!getLang().CPlusPlus && + if (!getLangOpts().CPlusPlus && Declarator.getFunctionTypeInfo().isKNRPrototype()) return isDeclarationSpecifier(); - if (getLang().CPlusPlus && Tok.is(tok::equal)) { + if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) { const Token &KW = NextToken(); return KW.is(tok::kw_default) || KW.is(tok::kw_delete); } @@ -765,7 +765,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS, // ObjC2 allows prefix attributes on class interfaces and protocols. // FIXME: This still needs better diagnostics. We should only accept // attributes here, no types, etc. - if (getLang().ObjC2 && Tok.is(tok::at)) { + if (getLangOpts().ObjC2 && Tok.is(tok::at)) { SourceLocation AtLoc = ConsumeToken(); // the "@" if (!Tok.isObjCAtKeyword(tok::objc_interface) && !Tok.isObjCAtKeyword(tok::objc_protocol)) { @@ -791,7 +791,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS, // If the declspec consisted only of 'extern' and we have a string // literal following it, this must be a C++ linkage specifier like // 'extern "C"'. - if (Tok.is(tok::string_literal) && getLang().CPlusPlus && + if (Tok.is(tok::string_literal) && getLangOpts().CPlusPlus && DS.getStorageClassSpec() == DeclSpec::SCS_extern && DS.getParsedSpecifiers() == DeclSpec::PQ_StorageClassSpecifier) { Decl *TheDecl = ParseLinkage(DS, Declarator::FileContext); @@ -838,7 +838,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, // If this is C90 and the declspecs were completely missing, fudge in an // implicit int. We do this here because this is the only place where // declaration-specifiers are completely optional in the grammar. - if (getLang().ImplicitInt && D.getDeclSpec().isEmpty()) { + if (getLangOpts().ImplicitInt && D.getDeclSpec().isEmpty()) { const char *PrevSpec; unsigned DiagID; D.getMutableDeclSpec().SetTypeSpecType(DeclSpec::TST_int, @@ -856,7 +856,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, // We should have either an opening brace or, in a C++ constructor, // we may have a colon. if (Tok.isNot(tok::l_brace) && - (!getLang().CPlusPlus || + (!getLangOpts().CPlusPlus || (Tok.isNot(tok::colon) && Tok.isNot(tok::kw_try) && Tok.isNot(tok::equal)))) { Diag(Tok, diag::err_expected_fn_body); @@ -884,7 +884,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, // In delayed template parsing mode, for function template we consume the // tokens and store them for late parsing at the end of the translation unit. - if (getLang().DelayedTemplateParsing && + if (getLangOpts().DelayedTemplateParsing && TemplateInfo.Kind == ParsedTemplateInfo::Template) { MultiTemplateParamsArg TemplateParameterLists(Actions, TemplateInfo.TemplateParams->data(), @@ -940,7 +940,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, D.getMutableDeclSpec().abort(); if (Tok.is(tok::equal)) { - assert(getLang().CPlusPlus && "Only C++ function definitions have '='"); + assert(getLangOpts().CPlusPlus && "Only C++ function definitions have '='"); ConsumeToken(); Actions.ActOnFinishFunctionBody(Res, 0, false); @@ -948,7 +948,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, bool Delete = false; SourceLocation KWLoc; if (Tok.is(tok::kw_delete)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_deleted_function : diag::ext_deleted_function); @@ -956,7 +956,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, Actions.SetDeclDeleted(Res, KWLoc); Delete = true; } else if (Tok.is(tok::kw_default)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_defaulted_function : diag::ext_defaulted_function); @@ -1240,7 +1240,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { 0, /*IsTypename*/true)) return true; if (!SS.isSet()) { - if (getLang().MicrosoftExt) + if (getLangOpts().MicrosoftExt) Diag(Tok.getLocation(), diag::warn_expected_qualified_after_typename); else Diag(Tok.getLocation(), diag::err_expected_qualified_after_typename); @@ -1291,7 +1291,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { bool wasScopeAnnotation = Tok.is(tok::annot_cxxscope); CXXScopeSpec SS; - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(), EnteringContext)) return true; @@ -1323,7 +1323,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { return false; } - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // If we're in C, we can't have :: tokens at all (the lexer won't return // them). If the identifier is not a type, then it can't be scope either, // just early exit. @@ -1402,7 +1402,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { /// Note that this routine emits an error if you call it with ::new or ::delete /// as the current tokens, so only call it in contexts where these are invalid. bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) { - assert(getLang().CPlusPlus && + assert(getLangOpts().CPlusPlus && "Call sites of this function should be guarded by checking for C++"); assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon) || (Tok.is(tok::annot_template_id) && NextToken().is(tok::coloncolon)) || diff --git a/clang/lib/Rewrite/HTMLPrint.cpp b/clang/lib/Rewrite/HTMLPrint.cpp index 6a89265ef2c2..3d190abffcf8 100644 --- a/clang/lib/Rewrite/HTMLPrint.cpp +++ b/clang/lib/Rewrite/HTMLPrint.cpp @@ -55,7 +55,7 @@ ASTConsumer* clang::CreateHTMLPrinter(raw_ostream *OS, } void HTMLPrinter::Initialize(ASTContext &context) { - R.setSourceMgr(context.getSourceManager(), context.getLangOptions()); + R.setSourceMgr(context.getSourceManager(), context.getLangOpts()); } void HTMLPrinter::HandleTranslationUnit(ASTContext &Ctx) { diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp index 6a1e3dcdc061..dc39dde7ff1f 100644 --- a/clang/lib/Rewrite/HTMLRewrite.cpp +++ b/clang/lib/Rewrite/HTMLRewrite.cpp @@ -360,7 +360,7 @@ void html::SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP) { const SourceManager &SM = PP.getSourceManager(); const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID); - Lexer L(FID, FromFile, SM, PP.getLangOptions()); + Lexer L(FID, FromFile, SM, PP.getLangOpts()); const char *BufferStart = L.getBufferStart(); // Inform the preprocessor that we want to retain comments as tokens, so we @@ -450,7 +450,7 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) { std::vector TokenStream; const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID); - Lexer L(FID, FromFile, SM, PP.getLangOptions()); + Lexer L(FID, FromFile, SM, PP.getLangOpts()); // Lex all the tokens in raw mode, to avoid entering #includes or expanding // macros. diff --git a/clang/lib/Rewrite/RewriteMacros.cpp b/clang/lib/Rewrite/RewriteMacros.cpp index 74400c776cab..3fa0bdb74534 100644 --- a/clang/lib/Rewrite/RewriteMacros.cpp +++ b/clang/lib/Rewrite/RewriteMacros.cpp @@ -66,7 +66,7 @@ static void LexRawTokensFromMainFile(Preprocessor &PP, // Create a lexer to lex all the tokens of the main file in raw mode. Even // though it is in raw mode, it will not return comments. const llvm::MemoryBuffer *FromFile = SM.getBuffer(SM.getMainFileID()); - Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOptions()); + Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOpts()); // Switch on comment lexing because we really do want them. RawLex.SetCommentRetentionState(true); @@ -91,7 +91,7 @@ void clang::RewriteMacrosInInput(Preprocessor &PP, raw_ostream *OS) { SourceManager &SM = PP.getSourceManager(); Rewriter Rewrite; - Rewrite.setSourceMgr(SM, PP.getLangOptions()); + Rewrite.setSourceMgr(SM, PP.getLangOpts()); RewriteBuffer &RB = Rewrite.getEditBuffer(SM.getMainFileID()); std::vector RawTokens; diff --git a/clang/lib/Rewrite/RewriteModernObjC.cpp b/clang/lib/Rewrite/RewriteModernObjC.cpp index 269249d65ed5..5aea70133ea4 100644 --- a/clang/lib/Rewrite/RewriteModernObjC.cpp +++ b/clang/lib/Rewrite/RewriteModernObjC.cpp @@ -613,7 +613,7 @@ void RewriteModernObjC::InitializeCommon(ASTContext &context) { MainFileStart = MainBuf->getBufferStart(); MainFileEnd = MainBuf->getBufferEnd(); - Rewrite.setSourceMgr(Context->getSourceManager(), Context->getLangOptions()); + Rewrite.setSourceMgr(Context->getSourceManager(), Context->getLangOpts()); } //===----------------------------------------------------------------------===// diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index b317a2fb4dc5..3a59cc2bf307 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -630,7 +630,7 @@ void RewriteObjC::InitializeCommon(ASTContext &context) { MainFileStart = MainBuf->getBufferStart(); MainFileEnd = MainBuf->getBufferEnd(); - Rewrite.setSourceMgr(Context->getSourceManager(), Context->getLangOptions()); + Rewrite.setSourceMgr(Context->getSourceManager(), Context->getLangOpts()); } //===----------------------------------------------------------------------===// diff --git a/clang/lib/Rewrite/RewriteTest.cpp b/clang/lib/Rewrite/RewriteTest.cpp index c446324d3eb2..019e5e73120d 100644 --- a/clang/lib/Rewrite/RewriteTest.cpp +++ b/clang/lib/Rewrite/RewriteTest.cpp @@ -18,7 +18,7 @@ void clang::DoRewriteTest(Preprocessor &PP, raw_ostream* OS) { SourceManager &SM = PP.getSourceManager(); - const LangOptions &LangOpts = PP.getLangOptions(); + const LangOptions &LangOpts = PP.getLangOpts(); TokenRewriter Rewriter(SM.getMainFileID(), SM, LangOpts); diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 72a51bc474c0..97e00f0c5697 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -421,7 +421,7 @@ bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, // It seems sensible to prohibit private_extern too // The cl_clang_storage_class_specifiers extension enables support for // these storage-class specifiers. - if (S.getLangOptions().OpenCL && + if (S.getLangOpts().OpenCL && !S.getOpenCLOptions().cl_clang_storage_class_specifiers) { switch (SC) { case SCS_extern: @@ -440,7 +440,7 @@ bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, if (StorageClassSpec != SCS_unspecified) { // Maybe this is an attempt to use C++0x 'auto' outside of C++0x mode. bool isInvalid = true; - if (TypeSpecType == TST_unspecified && S.getLangOptions().CPlusPlus) { + if (TypeSpecType == TST_unspecified && S.getLangOpts().CPlusPlus) { if (SC == SCS_auto) return SetTypeSpecType(TST_auto, Loc, PrevSpec, DiagID); if (StorageClassSpec == SCS_auto) { @@ -866,7 +866,7 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) { TypeSpecType = TST_double; // _Complex -> _Complex double. } else if (TypeSpecType == TST_int || TypeSpecType == TST_char) { // Note that this intentionally doesn't include _Complex _Bool. - if (!PP.getLangOptions().CPlusPlus) + if (!PP.getLangOpts().CPlusPlus) Diag(D, TSTLoc, diag::ext_integer_complex); } else if (TypeSpecType != TST_float && TypeSpecType != TST_double) { Diag(D, TSCLoc, diag::err_invalid_complex_spec) @@ -880,7 +880,7 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) { // class specifier, then assume this is an attempt to use C++0x's 'auto' // type specifier. // FIXME: Does Microsoft really support implicit int in C++? - if (PP.getLangOptions().CPlusPlus && !PP.getLangOptions().MicrosoftExt && + if (PP.getLangOpts().CPlusPlus && !PP.getLangOpts().MicrosoftExt && TypeSpecType == TST_unspecified && StorageClassSpec == SCS_auto) { TypeSpecType = TST_auto; StorageClassSpec = StorageClassSpecAsWritten = SCS_unspecified; @@ -889,9 +889,9 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) { } // Diagnose if we've recovered from an ill-formed 'auto' storage class // specifier in a pre-C++0x dialect of C++. - if (!PP.getLangOptions().CPlusPlus0x && TypeSpecType == TST_auto) + if (!PP.getLangOpts().CPlusPlus0x && TypeSpecType == TST_auto) Diag(D, TSTLoc, diag::ext_auto_type_specifier); - if (PP.getLangOptions().CPlusPlus && !PP.getLangOptions().CPlusPlus0x && + if (PP.getLangOpts().CPlusPlus && !PP.getLangOpts().CPlusPlus0x && StorageClassSpec == SCS_auto) Diag(D, StorageClassSpecLoc, diag::warn_auto_storage_class) << FixItHint::CreateRemoval(StorageClassSpecLoc); diff --git a/clang/lib/Sema/IdentifierResolver.cpp b/clang/lib/Sema/IdentifierResolver.cpp index 218323134aae..4d62cab16765 100644 --- a/clang/lib/Sema/IdentifierResolver.cpp +++ b/clang/lib/Sema/IdentifierResolver.cpp @@ -97,7 +97,7 @@ IdentifierResolver::IdDeclInfo::ReplaceDecl(NamedDecl *Old, NamedDecl *New) { //===----------------------------------------------------------------------===// IdentifierResolver::IdentifierResolver(Preprocessor &PP) - : LangOpt(PP.getLangOptions()), PP(PP), + : LangOpt(PP.getLangOpts()), PP(PP), IdDeclInfos(new IdDeclInfoMap) { } diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index 9a1d023fec6b..ab786c65aab9 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -135,7 +135,7 @@ static ScopePair GetDiagForGotoScopeDecl(ASTContext &Context, const Decl *D) { return ScopePair(diag::note_protected_by_cleanup, diag::note_exits_cleanup); - if (Context.getLangOptions().ObjCAutoRefCount && VD->hasLocalStorage()) { + if (Context.getLangOpts().ObjCAutoRefCount && VD->hasLocalStorage()) { switch (VD->getType().getObjCLifetime()) { case Qualifiers::OCL_None: case Qualifiers::OCL_ExplicitNone: @@ -149,7 +149,7 @@ static ScopePair GetDiagForGotoScopeDecl(ASTContext &Context, const Decl *D) { } } - if (Context.getLangOptions().CPlusPlus && VD->hasLocalStorage()) { + if (Context.getLangOpts().CPlusPlus && VD->hasLocalStorage()) { // C++11 [stmt.dcl]p3: // A program that jumps from a point where a variable with automatic // storage duration is not in scope to a point where it is in scope @@ -654,7 +654,7 @@ static bool IsMicrosoftJumpWarning(unsigned JumpDiag, unsigned InDiagNote) { /// Return true if a particular note should be downgraded to a compatibility /// warning in C++11 mode. static bool IsCXX98CompatWarning(Sema &S, unsigned InDiagNote) { - return S.getLangOptions().CPlusPlus0x && + return S.getLangOpts().CPlusPlus0x && InDiagNote == diag::note_protected_by_variable_non_pod; } @@ -737,7 +737,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc, SmallVector ToScopesError; SmallVector ToScopesWarning; for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) { - if (S.getLangOptions().MicrosoftMode && JumpDiagWarning != 0 && + if (S.getLangOpts().MicrosoftMode && JumpDiagWarning != 0 && IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag)) ToScopesWarning.push_back(I); else if (IsCXX98CompatWarning(S, Scopes[I].InDiag)) diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 40308f07b1fb..4557a2362171 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -60,7 +60,7 @@ LambdaScopeInfo::~LambdaScopeInfo() { } PrintingPolicy Sema::getPrintingPolicy(const ASTContext &Context, const Preprocessor &PP) { PrintingPolicy Policy = Context.getPrintingPolicy(); - Policy.Bool = Context.getLangOptions().Bool; + Policy.Bool = Context.getLangOpts().Bool; if (!Policy.Bool) { if (MacroInfo *BoolMacro = PP.getMacroInfo(&Context.Idents.get("bool"))) { Policy.Bool = BoolMacro->isObjectLike() && @@ -82,8 +82,8 @@ void Sema::ActOnTranslationUnitScope(Scope *S) { Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TranslationUnitKind TUKind, CodeCompleteConsumer *CodeCompleter) - : TheTargetAttributesSema(0), FPFeatures(pp.getLangOptions()), - LangOpts(pp.getLangOptions()), PP(pp), Context(ctxt), Consumer(consumer), + : TheTargetAttributesSema(0), FPFeatures(pp.getLangOpts()), + LangOpts(pp.getLangOpts()), PP(pp), Context(ctxt), Consumer(consumer), Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()), CollectStats(false), ExternalSource(0), CodeCompleter(CodeCompleter), CurContext(0), OriginalLexicalContext(0), @@ -107,10 +107,10 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, for (unsigned I = 0; I != NSAPI::NumNSNumberLiteralMethods; ++I) NSNumberLiteralMethods[I] = 0; - if (getLangOptions().ObjC1) + if (getLangOpts().ObjC1) NSAPIObj.reset(new NSAPI(Context)); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) FieldCollector.reset(new CXXFieldCollector()); // Tell diagnostics how to render things from the AST library. @@ -152,7 +152,7 @@ void Sema::Initialize() { // Initialize predefined Objective-C types: - if (PP.getLangOptions().ObjC1) { + if (PP.getLangOpts().ObjC1) { // If 'SEL' does not yet refer to any declarations, make it refer to the // predefined 'SEL'. DeclarationName SEL = &Context.Idents.get("SEL"); @@ -265,7 +265,7 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty, if (ExprTy == TypeTy) return Owned(E); - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) CheckObjCARCConversion(SourceRange(), Ty, E, CCK); // If this is a derived-to-base cast to a through a virtual base, we @@ -698,7 +698,7 @@ Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() { // make access control a part of SFINAE for the purposes of checking // type traits. if (!SemaRef.AccessCheckingSFINAE && - !SemaRef.getLangOptions().CPlusPlus0x) + !SemaRef.getLangOpts().CPlusPlus0x) break; SourceLocation Loc = getLocation(); diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index 57d5e43f9684..ea74346c163b 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -1274,7 +1274,7 @@ static AccessResult CheckEffectiveAccess(Sema &S, AccessTarget &Entity) { assert(Entity.getAccess() != AS_public && "called for public access!"); - if (S.getLangOptions().MicrosoftMode && + if (S.getLangOpts().MicrosoftMode && IsMicrosoftUsingDeclarationAccessBug(S, Loc, Entity)) return AR_accessible; @@ -1394,7 +1394,7 @@ void Sema::HandleDependentAccessCheck(const DependentDiagnostic &DD, Sema::AccessResult Sema::CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || !E->getNamingClass() || Found.getAccess() == AS_public) return AR_accessible; @@ -1410,7 +1410,7 @@ Sema::AccessResult Sema::CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, /// access which has now been resolved to a member. Sema::AccessResult Sema::CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Found.getAccess() == AS_public) return AR_accessible; @@ -1428,7 +1428,7 @@ Sema::AccessResult Sema::CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, Sema::AccessResult Sema::CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag) { - if (!getLangOptions().AccessControl) + if (!getLangOpts().AccessControl) return AR_accessible; // There's never a path involved when checking implicit destructor access. @@ -1451,7 +1451,7 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc, const InitializedEntity &Entity, AccessSpecifier Access, bool IsCopyBindingRefToTemp) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Access == AS_public) return AR_accessible; @@ -1498,7 +1498,7 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc, CXXConstructorDecl *Constructor, AccessSpecifier Access, PartialDiagnostic PD) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Access == AS_public) return AR_accessible; @@ -1517,7 +1517,7 @@ Sema::AccessResult Sema::CheckDirectMemberAccess(SourceLocation UseLoc, NamedDecl *Target, const PartialDiagnostic &Diag) { AccessSpecifier Access = Target->getAccess(); - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Access == AS_public) return AR_accessible; @@ -1536,7 +1536,7 @@ Sema::AccessResult Sema::CheckAllocationAccess(SourceLocation OpLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found, bool Diagnose) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || !NamingClass || Found.getAccess() == AS_public) return AR_accessible; @@ -1556,7 +1556,7 @@ Sema::AccessResult Sema::CheckMemberOperatorAccess(SourceLocation OpLoc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Found.getAccess() == AS_public) return AR_accessible; @@ -1574,7 +1574,7 @@ Sema::AccessResult Sema::CheckMemberOperatorAccess(SourceLocation OpLoc, Sema::AccessResult Sema::CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Found.getAccess() == AS_none || Found.getAccess() == AS_public) return AR_accessible; @@ -1606,7 +1606,7 @@ Sema::AccessResult Sema::CheckBaseClassAccess(SourceLocation AccessLoc, unsigned DiagID, bool ForceCheck, bool ForceUnprivileged) { - if (!ForceCheck && !getLangOptions().AccessControl) + if (!ForceCheck && !getLangOpts().AccessControl) return AR_accessible; if (Path.Access == AS_public) @@ -1635,7 +1635,7 @@ Sema::AccessResult Sema::CheckBaseClassAccess(SourceLocation AccessLoc, /// Checks access to all the declarations in the given result set. void Sema::CheckLookupAccess(const LookupResult &R) { - assert(getLangOptions().AccessControl + assert(getLangOpts().AccessControl && "performing access check without access control"); assert(R.getNamingClass() && "performing access check without naming class"); diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp index 8b438a48014f..e935fc735b23 100644 --- a/clang/lib/Sema/SemaAttr.cpp +++ b/clang/lib/Sema/SemaAttr.cpp @@ -378,7 +378,7 @@ void Sema::ActOnPragmaFPContract(tok::OnOffSwitch OOS) { FPFeatures.fp_contract = 0; break; case tok::OOS_DEFAULT: - FPFeatures.fp_contract = getLangOptions().DefaultFPContract; + FPFeatures.fp_contract = getLangOpts().DefaultFPContract; break; } } diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index b307fe086d1a..1c414dda5d73 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -186,7 +186,7 @@ bool Sema::isUnknownSpecialization(const CXXScopeSpec &SS) { /// /// \param NNS a dependent nested name specifier. CXXRecordDecl *Sema::getCurrentInstantiationOf(NestedNameSpecifier *NNS) { - assert(getLangOptions().CPlusPlus && "Only callable in C++"); + assert(getLangOpts().CPlusPlus && "Only callable in C++"); assert(NNS->isDependent() && "Only dependent nested-name-specifier allowed"); if (!NNS->getAsType()) @@ -274,11 +274,11 @@ bool Sema::isAcceptableNestedNameSpecifier(NamedDecl *SD) { return true; else if (TypedefNameDecl *TD = dyn_cast(SD)) { if (TD->getUnderlyingType()->isRecordType() || - (Context.getLangOptions().CPlusPlus0x && + (Context.getLangOpts().CPlusPlus0x && TD->getUnderlyingType()->isEnumeralType())) return true; } else if (isa(SD) || - (Context.getLangOptions().CPlusPlus0x && isa(SD))) + (Context.getLangOpts().CPlusPlus0x && isa(SD))) return true; return false; @@ -502,8 +502,8 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, if ((Corrected = CorrectTypo(Found.getLookupNameInfo(), Found.getLookupKind(), S, &SS, Validator, LookupCtx, EnteringContext))) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); if (LookupCtx) Diag(Found.getNameLoc(), diag::err_no_member_suggest) << Name << LookupCtx << CorrectedQuotedStr << SS.getRange() @@ -652,7 +652,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // public: // void foo() { D::foo2(); } // }; - if (getLangOptions().MicrosoftExt) { + if (getLangOpts().MicrosoftExt) { DeclContext *DC = LookupCtx ? LookupCtx : CurContext; if (DC->isDependentContext() && DC->isFunctionOrMethod()) { SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc); @@ -705,7 +705,7 @@ bool Sema::ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc()); if (!T->isDependentType() && !T->getAs()) { Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class) - << T << getLangOptions().CPlusPlus; + << T << getLangOpts().CPlusPlus; return true; } diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index 802979f61bca..54683e127ec1 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -118,7 +118,7 @@ namespace { } void checkObjCARCConversion(Sema::CheckedConversionKind CCK) { - assert(Self.getLangOptions().ObjCAutoRefCount); + assert(Self.getLangOpts().ObjCAutoRefCount); Expr *src = SrcExpr.get(); if (Self.CheckObjCARCConversion(OpRange, DestType, src, CCK) == @@ -222,7 +222,7 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, if (D.isInvalidType()) return ExprError(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -462,7 +462,7 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, // If the only checking we care about is for Objective-C lifetime qualifiers, // and we're not in ARC mode, there's nothing to check. if (!CheckCVR && CheckObjCLifetime && - !Self.Context.getLangOptions().ObjCAutoRefCount) + !Self.Context.getLangOpts().ObjCAutoRefCount) return false; // Casting away constness is defined in C++ 5.2.11p8 with reference to @@ -710,7 +710,7 @@ void CastOperation::CheckReinterpretCast() { diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(), DestType, /*listInitialization=*/false); } - } else if (tcr == TC_Success && Self.getLangOptions().ObjCAutoRefCount) { + } else if (tcr == TC_Success && Self.getLangOpts().ObjCAutoRefCount) { checkObjCARCConversion(Sema::CCK_OtherCast); } } @@ -772,7 +772,7 @@ void CastOperation::CheckStaticCast() { } else if (tcr == TC_Success) { if (Kind == CK_BitCast) checkCastAlign(); - if (Self.getLangOptions().ObjCAutoRefCount) + if (Self.getLangOpts().ObjCAutoRefCount) checkObjCARCConversion(Sema::CCK_OtherCast); } else if (Kind == CK_BitCast) { checkCastAlign(); @@ -1664,7 +1664,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, // integral type size doesn't matter. if ((Self.Context.getTypeSize(SrcType) > Self.Context.getTypeSize(DestType)) && - !Self.getLangOptions().MicrosoftExt) { + !Self.getLangOpts().MicrosoftExt) { msg = diag::err_bad_reinterpret_cast_small_int; return TC_Failed; } @@ -1738,7 +1738,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, // FIXME: Conditionally-supported behavior should be configurable in the // TargetInfo or similar. Self.Diag(OpRange.getBegin(), - Self.getLangOptions().CPlusPlus0x ? + Self.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_cast_fn_obj : diag::ext_cast_fn_obj) << OpRange; return TC_Success; @@ -1747,7 +1747,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, if (DestType->isFunctionPointerType()) { // See above. Self.Diag(OpRange.getBegin(), - Self.getLangOptions().CPlusPlus0x ? + Self.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_cast_fn_obj : diag::ext_cast_fn_obj) << OpRange; return TC_Success; @@ -1858,7 +1858,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle, } } - if (Self.getLangOptions().ObjCAutoRefCount && tcr == TC_Success) + if (Self.getLangOpts().ObjCAutoRefCount && tcr == TC_Success) checkObjCARCConversion(CCK); if (tcr != TC_Success && msg != 0) { @@ -1887,7 +1887,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle, /// Check the semantics of a C-style cast operation, in C. void CastOperation::CheckCStyleCast() { - assert(!Self.getLangOptions().CPlusPlus); + assert(!Self.getLangOpts().CPlusPlus); // C-style casts can resolve __unknown_any types. if (claimPlaceholder(BuiltinType::UnknownAny)) { @@ -2033,7 +2033,7 @@ void CastOperation::CheckCStyleCast() { } // ARC imposes extra restrictions on casts. - if (Self.getLangOptions().ObjCAutoRefCount) { + if (Self.getLangOpts().ObjCAutoRefCount) { checkObjCARCConversion(Sema::CCK_CStyleCast); if (SrcExpr.isInvalid()) return; @@ -2078,7 +2078,7 @@ ExprResult Sema::BuildCStyleCastExpr(SourceLocation LPLoc, Op.DestRange = CastTypeInfo->getTypeLoc().getSourceRange(); Op.OpRange = SourceRange(LPLoc, CastExpr->getLocEnd()); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Op.CheckCXXCStyleCast(/*FunctionalStyle=*/ false, isa(CastExpr)); } else { diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index f546bbe1fdb6..f00a655f59c4 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -43,7 +43,7 @@ using namespace sema; SourceLocation Sema::getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const { return SL->getLocationOfByte(ByteNo, PP.getSourceManager(), - PP.getLangOptions(), PP.getTargetInfo()); + PP.getLangOpts(), PP.getTargetInfo()); } /// Checks that a call expression's argument count is the desired number. @@ -2214,7 +2214,7 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyze_printf::PrintfSpecifier LM.getLength()))); if (!FS.hasStandardLengthModifier()) HandleNonStandardLengthModifier(LM, startSpecifier, specifierLen); - if (!FS.hasStandardConversionSpecifier(S.getLangOptions())) + if (!FS.hasStandardConversionSpecifier(S.getLangOpts())) HandleNonStandardConversionSpecifier(CS, startSpecifier, specifierLen); if (!FS.hasStandardLengthConversionCombination()) HandleNonStandardConversionSpecification(LM, CS, startSpecifier, @@ -2257,7 +2257,7 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyze_printf::PrintfSpecifier // We may be able to offer a FixItHint if it is a supported type. PrintfSpecifier fixedFS = FS; - bool success = fixedFS.fixType(Ex->getType(), S.getLangOptions(), + bool success = fixedFS.fixType(Ex->getType(), S.getLangOpts(), S.Context, IsObjCLiteral); if (success) { @@ -2407,7 +2407,7 @@ bool CheckScanfHandler::HandleScanfSpecifier( if (!FS.hasStandardLengthModifier()) HandleNonStandardLengthModifier(LM, startSpecifier, specifierLen); - if (!FS.hasStandardConversionSpecifier(S.getLangOptions())) + if (!FS.hasStandardConversionSpecifier(S.getLangOpts())) HandleNonStandardConversionSpecifier(CS, startSpecifier, specifierLen); if (!FS.hasStandardLengthConversionCombination()) HandleNonStandardConversionSpecification(LM, CS, startSpecifier, @@ -2425,7 +2425,7 @@ bool CheckScanfHandler::HandleScanfSpecifier( const analyze_scanf::ScanfArgTypeResult &ATR = FS.getArgType(S.Context); if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType())) { ScanfSpecifier fixedFS = FS; - bool success = fixedFS.fixType(Ex->getType(), S.getLangOptions(), + bool success = fixedFS.fixType(Ex->getType(), S.getLangOpts(), S.Context); if (success) { @@ -2496,7 +2496,7 @@ void Sema::CheckFormatString(const StringLiteral *FExpr, inFunctionCall); if (!analyze_format_string::ParsePrintfString(H, Str, Str + StrLen, - getLangOptions())) + getLangOpts())) H.DoneProcessing(); } else if (Type == FST_Scanf) { CheckScanfHandler H(*this, FExpr, OrigFormatExpr, firstDataArg, @@ -2505,7 +2505,7 @@ void Sema::CheckFormatString(const StringLiteral *FExpr, inFunctionCall); if (!analyze_format_string::ParseScanfString(H, Str, Str + StrLen, - getLangOptions())) + getLangOpts())) H.DoneProcessing(); } // TODO: handle other formats } @@ -2891,7 +2891,7 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType, // Perform checking for returned stack addresses, local blocks, // label addresses or references to temporaries. if (lhsType->isPointerType() || - (!getLangOptions().ObjCAutoRefCount && lhsType->isBlockPointerType())) { + (!getLangOpts().ObjCAutoRefCount && lhsType->isBlockPointerType())) { stackE = EvalAddr(RetValExp, refVars); } else if (lhsType->isReferenceType()) { stackE = EvalVal(RetValExp, refVars); @@ -4138,7 +4138,7 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T, // In C, we pretend that the type of an EnumConstantDecl is its enumeration // type, to give us better diagnostics. QualType SourceType = E->getType(); - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { if (DeclRefExpr *DRE = dyn_cast(E)) if (EnumConstantDecl *ECD = dyn_cast(DRE->getDecl())) { EnumDecl *Enum = cast(ECD->getDeclContext()); @@ -4338,7 +4338,7 @@ bool Sema::CheckParmsForFunctionDef(ParmVarDecl **P, ParmVarDecl **PEnd, if (CheckParameterNames && Param->getIdentifier() == 0 && !Param->isImplicit() && - !getLangOptions().CPlusPlus) + !getLangOpts().CPlusPlus) Diag(Param->getLocation(), diag::err_parameter_name_omitted); // C99 6.7.5.3p12: diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index df2768ccc232..21a5cfa79d1b 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -533,7 +533,7 @@ bool ResultBuilder::isInterestingDecl(NamedDecl *ND, // Filter out any unwanted results. if (Filter && !(this->*Filter)(ND)) { // Check whether it is interesting as a nested-name-specifier. - if (AllowNestedNameSpecifiers && SemaRef.getLangOptions().CPlusPlus && + if (AllowNestedNameSpecifiers && SemaRef.getLangOpts().CPlusPlus && IsNestedNameSpecifier(ND) && (Filter != &ResultBuilder::IsMember || (isa(ND) && @@ -553,7 +553,7 @@ bool ResultBuilder::CheckHiddenResult(Result &R, DeclContext *CurContext, // In C, there is no way to refer to a hidden name. // FIXME: This isn't true; we can find a tag name hidden by an ordinary // name if we introduce the tag type. - if (!SemaRef.getLangOptions().CPlusPlus) + if (!SemaRef.getLangOpts().CPlusPlus) return true; DeclContext *HiddenCtx = R.Declaration->getDeclContext()->getRedeclContext(); @@ -732,7 +732,7 @@ void ResultBuilder::AdjustResultPriorityForDecl(Result &R) { } void ResultBuilder::MaybeAddConstructorResults(Result R) { - if (!SemaRef.getLangOptions().CPlusPlus || !R.Declaration || + if (!SemaRef.getLangOpts().CPlusPlus || !R.Declaration || !CompletionContext.wantConstructorResults()) return; @@ -988,9 +988,9 @@ bool ResultBuilder::IsOrdinaryName(NamedDecl *ND) const { ND = cast(ND->getUnderlyingDecl()); unsigned IDNS = Decl::IDNS_Ordinary; - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Tag | Decl::IDNS_Namespace | Decl::IDNS_Member; - else if (SemaRef.getLangOptions().ObjC1) { + else if (SemaRef.getLangOpts().ObjC1) { if (isa(ND)) return true; } @@ -1006,9 +1006,9 @@ bool ResultBuilder::IsOrdinaryNonTypeName(NamedDecl *ND) const { return false; unsigned IDNS = Decl::IDNS_Ordinary; - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Tag | Decl::IDNS_Namespace | Decl::IDNS_Member; - else if (SemaRef.getLangOptions().ObjC1) { + else if (SemaRef.getLangOpts().ObjC1) { if (isa(ND)) return true; } @@ -1033,7 +1033,7 @@ bool ResultBuilder::IsOrdinaryNonValueName(NamedDecl *ND) const { ND = cast(ND->getUnderlyingDecl()); unsigned IDNS = Decl::IDNS_Ordinary; - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Tag | Decl::IDNS_Namespace; return (ND->getIdentifierNamespace() & IDNS) && @@ -1135,7 +1135,7 @@ static bool isObjCReceiverType(ASTContext &C, QualType T) { break; } - if (!C.getLangOptions().CPlusPlus) + if (!C.getLangOpts().CPlusPlus) return false; // FIXME: We could perform more analysis here to determine whether a @@ -1165,8 +1165,8 @@ bool ResultBuilder::IsObjCMessageReceiverOrLambdaCapture(NamedDecl *ND) const { } bool ResultBuilder::IsObjCCollection(NamedDecl *ND) const { - if ((SemaRef.getLangOptions().CPlusPlus && !IsOrdinaryName(ND)) || - (!SemaRef.getLangOptions().CPlusPlus && !IsOrdinaryNonTypeName(ND))) + if ((SemaRef.getLangOpts().CPlusPlus && !IsOrdinaryName(ND)) || + (!SemaRef.getLangOpts().CPlusPlus && !IsOrdinaryNonTypeName(ND))) return false; QualType T = getDeclUsageType(SemaRef.Context, ND); @@ -1176,7 +1176,7 @@ bool ResultBuilder::IsObjCCollection(NamedDecl *ND) const { T = SemaRef.Context.getBaseElementType(T); return T->isObjCObjectType() || T->isObjCObjectPointerType() || T->isObjCIdType() || - (SemaRef.getLangOptions().CPlusPlus && T->isRecordType()); + (SemaRef.getLangOpts().CPlusPlus && T->isRecordType()); } bool ResultBuilder::IsImpossibleToSatisfy(NamedDecl *ND) const { @@ -1464,7 +1464,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, typedef CodeCompletionResult Result; switch (CCC) { case Sema::PCC_Namespace: - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { if (Results.includeCodePatterns()) { // namespace { declarations } Builder.AddTypedTextChunk("namespace"); @@ -1509,14 +1509,14 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, } } - if (SemaRef.getLangOptions().ObjC1) + if (SemaRef.getLangOpts().ObjC1) AddObjCTopLevelResults(Results, true); AddTypedefResult(Results); // Fall through case Sema::PCC_Class: - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { // Using declaration Builder.AddTypedTextChunk("using"); Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); @@ -1560,7 +1560,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, case Sema::PCC_Template: case Sema::PCC_MemberTemplate: - if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) { + if (SemaRef.getLangOpts().CPlusPlus && Results.includeCodePatterns()) { // template < parameters > Builder.AddTypedTextChunk("template"); Builder.AddChunk(CodeCompletionString::CK_LeftAngle); @@ -1569,32 +1569,32 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Results.AddResult(Result(Builder.TakeString())); } - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); - AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); + AddFunctionSpecifiers(CCC, SemaRef.getLangOpts(), Results); break; case Sema::PCC_ObjCInterface: - AddObjCInterfaceResults(SemaRef.getLangOptions(), Results, true); - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); - AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddObjCInterfaceResults(SemaRef.getLangOpts(), Results, true); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); + AddFunctionSpecifiers(CCC, SemaRef.getLangOpts(), Results); break; case Sema::PCC_ObjCImplementation: - AddObjCImplementationResults(SemaRef.getLangOptions(), Results, true); - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); - AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddObjCImplementationResults(SemaRef.getLangOpts(), Results, true); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); + AddFunctionSpecifiers(CCC, SemaRef.getLangOpts(), Results); break; case Sema::PCC_ObjCInstanceVariableList: - AddObjCVisibilityResults(SemaRef.getLangOptions(), Results, true); + AddObjCVisibilityResults(SemaRef.getLangOpts(), Results, true); break; case Sema::PCC_RecoveryInFunction: case Sema::PCC_Statement: { AddTypedefResult(Results); - if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns() && - SemaRef.getLangOptions().CXXExceptions) { + if (SemaRef.getLangOpts().CPlusPlus && Results.includeCodePatterns() && + SemaRef.getLangOpts().CXXExceptions) { Builder.AddTypedTextChunk("try"); Builder.AddChunk(CodeCompletionString::CK_LeftBrace); Builder.AddPlaceholderChunk("statements"); @@ -1610,14 +1610,14 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddChunk(CodeCompletionString::CK_RightBrace); Results.AddResult(Result(Builder.TakeString())); } - if (SemaRef.getLangOptions().ObjC1) + if (SemaRef.getLangOpts().ObjC1) AddObjCStatementResults(Results, true); if (Results.includeCodePatterns()) { // if (condition) { statements } Builder.AddTypedTextChunk("if"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -1631,7 +1631,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // switch (condition) { } Builder.AddTypedTextChunk("switch"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -1661,7 +1661,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, /// while (condition) { statements } Builder.AddTypedTextChunk("while"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -1687,7 +1687,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // for ( for-init-statement ; condition ; expression ) { statements } Builder.AddTypedTextChunk("for"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus || SemaRef.getLangOptions().C99) + if (SemaRef.getLangOpts().CPlusPlus || SemaRef.getLangOpts().C99) Builder.AddPlaceholderChunk("init-statement"); else Builder.AddPlaceholderChunk("init-expression"); @@ -1752,11 +1752,11 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // Fall through (for statement expressions). case Sema::PCC_ForInit: case Sema::PCC_Condition: - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); // Fall through: conditions and statements can have expressions. case Sema::PCC_ParenthesizedExpression: - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && CCC == Sema::PCC_ParenthesizedExpression) { // (__bridge ) Builder.AddTypedTextChunk("__bridge"); @@ -1785,7 +1785,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // Fall through case Sema::PCC_Expression: { - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { // 'this', if we're in a non-static member function. addThisCompletion(SemaRef, Results); @@ -1799,7 +1799,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddTypedTextChunk("false"); Results.AddResult(Result(Builder.TakeString())); - if (SemaRef.getLangOptions().RTTI) { + if (SemaRef.getLangOpts().RTTI) { // dynamic_cast < type-id > ( expression ) Builder.AddTypedTextChunk("dynamic_cast"); Builder.AddChunk(CodeCompletionString::CK_LeftAngle); @@ -1841,7 +1841,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddChunk(CodeCompletionString::CK_RightParen); Results.AddResult(Result(Builder.TakeString())); - if (SemaRef.getLangOptions().RTTI) { + if (SemaRef.getLangOpts().RTTI) { // typeid ( expression-or-type ) Builder.AddResultTypeChunk("std::type_info"); Builder.AddTypedTextChunk("typeid"); @@ -1889,7 +1889,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddPlaceholderChunk("expression"); Results.AddResult(Result(Builder.TakeString())); - if (SemaRef.getLangOptions().CXXExceptions) { + if (SemaRef.getLangOpts().CXXExceptions) { // throw expression Builder.AddResultTypeChunk("void"); Builder.AddTypedTextChunk("throw"); @@ -1900,7 +1900,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // FIXME: Rethrow? - if (SemaRef.getLangOptions().CPlusPlus0x) { + if (SemaRef.getLangOpts().CPlusPlus0x) { // nullptr Builder.AddResultTypeChunk("std::nullptr_t"); Builder.AddTypedTextChunk("nullptr"); @@ -1932,7 +1932,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, } } - if (SemaRef.getLangOptions().ObjC1) { + if (SemaRef.getLangOpts().ObjC1) { // Add "super", if we're in an Objective-C class with a superclass. if (ObjCMethodDecl *Method = SemaRef.getCurMethodDecl()) { // The interface can be NULL. @@ -1967,10 +1967,10 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, break; } - if (WantTypesInContext(CCC, SemaRef.getLangOptions())) - AddTypeSpecifierResults(SemaRef.getLangOptions(), Results); + if (WantTypesInContext(CCC, SemaRef.getLangOpts())) + AddTypeSpecifierResults(SemaRef.getLangOpts(), Results); - if (SemaRef.getLangOptions().CPlusPlus && CCC != Sema::PCC_Type) + if (SemaRef.getLangOpts().CPlusPlus && CCC != Sema::PCC_Type) Results.AddResult(Result("operator")); } @@ -2016,7 +2016,7 @@ static void MaybeAddSentinel(ASTContext &Context, NamedDecl *FunctionOrMethod, CodeCompletionBuilder &Result) { if (SentinelAttr *Sentinel = FunctionOrMethod->getAttr()) if (Sentinel->getSentinel() == 0) { - if (Context.getLangOptions().ObjC1 && + if (Context.getLangOpts().ObjC1 && Context.Idents.get("nil").hasMacroDefinition()) Result.AddTextChunk(", nil"); else if (Context.Idents.get("NULL").hasMacroDefinition()) @@ -2872,7 +2872,7 @@ static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, M != MEnd; ++M) { Results.AddResult(Result(M->first, getMacroUsagePriority(M->first->getName(), - PP.getLangOptions(), + PP.getLangOpts(), TargetTypeIsPointer))); } @@ -2932,8 +2932,8 @@ static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S, return CodeCompletionContext::CCC_Recovery; case Sema::PCC_ForInit: - if (S.getLangOptions().CPlusPlus || S.getLangOptions().C99 || - S.getLangOptions().ObjC1) + if (S.getLangOpts().CPlusPlus || S.getLangOpts().C99 || + S.getLangOpts().ObjC1) return CodeCompletionContext::CCC_ParenthesizedExpression; else return CodeCompletionContext::CCC_Expression; @@ -3113,12 +3113,12 @@ void Sema::CodeCompleteOrdinaryName(Scope *S, case PCC_Expression: case PCC_ForInit: case PCC_Condition: - if (WantTypesInContext(CompletionContext, getLangOptions())) + if (WantTypesInContext(CompletionContext, getLangOpts())) Results.setFilter(&ResultBuilder::IsOrdinaryName); else Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) MaybeAddOverrideCalls(*this, /*InContext=*/0, Results); break; @@ -3147,7 +3147,7 @@ void Sema::CodeCompleteOrdinaryName(Scope *S, case PCC_Statement: case PCC_RecoveryInFunction: if (S->getFnParent()) - AddPrettyFunctionResults(PP.getLangOptions(), Results); + AddPrettyFunctionResults(PP.getLangOpts(), Results); break; case PCC_Namespace: @@ -3192,10 +3192,10 @@ void Sema::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, // Type qualifiers can come after names. Results.AddResult(Result("const")); Results.AddResult(Result("volatile")); - if (getLangOptions().C99) + if (getLangOpts().C99) Results.AddResult(Result("restrict")); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (AllowNonIdentifiers) { Results.AddResult(Result("operator")); } @@ -3266,7 +3266,7 @@ void Sema::CodeCompleteExpression(Scope *S, Results.setFilter(&ResultBuilder::IsObjCCollection); else if (Data.IntegralConstantExpression) Results.setFilter(&ResultBuilder::IsIntegralConstantValue); - else if (WantTypesInContext(PCC_Expression, getLangOptions())) + else if (WantTypesInContext(PCC_Expression, getLangOpts())) Results.setFilter(&ResultBuilder::IsOrdinaryName); else Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName); @@ -3295,7 +3295,7 @@ void Sema::CodeCompleteExpression(Scope *S, if (S->getFnParent() && !Data.ObjCCollection && !Data.IntegralConstantExpression) - AddPrettyFunctionResults(PP.getLangOptions(), Results); + AddPrettyFunctionResults(PP.getLangOpts(), Results); if (CodeCompleter->includeMacros()) AddMacroResults(PP, Results, PreferredTypeIsPointer); @@ -3308,7 +3308,7 @@ void Sema::CodeCompleteExpression(Scope *S, void Sema::CodeCompletePostfixExpression(Scope *S, ExprResult E) { if (E.isInvalid()) CodeCompleteOrdinaryName(S, PCC_RecoveryInFunction); - else if (getLangOptions().ObjC1) + else if (getLangOpts().ObjC1) CodeCompleteObjCInstanceMessage(S, E.take(), 0, 0, false); } @@ -3470,7 +3470,7 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, LookupVisibleDecls(Record->getDecl(), LookupMemberName, Consumer, CodeCompleter->includeGlobals()); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (!Results.empty()) { // The "template" keyword can follow "->" or "." in the grammar. // However, we only want to suggest the template keyword if something @@ -3590,7 +3590,7 @@ void Sema::CodeCompleteTypeQualifiers(DeclSpec &DS) { Results.AddResult("const"); if (!(DS.getTypeQualifiers() & DeclSpec::TQ_volatile)) Results.AddResult("volatile"); - if (getLangOptions().C99 && + if (getLangOpts().C99 && !(DS.getTypeQualifiers() & DeclSpec::TQ_restrict)) Results.AddResult("restrict"); Results.ExitScope(); @@ -3655,7 +3655,7 @@ void Sema::CodeCompleteCase(Scope *S) { } } - if (getLangOptions().CPlusPlus && !Qualifier && EnumeratorsSeen.empty()) { + if (getLangOpts().CPlusPlus && !Qualifier && EnumeratorsSeen.empty()) { // If there are no prior enumerators in C++, check whether we have to // qualify the names of the enumerators that we suggest, because they // may not be visible in this scope. @@ -3755,7 +3755,7 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, else if (DeclRefExpr *DRE = dyn_cast(NakedFn)) { FunctionDecl *FDecl = dyn_cast(DRE->getDecl()); if (FDecl) { - if (!getLangOptions().CPlusPlus || + if (!getLangOpts().CPlusPlus || !FDecl->getType()->getAs()) Results.push_back(ResultCandidate(FDecl)); else @@ -3883,7 +3883,7 @@ void Sema::CodeCompleteAfterIf(Scope *S) { Builder.AddTextChunk("if"); Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -3901,7 +3901,7 @@ void Sema::CodeCompleteAfterIf(Scope *S) { Results.ExitScope(); if (S->getFnParent()) - AddPrettyFunctionResults(PP.getLangOptions(), Results); + AddPrettyFunctionResults(PP.getLangOpts(), Results); if (CodeCompleter->includeMacros()) AddMacroResults(PP, Results); @@ -4085,7 +4085,7 @@ void Sema::CodeCompleteOperatorName(Scope *S) { CodeCompleter->includeGlobals()); // Add any type specifiers - AddTypeSpecifierResults(getLangOptions(), Results); + AddTypeSpecifierResults(getLangOpts(), Results); Results.ExitScope(); HandleCodeCompleteResults(this, CodeCompleter, @@ -4350,9 +4350,9 @@ void Sema::CodeCompleteObjCAtDirective(Scope *S) { CodeCompletionContext::CCC_Other); Results.EnterNewScope(); if (isa(CurContext)) - AddObjCImplementationResults(getLangOptions(), Results, false); + AddObjCImplementationResults(getLangOpts(), Results, false); else if (CurContext->isObjCContainer()) - AddObjCInterfaceResults(getLangOptions(), Results, false); + AddObjCInterfaceResults(getLangOpts(), Results, false); else AddObjCTopLevelResults(Results, false); Results.ExitScope(); @@ -4367,8 +4367,8 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) { // @encode ( type-name ) const char *EncodeType = "char[]"; - if (Results.getSema().getLangOptions().CPlusPlus || - Results.getSema().getLangOptions().ConstStrings) + if (Results.getSema().getLangOpts().CPlusPlus || + Results.getSema().getLangOpts().ConstStrings) EncodeType = " const char[]"; Builder.AddResultTypeChunk(EncodeType); Builder.AddTypedTextChunk(OBJC_AT_KEYWORD_NAME(NeedAt,encode)); @@ -4474,7 +4474,7 @@ void Sema::CodeCompleteObjCAtVisibility(Scope *S) { ResultBuilder Results(*this, CodeCompleter->getAllocator(), CodeCompletionContext::CCC_Other); Results.EnterNewScope(); - AddObjCVisibilityResults(getLangOptions(), Results, false); + AddObjCVisibilityResults(getLangOpts(), Results, false); Results.ExitScope(); HandleCodeCompleteResults(this, CodeCompleter, CodeCompletionContext::CCC_Other, @@ -5076,7 +5076,7 @@ void Sema::CodeCompleteObjCMessageReceiver(Scope *S) { typedef CodeCompletionResult Result; ResultBuilder Results(*this, CodeCompleter->getAllocator(), CodeCompletionContext::CCC_ObjCMessageReceiver, - getLangOptions().CPlusPlus0x + getLangOpts().CPlusPlus0x ? &ResultBuilder::IsObjCMessageReceiverOrLambdaCapture : &ResultBuilder::IsObjCMessageReceiver); @@ -5095,7 +5095,7 @@ void Sema::CodeCompleteObjCMessageReceiver(Scope *S) { AddSuperSendCompletion(*this, /*NeedSuperKeyword=*/true, 0, 0, Results); } - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) addThisCompletion(*this, Results); Results.ExitScope(); @@ -6763,7 +6763,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S, // Add Key-Value-Coding and Key-Value-Observing accessor methods for all of // the properties in this class and its categories. - if (Context.getLangOptions().ObjC2) { + if (Context.getLangOpts().ObjC2) { SmallVector Containers; Containers.push_back(SearchDecl); @@ -6975,7 +6975,7 @@ void Sema::CodeCompletePreprocessorDirective(bool InConditional) { Builder.AddPlaceholderChunk("arguments"); Results.AddResult(Builder.TakeString()); - if (getLangOptions().ObjC1) { + if (getLangOpts().ObjC1) { // #import "header" Builder.AddTypedTextChunk("import"); Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index f6e3aa721586..a9c1ec1cd686 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -191,7 +191,7 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, // Ignore a correction to a template type as the to-be-corrected // identifier is not a template (typo correction for template names // is handled elsewhere). - !(getLangOptions().CPlusPlus && NewSSPtr && + !(getLangOpts().CPlusPlus && NewSSPtr && isTemplateName(S, *NewSSPtr, false, TemplateName, ParsedType(), false, Template, MemberOfUnknownSpecialization))) { ParsedType Ty = getTypeName(*NewII, NameLoc, S, NewSSPtr, @@ -199,9 +199,9 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, IsCtorOrDtorName, WantNontrivialTypeSourceInfo); if (Ty) { - std::string CorrectedStr(Correction.getAsString(getLangOptions())); + std::string CorrectedStr(Correction.getAsString(getLangOpts())); std::string CorrectedQuotedStr( - Correction.getQuoted(getLangOptions())); + Correction.getQuoted(getLangOpts())); Diag(NameLoc, diag::err_unknown_typename_suggest) << Result.getLookupName() << CorrectedQuotedStr << FixItHint::CreateReplacement(SourceRange(NameLoc), @@ -373,8 +373,8 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, if (TypoCorrection Corrected = CorrectTypo(DeclarationNameInfo(&II, IILoc), LookupOrdinaryName, S, SS, Validator)) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); if (Corrected.isKeyword()) { // We corrected to a keyword. @@ -406,7 +406,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, return true; } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // See if II is a class template that the user forgot to pass arguments to. UnqualifiedId Name; Name.setIdentifier(&II, IILoc); @@ -436,7 +436,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, << &II << DC << SS->getRange(); else if (isDependentScopeSpecifier(*SS)) { unsigned DiagID = diag::err_typename_missing; - if (getLangOptions().MicrosoftMode && isMicrosoftMissingTypename(SS, S)) + if (getLangOpts().MicrosoftMode && isMicrosoftMissingTypename(SS, S)) DiagID = diag::warn_typename_missing; Diag(SS->getRange().getBegin(), DiagID) @@ -456,7 +456,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, /// \brief Determine whether the given result set contains either a type name /// or static bool isResultTypeOrTemplate(LookupResult &R, const Token &NextToken) { - bool CheckTemplate = R.getSema().getLangOptions().CPlusPlus && + bool CheckTemplate = R.getSema().getLangOpts().CPlusPlus && NextToken.is(tok::less); for (LookupResult::iterator I = R.begin(), IEnd = R.end(); I != IEnd; ++I) { @@ -508,7 +508,7 @@ Corrected: if (!SS.isSet() && NextToken.is(tok::l_paren)) { // In C++, this is an ADL-only call. // FIXME: Reference? - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return BuildDeclarationNameExpr(SS, Result, /*ADL=*/true); // C90 6.3.2.2: @@ -533,7 +533,7 @@ Corrected: // In C, we first see whether there is a tag type by the same name, in // which case it's likely that the user just forget to write "enum", // "struct", or "union". - if (!getLangOptions().CPlusPlus && !SecondTry) { + if (!getLangOpts().CPlusPlus && !SecondTry) { Result.clear(LookupTagName); LookupParsedName(Result, S, &SS); if (TagDecl *Tag = Result.getAsSingle()) { @@ -562,7 +562,7 @@ Corrected: } Diag(NameLoc, diag::err_use_of_tag_name_without_tag) - << Name << TagName << getLangOptions().CPlusPlus + << Name << TagName << getLangOpts().CPlusPlus << FixItHint::CreateInsertion(NameLoc, FixItTagName); break; } @@ -580,13 +580,13 @@ Corrected: &SS, DefaultValidator)) { unsigned UnqualifiedDiag = diag::err_undeclared_var_use_suggest; unsigned QualifiedDiag = diag::err_no_member_suggest; - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); NamedDecl *FirstDecl = Corrected.getCorrectionDecl(); NamedDecl *UnderlyingFirstDecl = FirstDecl? FirstDecl->getUnderlyingDecl() : 0; - if (getLangOptions().CPlusPlus && NextToken.is(tok::less) && + if (getLangOpts().CPlusPlus && NextToken.is(tok::less) && UnderlyingFirstDecl && isa(UnderlyingFirstDecl)) { UnqualifiedDiag = diag::err_no_template_suggest; QualifiedDiag = diag::err_no_member_template_suggest; @@ -668,7 +668,7 @@ Corrected: break; case LookupResult::Ambiguous: - if (getLangOptions().CPlusPlus && NextToken.is(tok::less) && + if (getLangOpts().CPlusPlus && NextToken.is(tok::less) && hasAnyAcceptableTemplateNames(Result)) { // C++ [temp.local]p3: // A lookup that finds an injected-class-name (10.2) can result in an @@ -692,7 +692,7 @@ Corrected: return NameClassification::Error(); } - if (getLangOptions().CPlusPlus && NextToken.is(tok::less) && + if (getLangOpts().CPlusPlus && NextToken.is(tok::less) && (IsFilteredTemplateName || hasAnyAcceptableTemplateNames(Result))) { // C++ [temp.names]p3: // After name lookup (3.4) finds that a name is a template-name or that @@ -895,7 +895,7 @@ void Sema::ActOnReenterFunctionContext(Scope* S, Decl *D) { /// attribute. static bool AllowOverloadingOfFunction(LookupResult &Previous, ASTContext &Context) { - if (Context.getLangOptions().CPlusPlus) + if (Context.getLangOpts().CPlusPlus) return true; if (Previous.getResultKind() == LookupResult::FoundOverloaded) @@ -922,7 +922,7 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) { // Out-of-line definitions shouldn't be pushed into scope in C++. // Out-of-line variable and function definitions shouldn't even in C. - if ((getLangOptions().CPlusPlus || isa(D) || isa(D)) && + if ((getLangOpts().CPlusPlus || isa(D) || isa(D)) && D->isOutOfLine() && !D->getDeclContext()->getRedeclContext()->Equals( D->getLexicalDeclContext()->getRedeclContext())) @@ -1184,7 +1184,7 @@ static void GenerateFixForUnusedDecl(const NamedDecl *D, ASTContext &Ctx, FixItHint &Hint) { if (isa(D)) { SourceLocation AfterColon = Lexer::findLocationAfterToken(D->getLocEnd(), - tok::colon, Ctx.getSourceManager(), Ctx.getLangOptions(), true); + tok::colon, Ctx.getSourceManager(), Ctx.getLangOpts(), true); if (AfterColon.isInvalid()) return; Hint = FixItHint::CreateRemoval(CharSourceRange:: @@ -1329,7 +1329,7 @@ Scope *Sema::getNonFieldDeclScope(Scope *S) { while (((S->getFlags() & Scope::DeclScope) == 0) || (S->getEntity() && ((DeclContext *)S->getEntity())->isTransparentContext()) || - (S->isClassScope() && !getLangOptions().CPlusPlus)) + (S->isClassScope() && !getLangOpts().CPlusPlus)) S = S->getParent(); return S; } @@ -1464,7 +1464,7 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { // Allow multiple definitions for ObjC built-in typedefs. // FIXME: Verify the underlying types are equivalent! - if (getLangOptions().ObjC1) { + if (getLangOpts().ObjC1) { const IdentifierInfo *TypeID = New->getIdentifier(); switch (TypeID->getLength()) { default: break; @@ -1520,10 +1520,10 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { if (TypedefNameDecl *Typedef = dyn_cast(Old)) New->setPreviousDeclaration(Typedef); - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) return; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++ [dcl.typedef]p2: // In a given non-class scope, a typedef specifier can be used to // redefine the name of any type declared in that scope to refer @@ -1562,7 +1562,7 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { } // Modules always permit redefinition of typedefs, as does C11. - if (getLangOptions().Modules || getLangOptions().C11) + if (getLangOpts().Modules || getLangOpts().C11) return; // If we have a redefinition of a typedef in C, emit a warning. This warning @@ -1762,8 +1762,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { if (!isa(New) && !isa(Old) && New->getStorageClass() == SC_Static && Old->getStorageClass() != SC_Static && - !canRedefineFunction(Old, getLangOptions())) { - if (getLangOptions().MicrosoftExt) { + !canRedefineFunction(Old, getLangOpts())) { + if (getLangOpts().MicrosoftExt) { Diag(New->getLocation(), diag::warn_static_non_static) << New; Diag(Old->getLocation(), PrevDiag); } else { @@ -1845,7 +1845,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { NewQType = Context.getCanonicalType(New->getType()); } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // (C++98 13.1p2): // Certain function declarations cannot be overloaded: // -- Function declarations that differ only in the return type @@ -1957,7 +1957,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { // C: Function types need to be compatible, not identical. This handles // duplicate function decls like "void f(int); void f(enum X);" properly. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && Context.typesAreCompatible(OldQType, NewQType)) { const FunctionType *OldFuncType = OldQType->getAs(); const FunctionType *NewFuncType = NewQType->getAs(); @@ -2009,7 +2009,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { // the K&R definition becomes variadic. This is sort of an edge case, but // it's legal per the standard depending on how you read C99 6.7.5.3p15 and // C99 6.9.1p8. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && Old->hasPrototype() && !New->hasPrototype() && New->getType()->getAs() && Old->getNumParams() == New->getNumParams()) { @@ -2117,7 +2117,7 @@ bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old) { mergeParamDeclAttributes(New->getParamDecl(i), Old->getParamDecl(i), Context); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return MergeCXXFunctionDecl(New, Old); return false; @@ -2155,7 +2155,7 @@ void Sema::MergeVarDeclTypes(VarDecl *New, VarDecl *Old) { return; QualType MergedT; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { AutoType *AT = New->getType()->getContainedAutoType(); if (AT && !AT->isDeduced()) { // We don't know what the new type is until the initializer is attached. @@ -2316,7 +2316,7 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) { // C++ doesn't have tentative definitions, so go right ahead and check here. const VarDecl *Def; - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && New->isThisDeclarationADefinition() == VarDecl::Definition && (Def = Old->getDefinition())) { Diag(New->getLocation(), diag::err_redefinition) @@ -2422,7 +2422,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, if (RecordDecl *Record = dyn_cast_or_null(Tag)) { if (!Record->getDeclName() && Record->isCompleteDefinition() && DS.getStorageClassSpec() != DeclSpec::SCS_typedef) { - if (getLangOptions().CPlusPlus || + if (getLangOpts().CPlusPlus || Record->getDeclContext()->isRecord()) return BuildAnonymousStructOrUnion(S, DS, AS, Record); @@ -2433,7 +2433,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, } // Check for Microsoft C extension: anonymous struct. - if (getLangOptions().MicrosoftExt && !getLangOptions().CPlusPlus && + if (getLangOpts().MicrosoftExt && !getLangOpts().CPlusPlus && CurContext->isRecord() && DS.getStorageClassSpec() == DeclSpec::SCS_unspecified) { // Handle 2 kinds of anonymous struct: @@ -2450,7 +2450,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, } } - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && DS.getStorageClassSpec() != DeclSpec::SCS_typedef) if (EnumDecl *Enum = dyn_cast_or_null(Tag)) if (Enum->enumerator_begin() == Enum->enumerator_end() && @@ -2699,17 +2699,17 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, DeclContext *Owner = Record->getDeclContext(); // Diagnose whether this anonymous struct/union is an extension. - if (Record->isUnion() && !getLangOptions().CPlusPlus && !getLangOptions().C11) + if (Record->isUnion() && !getLangOpts().CPlusPlus && !getLangOpts().C11) Diag(Record->getLocation(), diag::ext_anonymous_union); - else if (!Record->isUnion() && getLangOptions().CPlusPlus) + else if (!Record->isUnion() && getLangOpts().CPlusPlus) Diag(Record->getLocation(), diag::ext_gnu_anonymous_struct); - else if (!Record->isUnion() && !getLangOptions().C11) + else if (!Record->isUnion() && !getLangOpts().C11) Diag(Record->getLocation(), diag::ext_c11_anonymous_struct); // C and C++ require different kinds of checks for anonymous // structs/unions. bool Invalid = false; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { const char* PrevSpec = 0; unsigned DiagID; if (Record->isUnion()) { @@ -2799,7 +2799,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, if (!MemRecord->isAnonymousStructOrUnion() && MemRecord->getDeclName()) { // Visual C++ allows type definition in anonymous struct or union. - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) Diag(MemRecord->getLocation(), diag::ext_anonymous_record_with_type) << (int)Record->isUnion(); else { @@ -2823,7 +2823,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, DK = diag::err_anonymous_record_with_static; // Visual C++ allows type definition in anonymous struct or union. - if (getLangOptions().MicrosoftExt && + if (getLangOpts().MicrosoftExt && DK == diag::err_anonymous_record_with_type) Diag((*Mem)->getLocation(), diag::ext_anonymous_record_with_type) << (int)Record->isUnion(); @@ -2838,7 +2838,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, if (!Record->isUnion() && !Owner->isRecord()) { Diag(Record->getLocation(), diag::err_anonymous_struct_not_member) - << (int)getLangOptions().CPlusPlus; + << (int)getLangOpts().CPlusPlus; Invalid = true; } @@ -2859,7 +2859,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, /*BitWidth=*/0, /*Mutable=*/false, /*HasInit=*/false); Anon->setAccess(AS); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) FieldCollector->Add(cast(Anon)); } else { DeclSpec::SCS SCSpec = DS.getStorageClassSpec(); @@ -3645,7 +3645,7 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, Previous.clear(); } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -3775,7 +3775,7 @@ isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC, if (!PrevDecl->hasLinkage()) return false; - if (Context.getLangOptions().CPlusPlus) { + if (Context.getLangOpts().CPlusPlus) { // C++ [basic.link]p6: // If there is a visible declaration of an entity with linkage // having the same name and type, ignoring entities declared @@ -3864,7 +3864,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, DeclarationName Name = GetNameForDeclarator(D).getName(); // Check that there are no default arguments (C++ only). - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) CheckExtraCXXDefaultArguments(D); DeclSpec::SCS SCSpec = D.getDeclSpec().getStorageClassSpec(); @@ -3906,7 +3906,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } - if (getLangOptions().OpenCL) { + if (getLangOpts().OpenCL) { // Set up the special work-group-local storage class for variables in the // OpenCL __local address space. if (R.getAddressSpace() == LangAS::opencl_local) @@ -3915,7 +3915,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, bool isExplicitSpecialization = false; VarDecl *NewVD; - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { NewVD = VarDecl::Create(Context, DC, D.getLocStart(), D.getIdentifierLoc(), II, R, TInfo, SC, SCAsWritten); @@ -3943,7 +3943,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, // the program is ill-formed. C++11 drops this restriction. if (RD->isUnion()) Diag(D.getIdentifierLoc(), - getLangOptions().CPlusPlus0x + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_static_data_member_in_union : diag::ext_static_data_member_in_union) << Name; // We conservatively disallow static data members in anonymous structs. @@ -4043,7 +4043,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, // In auto-retain/release, infer strong retension for variables of // retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(NewVD)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(NewVD)) NewVD->setInvalidDecl(); // Handle GNU asm-label extension (encoded as an attribute). @@ -4090,7 +4090,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, FilterLookupForScope(Previous, DC, S, NewVD->hasLinkage(), isExplicitSpecialization); - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous)); } else { // Merge the decl with the existing one if appropriate. @@ -4283,7 +4283,7 @@ bool Sema::CheckVariableDeclaration(VarDecl *NewVD, if (NewVD->hasLocalStorage() && T.isObjCGCWeak() && !NewVD->hasAttr()) { - if (getLangOptions().getGC() != LangOptions::NonGC) + if (getLangOpts().getGC() != LangOptions::NonGC) Diag(NewVD->getLocation(), diag::warn_gc_attribute_weak_on_local); else Diag(NewVD->getLocation(), diag::warn_attribute_weak_on_local); @@ -4502,7 +4502,7 @@ static NamedDecl* DiagnoseInvalidRedeclaration( llvm::SmallVector MismatchedParams; llvm::SmallVector, 1> NearMatches; TypoCorrection Correction; - bool isFriendDecl = (SemaRef.getLangOptions().CPlusPlus && + bool isFriendDecl = (SemaRef.getLangOpts().CPlusPlus && ExtraArgs.D.getDeclSpec().isFriendSpecified()); unsigned DiagMsg = isFriendDecl ? diag::err_no_matching_local_friend : diag::err_member_def_does_not_match; @@ -4584,10 +4584,10 @@ static NamedDecl* DiagnoseInvalidRedeclaration( if (Correction) SemaRef.Diag(NewFD->getLocation(), DiagMsg) - << Name << NewDC << Correction.getQuoted(SemaRef.getLangOptions()) + << Name << NewDC << Correction.getQuoted(SemaRef.getLangOpts()) << FixItHint::CreateReplacement( NewFD->getLocation(), - Correction.getAsString(SemaRef.getLangOptions())); + Correction.getAsString(SemaRef.getLangOpts())); else SemaRef.Diag(NewFD->getLocation(), DiagMsg) << Name << NewDC << NewFD->getLocation(); @@ -4611,7 +4611,7 @@ static NamedDecl* DiagnoseInvalidRedeclaration( << Idx << FDParam->getType() << NewFD->getParamDecl(Idx-1)->getType(); } else if (Correction) { SemaRef.Diag(FD->getLocation(), diag::note_previous_decl) - << Correction.getQuoted(SemaRef.getLangOptions()); + << Correction.getQuoted(SemaRef.getLangOpts()); } else if (FDisConst != NewFDisConst) { SemaRef.Diag(FD->getLocation(), diag::note_member_def_close_const_match) << NewFDisConst << FD->getSourceRange().getEnd(); @@ -4668,7 +4668,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, FunctionDecl::StorageClass SCAsWritten = StorageClassSpecToFunctionDeclStorageClass(SCSpec); - if (!SemaRef.getLangOptions().CPlusPlus) { + if (!SemaRef.getLangOpts().CPlusPlus) { // Determine whether the function was written with a // prototype. This true when: // - there is a prototype in the declarator, or @@ -4730,7 +4730,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, // If the class is complete, then we now create the implicit exception // specification. If the class is incomplete or dependent, we can't do // it yet. - if (SemaRef.getLangOptions().CPlusPlus0x && !Record->isDependentType() && + if (SemaRef.getLangOpts().CPlusPlus0x && !Record->isDependentType() && Record->getDefinition() && !Record->isBeingDefined() && R->getAs()->getExceptionSpecType() == EST_None) { SemaRef.AdjustDestructorExceptionSpec(Record, NewDD); @@ -4862,7 +4862,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (OriginalLexicalContext && OriginalLexicalContext->isObjCContainer()) NewFD->setTopLevelDeclInObjCContainer(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { bool isInline = D.getDeclSpec().isInlineSpecified(); bool isVirtual = D.getDeclSpec().isVirtualSpecified(); bool isExplicit = D.getDeclSpec().isExplicitSpecified(); @@ -5204,7 +5204,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // In C++, the empty parameter-type-list must be spelled "void"; a // typedef of void is not permitted. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && Param->getType().getUnqualifiedType() != Context.VoidTy) { bool IsTypeAlias = false; if (const TypedefType *TT = Param->getType()->getAs()) @@ -5266,7 +5266,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, ProcessDeclAttributes(S, NewFD, D, /*NonInheritable=*/true, /*Inheritable=*/false); - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // Perform semantic checking on the function declaration. bool isExplicitSpecialization=false; if (!NewFD->isInvalidDecl()) { @@ -5358,7 +5358,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (CurContext->isDependentContext() && CurContext->isRecord() && !isFriend) { isDependentClassScopeExplicitSpecialization = true; - Diag(NewFD->getLocation(), getLangOptions().MicrosoftExt ? + Diag(NewFD->getLocation(), getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class : diag::err_function_specialization_in_class) << NewFD->getDeclName(); @@ -5576,7 +5576,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // Set this FunctionDecl's range up to the right paren. NewFD->setRangeEnd(D.getSourceRange().getEnd()); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (FunctionTemplate) { if (NewFD->isInvalidDecl()) FunctionTemplate->setInvalidDecl(); @@ -5586,7 +5586,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, MarkUnusedFileScopedDecl(NewFD); - if (getLangOptions().CUDA) + if (getLangOpts().CUDA) if (IdentifierInfo *II = NewFD->getIdentifier()) if (!NewFD->isInvalidDecl() && NewFD->getDeclContext()->getRedeclContext()->isTranslationUnit()) { @@ -5676,7 +5676,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, break; } - if (!getLangOptions().CPlusPlus && !NewFD->hasAttr()) { + if (!getLangOpts().CPlusPlus && !NewFD->hasAttr()) { // If a function name is overloadable in C, then every function // with that name must be marked "overloadable". Diag(NewFD->getLocation(), diag::err_attribute_overloadable_missing) @@ -5734,7 +5734,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, } // Semantic checking for this function declaration (in isolation). - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++-specific checks. if (CXXConstructorDecl *Constructor = dyn_cast(NewFD)) { CheckConstructor(Constructor); @@ -5835,7 +5835,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { // shall not appear in a declaration of main. // static main is not an error under C99, but we should warn about it. if (FD->getStorageClass() == SC_Static) - Diag(DS.getStorageClassSpecLoc(), getLangOptions().CPlusPlus + Diag(DS.getStorageClassSpecLoc(), getLangOpts().CPlusPlus ? diag::err_static_main : diag::warn_static_main) << FixItHint::CreateRemoval(DS.getStorageClassSpecLoc()); if (FD->isInlineSpecified()) @@ -5861,7 +5861,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { // In C with GNU extensions we allow main() to have non-integer return // type, but we should warn about the extension, and we disable the // implicit-return-zero rule. - } else if (getLangOptions().GNUMode && !getLangOptions().CPlusPlus) { + } else if (getLangOpts().GNUMode && !getLangOpts().CPlusPlus) { Diag(FD->getTypeSpecStartLoc(), diag::ext_main_returns_nonint); // Otherwise, this is just a flat-out error. @@ -6126,7 +6126,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, VDecl->ClearLinkageCache(); // In ARC, infer lifetime. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(VDecl)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(VDecl)) VDecl->setInvalidDecl(); // If this is a redeclaration, check that the type we just deduced matches @@ -6172,7 +6172,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } const VarDecl* PrevInit = 0; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++ [class.static.data]p4 // If a static data member is of const integral or const // enumeration type, its declaration in the class definition can @@ -6215,7 +6215,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, // Top-level message sends default to 'id' when we're in a debugger // and we are assigning it to a variable of 'id' type. - if (getLangOptions().DebuggerCastResultToId && DclT->isObjCIdType()) + if (getLangOpts().DebuggerCastResultToId && DclT->isObjCIdType()) if (Init->getType() == Context.UnknownAnyTy && isa(Init)) { ExprResult Result = forceUnknownAnyToType(Init, Context.getObjCIdType()); if (Result.isInvalid()) { @@ -6277,7 +6277,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, // C99 6.7.8p4: All the expressions in an initializer for an object that has // static storage duration shall be constant expressions or string literals. // C++ does not have this restriction. - if (!getLangOptions().CPlusPlus && !VDecl->isInvalidDecl() && + if (!getLangOpts().CPlusPlus && !VDecl->isInvalidDecl() && VDecl->getStorageClass() == SC_Static) CheckForConstantInitializer(Init, DclT); } else if (VDecl->isStaticDataMember() && @@ -6321,7 +6321,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } else if (DclT->isIntegralOrEnumerationType()) { // Check whether the expression is a constant expression. SourceLocation Loc; - if (getLangOptions().CPlusPlus0x && DclT.isVolatileQualified()) + if (getLangOpts().CPlusPlus0x && DclT.isVolatileQualified()) // In C++11, a non-constexpr const static data member with an // in-class initializer cannot be volatile. Diag(VDecl->getLocation(), diag::err_in_class_initializer_volatile); @@ -6346,7 +6346,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } else if (DclT->isFloatingType()) { // also permits complex, which is ok Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type) << DclT << Init->getSourceRange(); - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(VDecl->getLocation(), diag::note_in_class_initializer_float_type_constexpr) << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); @@ -6358,7 +6358,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } // Suggest adding 'constexpr' in C++11 for literal types. - } else if (getLangOptions().CPlusPlus0x && DclT->isLiteralType()) { + } else if (getLangOpts().CPlusPlus0x && DclT->isLiteralType()) { Diag(VDecl->getLocation(), diag::err_in_class_initializer_literal_type) << DclT << Init->getSourceRange() << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); @@ -6371,12 +6371,12 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } } else if (VDecl->isFileVarDecl()) { if (VDecl->getStorageClassAsWritten() == SC_Extern && - (!getLangOptions().CPlusPlus || + (!getLangOpts().CPlusPlus || !Context.getBaseElementType(VDecl->getType()).isConstQualified())) Diag(VDecl->getLocation(), diag::warn_extern_init); // C99 6.7.8p4. All file scoped initializers need to be constant. - if (!getLangOptions().CPlusPlus && !VDecl->isInvalidDecl()) + if (!getLangOpts().CPlusPlus && !VDecl->isInvalidDecl()) CheckForConstantInitializer(Init, DclT); } @@ -6597,7 +6597,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl, // trivial default constructor and a trivial destructor, a cv-qualified // version of one of these types, or an array of one of the preceding // types and is declared without an initializer. - if (getLangOptions().CPlusPlus && Var->hasLocalStorage()) { + if (getLangOpts().CPlusPlus && Var->hasLocalStorage()) { if (const RecordType *Record = Context.getBaseElementType(Type)->getAs()) { CXXRecordDecl *CXXRecord = cast(Record->getDecl()); @@ -6689,7 +6689,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { // In ARC, don't allow jumps past the implicit initialization of a // local retaining variable. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && var->hasLocalStorage()) { switch (var->getType().getObjCLifetime()) { case Qualifiers::OCL_None: @@ -6705,7 +6705,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { } // All the following checks are C++ only. - if (!getLangOptions().CPlusPlus) return; + if (!getLangOpts().CPlusPlus) return; QualType baseType = Context.getBaseElementType(var->getType()); if (baseType->isDependentType()) return; @@ -6859,7 +6859,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { if (DS.getStorageClassSpec() == DeclSpec::SCS_register) { StorageClass = SC_Register; StorageClassAsWritten = SC_Register; - } else if (getLangOptions().CPlusPlus && + } else if (getLangOpts().CPlusPlus && DS.getStorageClassSpec() == DeclSpec::SCS_auto) { StorageClass = SC_Auto; StorageClassAsWritten = SC_Auto; @@ -6880,7 +6880,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); QualType parmDeclType = TInfo->getType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments inside the type of this // parameter. CheckExtraCXXDefaultArguments(D); @@ -7030,7 +7030,7 @@ ParmVarDecl *Sema::CheckParameter(DeclContext *DC, SourceLocation StartLoc, VarDecl::StorageClass StorageClass, VarDecl::StorageClass StorageClassAsWritten) { // In ARC, infer a lifetime qualifier for appropriate parameter types. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && T.getObjCLifetime() == Qualifiers::OCL_None && T->isObjCLifetimeType()) { @@ -7183,11 +7183,11 @@ void Sema::CheckForFunctionRedefinition(FunctionDecl *FD) { // was an extern inline function. const FunctionDecl *Definition; if (FD->isDefined(Definition) && - !canRedefineFunction(Definition, getLangOptions())) { - if (getLangOptions().GNUMode && Definition->isInlineSpecified() && + !canRedefineFunction(Definition, getLangOpts())) { + if (getLangOpts().GNUMode && Definition->isInlineSpecified() && Definition->getStorageClass() == SC_Extern) Diag(FD->getLocation(), diag::err_redefinition_extern_inline) - << FD->getDeclName() << getLangOptions().CPlusPlus; + << FD->getDeclName() << getLangOpts().CPlusPlus; else Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName(); Diag(Definition->getLocation(), diag::note_previous_definition); @@ -7385,7 +7385,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, // MSVC permits the use of pure specifier (=0) on function definition, // defined at class scope, warn about this non standard construct. - if (getLangOptions().MicrosoftExt && FD->isPure()) + if (getLangOpts().MicrosoftExt && FD->isPure()) Diag(FD->getLocation(), diag::warn_pure_function_definition); if (!FD->isInvalidDecl()) { @@ -7524,7 +7524,7 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, unsigned diag_id; if (II.getName().startswith("__builtin_")) diag_id = diag::warn_builtin_unknown; - else if (getLangOptions().C99) + else if (getLangOpts().C99) diag_id = diag::ext_implicit_function_decl; else diag_id = diag::warn_implicit_function_decl; @@ -7537,8 +7537,8 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, DeclFilterCCC Validator; if (S && (Corrected = CorrectTypo(DeclarationNameInfo(&II, Loc), LookupOrdinaryName, S, 0, Validator))) { - std::string CorrectedStr = Corrected.getAsString(getLangOptions()); - std::string CorrectedQuotedStr = Corrected.getQuoted(getLangOptions()); + std::string CorrectedStr = Corrected.getAsString(getLangOpts()); + std::string CorrectedQuotedStr = Corrected.getQuoted(getLangOpts()); FunctionDecl *Func = Corrected.getCorrectionDeclAs(); Diag(Loc, diag::note_function_suggestion) << CorrectedQuotedStr @@ -7627,7 +7627,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { // Mark const if we don't care about errno and that is the only // thing preventing the function from being const. This allows // IRgen to use LLVM intrinsics for such functions. - if (!getLangOptions().MathErrno && + if (!getLangOpts().MathErrno && Context.BuiltinInfo.isConstWithoutErrno(BuiltinID)) { if (!FD->getAttr()) FD->addAttr(::new (Context) ConstAttr(FD->getLocation(), Context)); @@ -7645,7 +7645,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { IdentifierInfo *Name = FD->getIdentifier(); if (!Name) return; - if ((!getLangOptions().CPlusPlus && + if ((!getLangOpts().CPlusPlus && FD->getDeclContext()->isTranslationUnit()) || (isa(FD->getDeclContext()) && cast(FD->getDeclContext())->getLanguage() == @@ -7924,7 +7924,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, UPPC_FixedUnderlyingType)) EnumUnderlying = Context.IntTy.getTypePtr(); - } else if (getLangOptions().MicrosoftMode) + } else if (getLangOpts().MicrosoftMode) // Microsoft enums are always of int type. EnumUnderlying = Context.IntTy.getTypePtr(); } @@ -8018,7 +8018,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, if (Previous.isAmbiguous()) return 0; - if (!getLangOptions().CPlusPlus && TUK != TUK_Reference) { + if (!getLangOpts().CPlusPlus && TUK != TUK_Reference) { // FIXME: This makes sure that we ignore the contexts associated // with C structs, unions, and enums when looking for a matching // tag declaration or definition. See the similar lookup tweak @@ -8041,7 +8041,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, Previous.clear(); } - if (getLangOptions().CPlusPlus && Name && DC && StdNamespace && + if (getLangOpts().CPlusPlus && Name && DC && StdNamespace && DC->Equals(getStdNamespace()) && Name->isStr("bad_alloc")) { // This is a declaration of or a reference to "std::bad_alloc". isStdBadAlloc = true; @@ -8097,7 +8097,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // Find the scope where we'll be declaring the tag. while (S->isClassScope() || - (getLangOptions().CPlusPlus && + (getLangOpts().CPlusPlus && S->isFunctionPrototypeScope()) || ((S->getFlags() & Scope::DeclScope) == 0) || (S->getEntity() && @@ -8114,7 +8114,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // In C++, we need to do a redeclaration lookup to properly // diagnose some problems. - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Previous.setRedeclarationKind(ForRedeclaration); LookupQualifiedName(Previous, SearchDC); } @@ -8132,7 +8132,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // technically forbidden by the current standard but which is // okay according to the likely resolution of an open issue; // see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#407 - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (TypedefNameDecl *TD = dyn_cast(PrevDecl)) { if (const TagType *TT = TD->getUnderlyingType()->getAs()) { TagDecl *Tag = TT->getDecl(); @@ -8235,7 +8235,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // For our current ASTs this shouldn't be a problem, but will // need to be changed with DeclGroups. if ((TUK == TUK_Reference && (!PrevTagDecl->getFriendObjectKind() || - getLangOptions().MicrosoftExt)) || TUK == TUK_Friend) + getLangOpts().MicrosoftExt)) || TUK == TUK_Friend) return PrevTagDecl; // Diagnose attempts to redefine a tag. @@ -8250,7 +8250,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, == TSK_ExplicitSpecialization) { // A redeclaration in function prototype scope in C isn't // visible elsewhere, so merely issue a warning. - if (!getLangOptions().CPlusPlus && S->containedInPrototypeScope()) + if (!getLangOpts().CPlusPlus && S->containedInPrototypeScope()) Diag(NameLoc, diag::warn_redefinition_in_param_list) << Name; else Diag(NameLoc, diag::err_redefinition) << Name; @@ -8380,7 +8380,7 @@ CreateNewDecl: // If this is an undefined enum, warn. if (TUK != TUK_Definition && !Invalid) { TagDecl *Def; - if (getLangOptions().CPlusPlus0x && cast(New)->isFixed()) { + if (getLangOpts().CPlusPlus0x && cast(New)->isFixed()) { // C++0x: 7.2p2: opaque-enum-declaration. // Conflicts are diagnosed above. Do nothing. } @@ -8390,9 +8390,9 @@ CreateNewDecl: Diag(Def->getLocation(), diag::note_previous_definition); } else { unsigned DiagID = diag::ext_forward_ref_enum; - if (getLangOptions().MicrosoftMode) + if (getLangOpts().MicrosoftMode) DiagID = diag::ext_ms_forward_ref_enum; - else if (getLangOptions().CPlusPlus) + else if (getLangOpts().CPlusPlus) DiagID = diag::err_forward_ref_enum; Diag(Loc, DiagID); @@ -8418,7 +8418,7 @@ CreateNewDecl: // FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.: // struct X { int A; } D; D should chain to X. - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // FIXME: Look for a way to use RecordDecl for simple structs. New = CXXRecordDecl::Create(Context, Kind, SearchDC, KWLoc, Loc, Name, cast_or_null(PrevDecl)); @@ -8484,7 +8484,7 @@ CreateNewDecl: // If we're declaring or defining a tag in function prototype scope // in C, note that this type can only be used within the function. - if (Name && S->isFunctionPrototypeScope() && !getLangOptions().CPlusPlus) + if (Name && S->isFunctionPrototypeScope() && !getLangOpts().CPlusPlus) Diag(Loc, diag::warn_decl_in_param_list) << Context.getTagDeclType(New); // Set the lexical context. If the tag has a C++ scope specifier, the @@ -8497,7 +8497,7 @@ CreateNewDecl: // the tag name visible. if (TUK == TUK_Friend) New->setObjectOfFriendDecl(/* PreviouslyDeclared = */ !Previous.empty() || - getLangOptions().MicrosoftExt); + getLangOpts().MicrosoftExt); // Set the access specifier. if (!Invalid && SearchDC->isRecord()) @@ -8537,7 +8537,7 @@ CreateNewDecl: // If we were in function prototype scope (and not in C++ mode), add this // tag to the list of decls to inject into the function definition scope. - if (S->isFunctionPrototypeScope() && !getLangOptions().CPlusPlus && + if (S->isFunctionPrototypeScope() && !getLangOpts().CPlusPlus && InFunctionDeclarator && Name) DeclsInPrototypeScope.push_back(New); @@ -8708,7 +8708,7 @@ ExprResult Sema::VerifyBitField(SourceLocation FieldLoc, if (!FieldTy->isDependentType()) { uint64_t TypeSize = Context.getTypeSize(FieldTy); if (Value.getZExtValue() > TypeSize) { - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { if (FieldName) return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_size) << FieldName << (unsigned)Value.getZExtValue() @@ -8753,7 +8753,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); QualType T = TInfo->getType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { CheckExtraCXXDefaultArguments(D); if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo, @@ -8940,7 +8940,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, NewFD->setInvalidDecl(); } - if (!InvalidDecl && getLangOptions().CPlusPlus) { + if (!InvalidDecl && getLangOpts().CPlusPlus) { if (Record->isUnion()) { if (const RecordType *RT = EltTy->getAs()) { CXXRecordDecl* RDecl = cast(RT->getDecl()); @@ -8973,7 +8973,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, // In auto-retain/release, infer strong retension for fields of // retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(NewFD)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(NewFD)) NewFD->setInvalidDecl(); if (T.isObjCGCWeak()) @@ -8985,7 +8985,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, bool Sema::CheckNontrivialField(FieldDecl *FD) { assert(FD); - assert(getLangOptions().CPlusPlus && "valid check only for C++"); + assert(getLangOpts().CPlusPlus && "valid check only for C++"); if (FD->isInvalidDecl()) return true; @@ -9009,8 +9009,8 @@ bool Sema::CheckNontrivialField(FieldDecl *FD) { member = CXXDestructor; if (member != CXXInvalid) { - if (!getLangOptions().CPlusPlus0x && - getLangOptions().ObjCAutoRefCount && RDecl->hasObjectMember()) { + if (!getLangOpts().CPlusPlus0x && + getLangOpts().ObjCAutoRefCount && RDecl->hasObjectMember()) { // Objective-C++ ARC: it is an error to have a non-trivial field of // a union. However, system headers in Objective-C programs // occasionally have Objective-C lifetime objects within unions, @@ -9025,12 +9025,12 @@ bool Sema::CheckNontrivialField(FieldDecl *FD) { } } - Diag(FD->getLocation(), getLangOptions().CPlusPlus0x ? + Diag(FD->getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_nontrivial_union_or_anon_struct_member : diag::err_illegal_union_or_anon_struct_member) << (int)FD->getParent()->isUnion() << FD->getDeclName() << member; DiagnoseNontrivial(RT, member); - return !getLangOptions().CPlusPlus0x; + return !getLangOpts().CPlusPlus0x; } } } @@ -9319,7 +9319,7 @@ Decl *Sema::ActOnIvar(Scope *S, NewID->setInvalidDecl(); // In ARC, infer 'retaining' for ivars of retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(NewID)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(NewID)) NewID->setInvalidDecl(); if (D.getDeclSpec().isModulePrivateSpecified()) @@ -9441,21 +9441,21 @@ void Sema::ActOnFields(Scope* S, continue; } else if (FDTy->isIncompleteArrayType() && Record && ((i + 1 == Fields.end() && !Record->isUnion()) || - ((getLangOptions().MicrosoftExt || - getLangOptions().CPlusPlus) && + ((getLangOpts().MicrosoftExt || + getLangOpts().CPlusPlus) && (i + 1 == Fields.end() || Record->isUnion())))) { // Flexible array member. // Microsoft and g++ is more permissive regarding flexible array. // It will accept flexible array in union and also // as the sole element of a struct/class. - if (getLangOptions().MicrosoftExt) { + if (getLangOpts().MicrosoftExt) { if (Record->isUnion()) Diag(FD->getLocation(), diag::ext_flexible_array_union_ms) << FD->getDeclName(); else if (Fields.size() == 1) Diag(FD->getLocation(), diag::ext_flexible_array_empty_aggregate_ms) << FD->getDeclName() << Record->getTagKind(); - } else if (getLangOptions().CPlusPlus) { + } else if (getLangOpts().CPlusPlus) { if (Record->isUnion()) Diag(FD->getLocation(), diag::ext_flexible_array_union_gnu) << FD->getDeclName(); @@ -9518,8 +9518,8 @@ void Sema::ActOnFields(Scope* S, QualType T = Context.getObjCObjectPointerType(FD->getType()); FD->setType(T); } - else if (!getLangOptions().CPlusPlus) { - if (getLangOptions().ObjCAutoRefCount && Record && !ARCErrReported) { + else if (!getLangOpts().CPlusPlus) { + if (getLangOpts().ObjCAutoRefCount && Record && !ARCErrReported) { // It's an error in ARC if a field has lifetime. // We don't want to report this in a system header, though, // so we just make the field unavailable. @@ -9541,8 +9541,8 @@ void Sema::ActOnFields(Scope* S, ARCErrReported = true; } } - else if (getLangOptions().ObjC1 && - getLangOptions().getGC() != LangOptions::NonGC && + else if (getLangOpts().ObjC1 && + getLangOpts().getGC() != LangOptions::NonGC && Record && !Record->hasObjectMember()) { if (FD->getType()->isObjCObjectPointerType() || FD->getType().isObjCGCStrong()) @@ -9586,7 +9586,7 @@ void Sema::ActOnFields(Scope* S, // non-POD because of the presence of an Objective-C pointer member. // If so, objects of this type cannot be shared between code compiled // with instant objects and code compiled with manual retain/release. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && CXXRecord->hasObjectMember() && CXXRecord->getLinkage() == ExternalLinkage) { if (CXXRecord->isPOD()) { @@ -9612,7 +9612,7 @@ void Sema::ActOnFields(Scope* S, } // Adjust user-defined destructor exception spec. - if (getLangOptions().CPlusPlus0x && + if (getLangOpts().CPlusPlus0x && CXXRecord->hasUserDeclaredDestructor()) AdjustDestructorExceptionSpec(CXXRecord,CXXRecord->getDestructor()); @@ -9812,8 +9812,8 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, EltTy = Context.DependentTy; else { SourceLocation ExpLoc; - if (getLangOptions().CPlusPlus0x && Enum->isFixed() && - !getLangOptions().MicrosoftMode) { + if (getLangOpts().CPlusPlus0x && Enum->isFixed() && + !getLangOpts().MicrosoftMode) { // C++11 [dcl.enum]p5: If the underlying type is fixed, [...] the // constant-expression in the enumerator-definition shall be a converted // constant expression of the underlying type. @@ -9838,14 +9838,14 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // we perform a non-narrowing conversion as part of converted constant // expression checking. if (!isRepresentableIntegerValue(Context, EnumVal, EltTy)) { - if (getLangOptions().MicrosoftMode) { + if (getLangOpts().MicrosoftMode) { Diag(IdLoc, diag::ext_enumerator_too_large) << EltTy; Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take(); } else Diag(IdLoc, diag::err_enumerator_too_large) << EltTy; } else Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take(); - } else if (getLangOptions().CPlusPlus) { + } else if (getLangOpts().CPlusPlus) { // C++11 [dcl.enum]p5: // If the underlying type is not fixed, the type of each enumerator // is the type of its initializing value: @@ -9941,9 +9941,9 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // an int (C99 6.7.2.2p2). However, we support GCC's extension that // permits enumerator values that are representable in some larger // integral type. - if (!getLangOptions().CPlusPlus && !T.isNull()) + if (!getLangOpts().CPlusPlus && !T.isNull()) Diag(IdLoc, diag::warn_enum_value_overflow); - } else if (!getLangOptions().CPlusPlus && + } else if (!getLangOpts().CPlusPlus && !isRepresentableIntegerValue(Context, EnumVal, EltTy)) { // Enforce C99 6.7.2.2p2 even when we compute the next value. Diag(IdLoc, diag::ext_enum_value_not_int) @@ -9990,7 +9990,7 @@ Decl *Sema::ActOnEnumConstant(Scope *S, Decl *theEnumDecl, Decl *lastEnumConst, if (PrevDecl) { // When in C++, we may get a TagDecl with the same name; in this case the // enum constant will 'hide' the tag. - assert((getLangOptions().CPlusPlus || !isa(PrevDecl)) && + assert((getLangOpts().CPlusPlus || !isa(PrevDecl)) && "Received TagDecl when not in C++!"); if (!isa(PrevDecl) && isDeclInScope(PrevDecl, CurContext, S)) { if (isa(PrevDecl)) @@ -10162,13 +10162,13 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, BestType = Context.UnsignedIntTy; BestWidth = IntWidth; BestPromotionType - = (NumPositiveBits == BestWidth || !getLangOptions().CPlusPlus) + = (NumPositiveBits == BestWidth || !getLangOpts().CPlusPlus) ? Context.UnsignedIntTy : Context.IntTy; } else if (NumPositiveBits <= (BestWidth = Context.getTargetInfo().getLongWidth())) { BestType = Context.UnsignedLongTy; BestPromotionType - = (NumPositiveBits == BestWidth || !getLangOptions().CPlusPlus) + = (NumPositiveBits == BestWidth || !getLangOpts().CPlusPlus) ? Context.UnsignedLongTy : Context.LongTy; } else { BestWidth = Context.getTargetInfo().getLongLongWidth(); @@ -10176,7 +10176,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, "How could an initializer get larger than ULL?"); BestType = Context.UnsignedLongLongTy; BestPromotionType - = (NumPositiveBits == BestWidth || !getLangOptions().CPlusPlus) + = (NumPositiveBits == BestWidth || !getLangOpts().CPlusPlus) ? Context.UnsignedLongLongTy : Context.LongLongTy; } } @@ -10201,7 +10201,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, QualType NewTy; unsigned NewWidth; bool NewSign; - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && !Enum->isFixed() && isRepresentableIntegerValue(Context, InitVal, Context.IntTy)) { NewTy = Context.IntTy; @@ -10209,7 +10209,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, NewSign = true; } else if (ECD->getType() == BestType) { // Already the right type! - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) // C++ [dcl.enum]p4: Following the closing brace of an // enum-specifier, each enumerator has the type of its // enumeration. @@ -10234,7 +10234,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, ECD->getInitExpr(), /*base paths*/ 0, VK_RValue)); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) // C++ [dcl.enum]p4: Following the closing brace of an // enum-specifier, each enumerator has the type of its // enumeration. diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 23abefe6bf08..b288559cdd33 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2286,7 +2286,7 @@ static FormatAttrKind getFormatAttrKind(StringRef Format) { /// http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html static void handleInitPriorityAttr(Sema &S, Decl *D, const AttributeList &Attr) { - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); return; } @@ -3259,7 +3259,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, returnType = MD->getResultType(); else if (ObjCPropertyDecl *PD = dyn_cast(D)) returnType = PD->getType(); - else if (S.getLangOptions().ObjCAutoRefCount && hasDeclarator(D) && + else if (S.getLangOpts().ObjCAutoRefCount && hasDeclarator(D) && (Attr.getKind() == AttributeList::AT_ns_returns_retained)) return; // ignore: was handled as a type attribute else if (FunctionDecl *FD = dyn_cast(D)) @@ -3398,7 +3398,7 @@ static void handleNSBridgedAttr(Sema &S, Scope *Sc, Decl *D, // In Objective-C, verify that the type names an Objective-C type. // We don't want to check this outside of ObjC because people sometimes // do crazy C declarations of Objective-C types. - if (ParmName && S.getLangOptions().ObjC1) { + if (ParmName && S.getLangOpts().ObjC1) { // Check for an existing type with this name. LookupResult R(S, DeclarationName(ParmName), Attr.getParameterLoc(), Sema::LookupOrdinaryName); @@ -4004,7 +4004,7 @@ static void handleDelayedForbiddenType(Sema &S, DelayedDiagnostic &diag, "this system declaration uses an unsupported type")); return; } - if (S.getLangOptions().ObjCAutoRefCount) + if (S.getLangOpts().ObjCAutoRefCount) if (const FunctionDecl *FD = dyn_cast(decl)) { // FIXME. we may want to supress diagnostics for all // kind of forbidden type messages on unavailable functions. diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 29df5c12a60d..abbbe11561b5 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -280,7 +280,7 @@ Sema::ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, UnparsedDefaultArgLocs.erase(Param); // Default arguments are only permitted in C++ - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { Diag(EqualLoc, diag::err_param_default_argument) << DefaultArg->getSourceRange(); Param->setInvalidDecl(); @@ -405,7 +405,7 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) { // MSVC accepts that default parameters be redefined for member functions // of template class. The new default parameter's value is ignored. Invalid = true; - if (getLangOptions().MicrosoftExt) { + if (getLangOpts().MicrosoftExt) { CXXMethodDecl* MD = dyn_cast(New); if (MD && MD->getParent()->getDescribedClassTemplate()) { // Merge the old default argument into the new parameter. @@ -538,7 +538,7 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) { /// validates compatibility and merges the specs if necessary. void Sema::MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old) { // Shortcut if exceptions are disabled. - if (!getLangOptions().CXXExceptions) + if (!getLangOpts().CXXExceptions) return; assert(Context.hasSameType(New->getType(), Old->getType()) && @@ -974,7 +974,7 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) { /// the innermost class. bool Sema::isCurrentClassName(const IdentifierInfo &II, Scope *, const CXXScopeSpec *SS) { - assert(getLangOptions().CPlusPlus && "No class names in C!"); + assert(getLangOpts().CPlusPlus && "No class names in C!"); CXXRecordDecl *CurDecl; if (SS && SS->isSet() && !SS->isInvalid()) { @@ -1191,7 +1191,7 @@ static CXXRecordDecl *GetClassForType(QualType T) { /// \brief Determine whether the type \p Derived is a C++ class that is /// derived from the type \p Base. bool Sema::IsDerivedFrom(QualType Derived, QualType Base) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; CXXRecordDecl *DerivedRD = GetClassForType(Derived); @@ -1209,7 +1209,7 @@ bool Sema::IsDerivedFrom(QualType Derived, QualType Base) { /// \brief Determine whether the type \p Derived is a C++ class that is /// derived from the type \p Base. bool Sema::IsDerivedFrom(QualType Derived, QualType Base, CXXBasePaths &Paths) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; CXXRecordDecl *DerivedRD = GetClassForType(Derived); @@ -1879,8 +1879,8 @@ Sema::BuildMemInitializer(Decl *ConstructorD, if (R.empty() && BaseType.isNull() && (Corr = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, &SS, Validator, ClassDecl))) { - std::string CorrectedStr(Corr.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corr.getQuoted(getLangOptions())); + std::string CorrectedStr(Corr.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corr.getQuoted(getLangOpts())); if (FieldDecl *Member = Corr.getCorrectionDeclAs()) { // We have found a non-static data member with a similar // name to what was typed; complain and initialize that @@ -2677,7 +2677,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, } } - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && FieldBaseElementType->isObjCRetainableType() && FieldBaseElementType.getObjCLifetime() != Qualifiers::OCL_None && FieldBaseElementType.getObjCLifetime() != Qualifiers::OCL_ExplicitNone) { @@ -3390,7 +3390,7 @@ bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, const PartialDiagnostic &PD) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; if (const ArrayType *AT = Context.getAsArrayType(T)) @@ -4808,7 +4808,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { if (!ClassDecl->hasUserDeclaredCopyConstructor()) ++ASTContext::NumImplicitCopyConstructors; - if (getLangOptions().CPlusPlus0x && ClassDecl->needsImplicitMoveConstructor()) + if (getLangOpts().CPlusPlus0x && ClassDecl->needsImplicitMoveConstructor()) ++ASTContext::NumImplicitMoveConstructors; if (!ClassDecl->hasUserDeclaredCopyAssignment()) { @@ -4822,7 +4822,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { DeclareImplicitCopyAssignment(ClassDecl); } - if (getLangOptions().CPlusPlus0x && ClassDecl->needsImplicitMoveAssignment()){ + if (getLangOpts().CPlusPlus0x && ClassDecl->needsImplicitMoveAssignment()){ ++ASTContext::NumImplicitMoveAssignmentOperators; // Likewise for the move assignment operator. @@ -5287,7 +5287,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, // C++0x explicit conversion operators. if (D.getDeclSpec().isExplicitSpecified()) Diag(D.getDeclSpec().getExplicitSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_explicit_conversion_functions : diag::ext_explicit_conversion_functions) << SourceRange(D.getDeclSpec().getExplicitSpecLoc()); @@ -5565,7 +5565,7 @@ NamespaceDecl *Sema::getOrCreateStdNamespace() { } bool Sema::isStdInitializerList(QualType Ty, QualType *Element) { - assert(getLangOptions().CPlusPlus && + assert(getLangOpts().CPlusPlus && "Looking for std::initializer_list outside of C++."); // We're looking for implicit instantiations of @@ -5727,8 +5727,8 @@ static bool TryNamespaceTypoCorrection(Sema &S, LookupResult &R, Scope *Sc, if (TypoCorrection Corrected = S.CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), Sc, &SS, Validator)) { - std::string CorrectedStr(Corrected.getAsString(S.getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(S.getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(S.getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(S.getLangOpts())); if (DeclContext *DC = S.computeDeclContext(SS, false)) S.Diag(IdentLoc, diag::err_using_directive_member_suggest) << Ident << DC << CorrectedQuotedStr << SS.getRange() @@ -5864,12 +5864,12 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, case UnqualifiedId::IK_ConstructorTemplateId: // C++0x inherited constructors. Diag(Name.getLocStart(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_using_decl_constructor : diag::err_using_decl_constructor) << SS.getRange(); - if (getLangOptions().CPlusPlus0x) break; + if (getLangOpts().CPlusPlus0x) break; return 0; @@ -5959,7 +5959,7 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig, // specialization. The UsingShadowDecl in D then points directly // to A::foo, which will look well-formed when we instantiate. // The right solution is to not collapse the shadow-decl chain. - if (!getLangOptions().CPlusPlus0x && CurContext->isRecord()) { + if (!getLangOpts().CPlusPlus0x && CurContext->isRecord()) { DeclContext *OrigDC = Orig->getDeclContext(); // Handle enums and anonymous structs. @@ -6441,7 +6441,7 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc, RequireCompleteDeclContext(const_cast(SS), NamedContext)) return true; - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++0x [namespace.udecl]p3: // In a using-declaration used as a member-declaration, the // nested-name-specifier shall name a base class of the class @@ -6836,7 +6836,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor( Context.getFunctionType(Context.VoidTy, 0, 0, EPI), /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true, /*isConstexpr=*/ClassDecl->defaultedDefaultConstructorIsConstexpr() && - getLangOptions().CPlusPlus0x); + getLangOpts().CPlusPlus0x); DefaultCon->setAccess(AS_public); DefaultCon->setDefaulted(); DefaultCon->setImplicit(); @@ -7649,7 +7649,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { // there is no user-declared move assignment operator, a copy assignment // operator is implicitly declared as defaulted. if ((ClassDecl->hasUserDeclaredMoveConstructor() && - !getLangOptions().MicrosoftMode) || + !getLangOpts().MicrosoftMode) || ClassDecl->hasUserDeclaredMoveAssignment() || ShouldDeleteSpecialMember(CopyAssignment, CXXCopyAssignment)) CopyAssignment->setDeletedAsWritten(); @@ -8541,7 +8541,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( Context.getFunctionType(Context.VoidTy, &ArgType, 1, EPI), /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true, /*isConstexpr=*/ClassDecl->defaultedCopyConstructorIsConstexpr() && - getLangOptions().CPlusPlus0x); + getLangOpts().CPlusPlus0x); CopyConstructor->setAccess(AS_public); CopyConstructor->setDefaulted(); CopyConstructor->setTrivial(ClassDecl->hasTrivialCopyConstructor()); @@ -8569,7 +8569,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( // declared as defaulted. if (ClassDecl->hasUserDeclaredMoveConstructor() || (ClassDecl->hasUserDeclaredMoveAssignment() && - !getLangOptions().MicrosoftMode) || + !getLangOpts().MicrosoftMode) || ShouldDeleteSpecialMember(CopyConstructor, CXXCopyConstructor)) CopyConstructor->setDeletedAsWritten(); @@ -8696,7 +8696,7 @@ CXXConstructorDecl *Sema::DeclareImplicitMoveConstructor( Context.getFunctionType(Context.VoidTy, &ArgType, 1, EPI), /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true, /*isConstexpr=*/ClassDecl->defaultedMoveConstructorIsConstexpr() && - getLangOptions().CPlusPlus0x); + getLangOpts().CPlusPlus0x); MoveConstructor->setAccess(AS_public); MoveConstructor->setDefaulted(); MoveConstructor->setTrivial(ClassDecl->hasTrivialMoveConstructor()); @@ -8844,7 +8844,7 @@ void Sema::DefineImplicitLambdaToBlockPointerConversion( // behavior. Note that only the general conversion function does this // (since it's unusable otherwise); in the case where we inline the // block literal, it has block literal lifetime semantics. - if (!BuildBlock.isInvalid() && !getLangOptions().ObjCAutoRefCount) + if (!BuildBlock.isInvalid() && !getLangOpts().ObjCAutoRefCount) BuildBlock = ImplicitCastExpr::Create(Context, BuildBlock.get()->getType(), CK_CopyAndAutoreleaseBlockObject, BuildBlock.get(), 0, VK_RValue); @@ -9528,7 +9528,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, // Only the non-fragile NeXT runtime currently supports C++ catches // of ObjC types, and no runtime supports catching ObjC types by value. - if (!Invalid && getLangOptions().ObjC1) { + if (!Invalid && getLangOpts().ObjC1) { QualType T = ExDeclType; if (const ReferenceType *RT = T->getAs()) T = RT->getPointeeType(); @@ -9537,7 +9537,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, Diag(Loc, diag::err_objc_object_catch); Invalid = true; } else if (T->isObjCObjectPointerType()) { - if (!getLangOptions().ObjCNonFragileABI) + if (!getLangOpts().ObjCNonFragileABI) Diag(Loc, diag::warn_objc_pointer_cxx_catch_fragile); } } @@ -9547,7 +9547,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, ExDecl->setExceptionVariable(true); // In ARC, infer 'retaining' for variables of retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(ExDecl)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(ExDecl)) Invalid = true; if (!Invalid && !ExDeclType->isDependentType()) { @@ -9714,7 +9714,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation Loc, std::string InsertionText = std::string(" ") + RD->getKindName(); Diag(TypeRange.getBegin(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_unelaborated_friend_type : diag::ext_unelaborated_friend_type) << (unsigned) RD->getTagKind() @@ -9723,7 +9723,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation Loc, InsertionText); } else { Diag(FriendLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_nonclass_type_friend : diag::ext_nonclass_type_friend) << T @@ -9731,7 +9731,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation Loc, } } else if (T->getAs()) { Diag(FriendLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_enum_friend : diag::ext_enum_friend) << T @@ -10073,7 +10073,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, // we do, too. if (!Previous.empty() && DC->Equals(CurContext)) Diag(DS.getFriendSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_is_member : diag::err_friend_is_member); @@ -10121,7 +10121,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, // class that is not a member of the class . . . if (DC->Equals(CurContext)) Diag(DS.getFriendSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_is_member : diag::err_friend_is_member); @@ -10732,7 +10732,7 @@ void Sema::MarkVirtualMembersReferenced(SourceLocation Loc, /// SetIvarInitializers - This routine builds initialization ASTs for the /// Objective-C implementation whose ivars need be initialized. void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return; if (ObjCInterfaceDecl *OID = ObjCImplementation->getClassInterface()) { SmallVector ivars; diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 4df5ab39168f..285ef015d769 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -157,7 +157,7 @@ void Sema::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, Diag(Overridden->getLocation(), diag::note_related_result_type_overridden); } - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { if ((NewMethod->hasAttr() != Overridden->hasAttr())) { Diag(NewMethod->getLocation(), @@ -299,7 +299,7 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { } // In ARC, disallow definition of retain/release/autorelease/retainCount - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { switch (MDecl->getMethodFamily()) { case OMF_retain: case OMF_retainCount: @@ -338,11 +338,11 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { // Only do this if the current class actually has a superclass. if (IC->getSuperClass()) { ObjCShouldCallSuperDealloc = - !(Context.getLangOptions().ObjCAutoRefCount || - Context.getLangOptions().getGC() == LangOptions::GCOnly) && + !(Context.getLangOpts().ObjCAutoRefCount || + Context.getLangOpts().getGC() == LangOptions::GCOnly) && MDecl->getMethodFamily() == OMF_dealloc; ObjCShouldCallSuperFinalize = - Context.getLangOptions().getGC() != LangOptions::NonGC && + Context.getLangOpts().getGC() != LangOptions::NonGC && MDecl->getMethodFamily() == OMF_finalize; } } @@ -1386,7 +1386,7 @@ static bool checkMethodFamilyMismatch(Sema &S, ObjCMethodDecl *impl, void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl) { - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && checkMethodFamilyMismatch(*this, ImpMethodDecl, MethodDecl)) return; @@ -1493,7 +1493,7 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, ObjCInterfaceDecl *Super = IDecl->getSuperClass(); ObjCInterfaceDecl *NSIDecl = 0; - if (getLangOptions().NeXTRuntime) { + if (getLangOpts().NeXTRuntime) { // check to see if class implements forwardInvocation method and objects // of this class are derived from 'NSProxy' so that to forward requests // from one object to another. @@ -1942,7 +1942,7 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left, left->getResultType(), right->getResultType())) return false; - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (left->hasAttr() != right->hasAttr() || left->hasAttr() @@ -1959,7 +1959,7 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left, if (!matchTypes(Context, strategy, lparm->getType(), rparm->getType())) return false; - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && lparm->hasAttr() != rparm->hasAttr()) return false; } @@ -2086,14 +2086,14 @@ ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R, // differences. In ARC, however, we also need to check for loose // mismatches, because most of them are errors. if (!strictSelectorMatch || - (issueDiagnostic && getLangOptions().ObjCAutoRefCount)) + (issueDiagnostic && getLangOpts().ObjCAutoRefCount)) for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next) { // This checks if the methods differ in type mismatch. if (!MatchTwoMethodDeclarations(MethList.Method, Next->Method, MMS_loose) && !isAcceptableMethodMismatch(MethList.Method, Next->Method)) { issueDiagnostic = true; - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) issueError = true; break; } @@ -2856,7 +2856,7 @@ Decl *Sema::ActOnMethodDeclaration( } bool ARCError = false; - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) ARCError = CheckARCMethodDecl(*this, ObjCMethod); // Infer the related result type when possible. @@ -2945,7 +2945,7 @@ void Sema::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, for (SmallVectorImpl::iterator D = Decls.begin(); D != Decls.end(); ++D) { FieldDecl *FD = cast(*D); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) PushOnScopeChains(cast(FD), S); else if (RecordDecl *Record = dyn_cast(TagD)) Record->addDecl(FD); @@ -2986,7 +2986,7 @@ VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T, New->setExceptionVariable(true); // In ARC, infer 'retaining' for variables of retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(New)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(New)) Invalid = true; if (Invalid) @@ -3014,7 +3014,7 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) { // Check that there are no default arguments inside the type of this // exception object (C++ only). - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) CheckExtraCXXDefaultArguments(D); TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 8b6fcaa2b802..42221f8df48a 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -102,7 +102,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { bool MissingExceptionSpecification = false; bool MissingEmptyExceptionSpecification = false; unsigned DiagID = diag::err_mismatched_exception_spec; - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_mismatched_exception_spec; if (!CheckEquivalentExceptionSpec(PDiag(DiagID), @@ -171,7 +171,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // If exceptions are disabled, suppress the warning about missing // exception specifications for new and delete operators. - if (!getLangOptions().CXXExceptions) { + if (!getLangOpts().CXXExceptions) { switch (New->getDeclName().getCXXOverloadedOperator()) { case OO_New: case OO_Array_New: @@ -265,7 +265,7 @@ bool Sema::CheckEquivalentExceptionSpec( const FunctionProtoType *Old, SourceLocation OldLoc, const FunctionProtoType *New, SourceLocation NewLoc) { unsigned DiagID = diag::err_mismatched_exception_spec; - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_mismatched_exception_spec; return CheckEquivalentExceptionSpec( PDiag(DiagID), @@ -286,7 +286,7 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID, bool AllowNoexceptAllMatchWithNoSpec, bool IsOperatorNew) { // Just completely ignore this under -fno-exceptions. - if (!getLangOptions().CXXExceptions) + if (!getLangOpts().CXXExceptions) return false; if (MissingExceptionSpecification) @@ -380,7 +380,7 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID, // As a special compatibility feature, under C++0x we accept no spec and // throw(std::bad_alloc) as equivalent for operator new and operator new[]. // This is because the implicit declaration changed, but old code would break. - if (getLangOptions().CPlusPlus0x && IsOperatorNew) { + if (getLangOpts().CPlusPlus0x && IsOperatorNew) { const FunctionProtoType *WithExceptions = 0; if (OldEST == EST_None && NewEST == EST_Dynamic) WithExceptions = New; @@ -474,7 +474,7 @@ bool Sema::CheckExceptionSpecSubset( const FunctionProtoType *Subset, SourceLocation SubLoc) { // Just auto-succeed under -fno-exceptions. - if (!getLangOptions().CXXExceptions) + if (!getLangOpts().CXXExceptions) return false; // FIXME: As usual, we could be more specific in our error messages, but @@ -702,7 +702,7 @@ bool Sema::CheckExceptionSpecCompatibility(Expr *From, QualType ToType) bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old) { - if (getLangOptions().CPlusPlus0x && isa(New)) { + if (getLangOpts().CPlusPlus0x && isa(New)) { // Don't check uninstantiated template destructors at all. We can only // synthesize correct specs after the template is instantiated. if (New->getParent()->isDependentType()) @@ -716,7 +716,7 @@ bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, } } unsigned DiagID = diag::err_override_exception_spec; - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_override_exception_spec; return CheckExceptionSpecSubset(PDiag(DiagID), PDiag(diag::note_overridden_virtual_function), diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index a57e2ac9b23f..8aac35ee69ba 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -122,7 +122,7 @@ static AvailabilityResult DiagnoseAvailabilityOfDecl(Sema &S, /// bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass) { - if (getLangOptions().CPlusPlus && isa(D)) { + if (getLangOpts().CPlusPlus && isa(D)) { // If there were any diagnostics suppressed by template argument deduction, // emit them now. llvm::DenseMap >::iterator @@ -310,7 +310,7 @@ ExprResult Sema::DefaultFunctionArrayConversion(Expr *E) { // An lvalue or rvalue of type "array of N T" or "array of unknown bound of // T" can be converted to an rvalue of type "pointer to T". // - if (getLangOptions().C99 || getLangOptions().CPlusPlus || E->isLValue()) + if (getLangOpts().C99 || getLangOpts().CPlusPlus || E->isLValue()) E = ImpCastExprToType(E, Context.getArrayDecayedType(Ty), CK_ArrayToPointerDecay).take(); } @@ -358,7 +358,7 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) { // We don't want to throw lvalue-to-rvalue casts on top of // expressions of certain types in C++. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && (E->getType() == Context.OverloadTy || T->isDependentType() || T->isRecordType())) @@ -483,7 +483,7 @@ ExprResult Sema::DefaultArgumentPromotion(Expr *E) { // is a prvalue for the temporary. // FIXME: add some way to gate this entire thing for correctness in // potentially potentially evaluated contexts. - if (getLangOptions().CPlusPlus && E->isGLValue() && + if (getLangOpts().CPlusPlus && E->isGLValue() && ExprEvalContexts.back().Context != Unevaluated) { ExprResult Temp = PerformCopyInitialization( InitializedEntity::InitializeTemporary(E->getType()), @@ -540,7 +540,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, // or a non-trivial destructor, with no corresponding parameter, // is conditionally-supported with implementation-defined semantics. bool TrivialEnough = false; - if (getLangOptions().CPlusPlus0x && !E->getType()->isDependentType()) { + if (getLangOpts().CPlusPlus0x && !E->getType()->isDependentType()) { if (CXXRecordDecl *Record = E->getType()->getAsCXXRecordDecl()) { if (Record->hasTrivialCopyConstructor() && Record->hasTrivialMoveConstructor() && @@ -554,7 +554,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, } if (!TrivialEnough && - getLangOptions().ObjCAutoRefCount && + getLangOpts().ObjCAutoRefCount && E->getType()->isObjCLifetimeType()) TrivialEnough = true; @@ -562,7 +562,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, // Nothing to diagnose. This is okay. } else if (DiagRuntimeBehavior(E->getLocStart(), 0, PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg) - << getLangOptions().CPlusPlus0x << E->getType() + << getLangOpts().CPlusPlus0x << E->getType() << CT)) { // Turn this into a trap. CXXScopeSpec SS; @@ -588,7 +588,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, } } // c++ rules are enforced elsewhere. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && RequireCompleteType(E->getExprLoc(), E->getType(), diag::err_call_incomplete_argument)) return ExprError(); @@ -1127,7 +1127,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc, static SourceLocation getUDSuffixLoc(Sema &S, SourceLocation TokLoc, unsigned Offset) { return Lexer::AdvanceToTokenCharacter(TokLoc, Offset, S.getSourceManager(), - S.getLangOptions()); + S.getLangOpts()); } /// BuildCookedLiteralOperatorCall - A user-defined literal was found. Look up @@ -1199,7 +1199,7 @@ Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks, Kind = StringLiteral::UTF32; // A C++ string literal has a const-qualified element type (C++ 2.13.4p1). - if (getLangOptions().CPlusPlus || getLangOptions().ConstStrings) + if (getLangOpts().CPlusPlus || getLangOpts().ConstStrings) StrTy.addConst(); // Get an array type for the string, according to C99 6.4.5. This includes @@ -1252,7 +1252,7 @@ ExprResult Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, const DeclarationNameInfo &NameInfo, const CXXScopeSpec *SS) { - if (getLangOptions().CUDA) + if (getLangOpts().CUDA) if (const FunctionDecl *Caller = dyn_cast(CurContext)) if (const FunctionDecl *Callee = dyn_cast(D)) { CUDAFunctionTarget CallerTarget = IdentifyCUDATarget(Caller), @@ -1373,7 +1373,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CXXMethodDecl *DepMethod = cast_or_null( CurMethod->getInstantiatedFromMemberFunction()); if (DepMethod) { - if (getLangOptions().MicrosoftMode) + if (getLangOpts().MicrosoftMode) diagnostic = diag::warn_found_via_dependent_bases_lookup; Diag(R.getNameLoc(), diagnostic) << Name << FixItHint::CreateInsertion(R.getNameLoc(), "this->"); @@ -1401,7 +1401,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, Diag(R.getNameLoc(), diagnostic) << Name; } } else { - if (getLangOptions().MicrosoftMode) + if (getLangOpts().MicrosoftMode) diagnostic = diag::warn_found_via_dependent_bases_lookup; Diag(R.getNameLoc(), diagnostic) << Name; } @@ -1430,7 +1430,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, // function definition declared at class scope then we must set // DC to the lexical parent to be able to search into the parent // class. - if (getLangOptions().MicrosoftMode && isa(DC) && + if (getLangOpts().MicrosoftMode && isa(DC) && cast(DC)->getFriendObjectKind() && DC->getLexicalParent()->isRecord()) DC = DC->getLexicalParent(); @@ -1442,8 +1442,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, TypoCorrection Corrected; if (S && (Corrected = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, &SS, CCC))) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); R.setLookupName(Corrected.getCorrection()); if (NamedDecl *ND = Corrected.getCorrectionDecl()) { @@ -1636,7 +1636,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, if (R.empty() && !ADL) { // Otherwise, this could be an implicitly declared function reference (legal // in C90, extension in C99, forbidden in C++). - if (HasTrailingLParen && II && !getLangOptions().CPlusPlus) { + if (HasTrailingLParen && II && !getLangOpts().CPlusPlus) { NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *II, S); if (D) R.addDecl(D); } @@ -1649,7 +1649,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, // and we can't resolve an identifier then assume the identifier is type // dependent. The goal is to postpone name lookup to instantiation time // to be able to search into type dependent base classes. - if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && isa(CurContext)) return ActOnDependentIdExpression(SS, TemplateKWLoc, NameInfo, IsAddressOfOperand, TemplateArgs); @@ -1814,7 +1814,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, // Diagnose the use of an ivar outside of the declaring class. if (IV->getAccessControl() == ObjCIvarDecl::Private && !declaresSameEntity(ClassDeclared, IFace) && - !getLangOptions().DebuggerSupport) + !getLangOpts().DebuggerSupport) Diag(Loc, diag::error_private_ivar_access) << IV->getDeclName(); // FIXME: This should use a new expr for a direct reference, don't @@ -1860,7 +1860,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, if (Lookup.empty() && II && AllowBuiltinCreation) { // FIXME. Consolidate this with similar code in LookupName. if (unsigned BuiltinID = II->getBuiltinID()) { - if (!(getLangOptions().CPlusPlus && + if (!(getLangOpts().CPlusPlus && Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))) { NamedDecl *D = LazilyCreateBuiltin((IdentifierInfo *)II, BuiltinID, S, Lookup.isForRedeclaration(), @@ -2052,7 +2052,7 @@ bool Sema::UseArgumentDependentLookup(const CXXScopeSpec &SS, return false; // Only in C++ or ObjC++. - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; // Turn off ADL when we find certain kinds of declarations during @@ -2232,7 +2232,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, // exist in the high-level semantics. case Decl::Field: case Decl::IndirectField: - assert(getLangOptions().CPlusPlus && + assert(getLangOpts().CPlusPlus && "building reference to field in C?"); // These can't have reference type in well-formed programs, but @@ -2259,7 +2259,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, case Decl::Var: // In C, "extern void blah;" is valid and is an r-value. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && !type.hasQualifiers() && type->isVoidType()) { valueKind = VK_RValue; @@ -2297,7 +2297,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, } // Functions are l-values in C++. - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { valueKind = VK_LValue; break; } @@ -2400,7 +2400,7 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok, Scope *UDLScope) { Ty = Context.Char16Ty; // u'x' -> char16_t in C11 and C++11. else if (Literal.isUTF32()) Ty = Context.Char32Ty; // U'x' -> char32_t in C11 and C++11. - else if (!getLangOptions().CPlusPlus || Literal.isMultiChar()) + else if (!getLangOpts().CPlusPlus || Literal.isMultiChar()) Ty = Context.IntTy; // 'x' -> int in C, 'wxyz' -> int in C++. else Ty = Context.CharTy; // 'x' -> char in C++ @@ -2601,9 +2601,9 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { Res = BuildFloatingLiteral(*this, Literal, Ty, Tok.getLocation()); if (Ty == Context.DoubleTy) { - if (getLangOptions().SinglePrecisionConstants) { + if (getLangOpts().SinglePrecisionConstants) { Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).take(); - } else if (getLangOptions().OpenCL && !getOpenCLOptions().cl_khr_fp64) { + } else if (getLangOpts().OpenCL && !getOpenCLOptions().cl_khr_fp64) { Diag(Tok.getLocation(), diag::warn_double_const_requires_fp64); Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).take(); } @@ -2614,9 +2614,9 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { QualType Ty; // long long is a C99 feature. - if (!getLangOptions().C99 && Literal.isLongLong) + if (!getLangOpts().C99 && Literal.isLongLong) Diag(Tok.getLocation(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_longlong : diag::ext_longlong); // Get the value in the widest-possible width. @@ -2678,7 +2678,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { // To be compatible with MSVC, hex integer literals ending with the // LL or i64 suffix are always signed in Microsoft mode. if (!Literal.isUnsigned && (ResultVal[LongLongSize-1] == 0 || - (getLangOptions().MicrosoftExt && Literal.isLongLong))) + (getLangOpts().MicrosoftExt && Literal.isLongLong))) Ty = Context.LongLongTy; else if (AllowUnsigned) Ty = Context.UnsignedLongLongTy; @@ -3058,7 +3058,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *LHSExp = Base, *RHSExp = Idx; - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && (LHSExp->isTypeDependent() || RHSExp->isTypeDependent())) { return Owned(new (Context) ArraySubscriptExpr(LHSExp, RHSExp, Context.DependentTy, @@ -3066,7 +3066,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, RLoc)); } - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && (LHSExp->getType()->isRecordType() || LHSExp->getType()->isEnumeralType() || RHSExp->getType()->isRecordType() || @@ -3193,7 +3193,7 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, return ExprError(); } - if (ResultType->isVoidType() && !getLangOptions().CPlusPlus) { + if (ResultType->isVoidType() && !getLangOpts().CPlusPlus) { // GNU extension: subscripting on pointer to void Diag(LLoc, diag::ext_gnu_subscript_void_type) << BaseExpr->getSourceRange(); @@ -3525,7 +3525,7 @@ Sema::CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr) { // Static array parameters are not supported in C++. - if (!Param || getLangOptions().CPlusPlus) + if (!Param || getLangOpts().CPlusPlus) return; QualType OrigTy = Param->getOriginalType(); @@ -3579,7 +3579,7 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, Expr **Args = ArgExprs.release(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // If this is a pseudo-destructor expression, build the call immediately. if (isa(Fn)) { if (NumArgs > 0) { @@ -3785,7 +3785,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, << Fn->getType() << Fn->getSourceRange()); } - if (getLangOptions().CUDA) { + if (getLangOpts().CUDA) { if (Config) { // CUDA: Kernel calls must be to global functions if (FDecl && !FDecl->hasAttr()) @@ -3956,7 +3956,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, } // In C, compound literals are l-values for some reason. - ExprValueKind VK = getLangOptions().CPlusPlus ? VK_RValue : VK_LValue; + ExprValueKind VK = getLangOpts().CPlusPlus ? VK_RValue : VK_LValue; return MaybeBindToTemporary( new (Context) CompoundLiteralExpr(LParenLoc, TInfo, literalType, @@ -3998,7 +3998,7 @@ static void maybeExtendBlockObject(Sema &S, ExprResult &E) { assert(E.get()->isRValue()); // Only do this in an r-value context. - if (!S.getLangOptions().ObjCAutoRefCount) return; + if (!S.getLangOpts().ObjCAutoRefCount) return; E = ImplicitCastExpr::Create(S.Context, E.get()->getType(), CK_ARCExtendBlockObject, E.get(), @@ -4221,7 +4221,7 @@ ExprResult Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, // (See OpenCL 6.2). if (SrcTy->isVectorType()) { if (Context.getTypeSize(DestTy) != Context.getTypeSize(SrcTy) - || (getLangOptions().OpenCL && + || (getLangOpts().OpenCL && (DestTy.getCanonicalType() != SrcTy.getCanonicalType()))) { Diag(R.getBegin(),diag::err_invalid_conversion_between_ext_vectors) << DestTy << SrcTy << R; @@ -4261,7 +4261,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, if (D.isInvalidType()) return ExprError(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -4277,7 +4277,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, // i.e. all the elements are integer constants. ParenExpr *PE = dyn_cast(CastExpr); ParenListExpr *PLE = dyn_cast(CastExpr); - if ((getLangOptions().AltiVec || getLangOptions().OpenCL) + if ((getLangOpts().AltiVec || getLangOpts().OpenCL) && castType->isVectorType() && (PE || PLE)) { if (PLE && PLE->getNumExprs() == 0) { Diag(PLE->getExprLoc(), diag::err_altivec_empty_initializer); @@ -4362,7 +4362,7 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc, else { // For OpenCL, when the number of initializers is a single value, // it will be replicated to all components of the vector. - if (getLangOptions().OpenCL && + if (getLangOpts().OpenCL && VTy->getVectorKind() == VectorType::GenericVector && numExprs == 1) { QualType ElemTy = Ty->getAs()->getElementType(); @@ -4460,11 +4460,11 @@ static bool checkCondition(Sema &S, Expr *Cond) { if (CondTy->isScalarType()) return false; // OpenCL: Sec 6.3.i says the condition is allowed to be a vector or scalar. - if (S.getLangOptions().OpenCL && CondTy->isVectorType()) + if (S.getLangOpts().OpenCL && CondTy->isVectorType()) return false; // Emit the proper error message. - S.Diag(Cond->getLocStart(), S.getLangOptions().OpenCL ? + S.Diag(Cond->getLocStart(), S.getLangOpts().OpenCL ? diag::err_typecheck_cond_expect_scalar : diag::err_typecheck_cond_expect_scalar_or_vector) << CondTy; @@ -4676,7 +4676,7 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, RHS = move(RHSResult); // C++ is sufficiently different to merit its own checker. - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return CXXCheckConditionalOperands(Cond, LHS, RHS, VK, OK, QuestionLoc); VK = VK_RValue; @@ -4707,7 +4707,7 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, // OpenCL: If the condition is a vector, and both operands are scalar, // attempt to implicity convert them to the vector type to act like the // built in select. - if (getLangOptions().OpenCL && CondTy->isVectorType()) + if (getLangOpts().OpenCL && CondTy->isVectorType()) if (checkConditionalConvertScalarsToVectors(*this, LHS, RHS, CondTy)) return QualType(); @@ -4882,7 +4882,7 @@ QualType Sema::FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, } // Check Objective-C object pointer types and 'void *' if (LHSTy->isVoidPointerType() && RHSTy->isObjCObjectPointerType()) { - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { // ARC forbids the implicit conversion of object pointers to 'void *', // so these types are not compatible. Diag(QuestionLoc, diag::err_cond_voidptr_arc) << LHSTy << RHSTy @@ -4902,7 +4902,7 @@ QualType Sema::FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, return destType; } if (LHSTy->isObjCObjectPointerType() && RHSTy->isVoidPointerType()) { - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { // ARC forbids the implicit conversion of object pointers to 'void *', // so these types are not compatible. Diag(QuestionLoc, diag::err_cond_voidptr_arc) << LHSTy << RHSTy @@ -5056,7 +5056,7 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, // We usually want to apply unary conversions *before* saving, except // in the special case of a C++ l-value conditional. - if (!(getLangOptions().CPlusPlus + if (!(getLangOpts().CPlusPlus && !commonExpr->isTypeDependent() && commonExpr->getValueKind() == RHSExpr->getValueKind() && commonExpr->isGLValue() @@ -5218,7 +5218,7 @@ checkPointerTypesForAssignment(Sema &S, QualType LHSType, QualType RHSType) { // General pointer incompatibility takes priority over qualifiers. return Sema::IncompatiblePointer; } - if (!S.getLangOptions().CPlusPlus && + if (!S.getLangOpts().CPlusPlus && S.IsNoReturnConversion(ltrans, rtrans, ltrans)) return Sema::IncompatiblePointer; return ConvTy; @@ -5241,7 +5241,7 @@ checkBlockPointerTypesForAssignment(Sema &S, QualType LHSType, rhptee = cast(RHSType)->getPointeeType(); // In C++, the types have to match exactly. - if (S.getLangOptions().CPlusPlus) + if (S.getLangOpts().CPlusPlus) return Sema::IncompatibleBlockPointer; Sema::AssignConvertType ConvTy = Sema::Compatible; @@ -5402,7 +5402,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, // If we are allowing lax vector conversions, and LHS and RHS are both // vectors, the total size only needs to be the same. This is a bitcast; // no bits are changed but the result type is different. - if (getLangOptions().LaxVectorConversions && + if (getLangOpts().LaxVectorConversions && (Context.getTypeSize(LHSType) == Context.getTypeSize(RHSType))) { Kind = CK_BitCast; return IncompatibleVectors; @@ -5413,7 +5413,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, // Arithmetic conversions. if (LHSType->isArithmeticType() && RHSType->isArithmeticType() && - !(getLangOptions().CPlusPlus && LHSType->isEnumeralType())) { + !(getLangOpts().CPlusPlus && LHSType->isEnumeralType())) { Kind = PrepareScalarCast(RHS, LHSType); return Compatible; } @@ -5479,7 +5479,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, } // id -> T^ - if (getLangOptions().ObjC1 && RHSType->isObjCIdType()) { + if (getLangOpts().ObjC1 && RHSType->isObjCIdType()) { Kind = CK_AnyPointerToBlockPointerCast; return Compatible; } @@ -5501,7 +5501,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, Kind = CK_BitCast; Sema::AssignConvertType result = checkObjCPointerTypesForAssignment(*this, LHSType, RHSType); - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && result == Compatible && !CheckObjCARCUnavailableWeakConversion(OrigLHSType, RHSType)) result = IncompatibleObjCWeakRef; @@ -5668,7 +5668,7 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType, Sema::AssignConvertType Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose) { - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (!LHSType->isRecordType() && !LHSType->isAtomicType()) { // C++ 5.17p3: If the left operand is not of class type, the // expression is implicitly converted (C++ 4) to the @@ -5693,7 +5693,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, if (Res.isInvalid()) return Incompatible; Sema::AssignConvertType result = Compatible; - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && !CheckObjCARCUnavailableWeakConversion(LHSType, RHS.get()->getType())) result = IncompatibleObjCWeakRef; @@ -5789,7 +5789,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, return RHSType; } - if (getLangOptions().LaxVectorConversions && + if (getLangOpts().LaxVectorConversions && Context.getTypeSize(LHSType) == Context.getTypeSize(RHSType)) { // If we are allowing lax vector conversions, and LHS and RHS are both // vectors, the total size only needs to be the same. This is a @@ -5946,7 +5946,7 @@ QualType Sema::CheckRemainderOperands( /// \brief Diagnose invalid arithmetic on two void pointers. static void diagnoseArithmeticOnTwoVoidPointers(Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr) { - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_void_type : diag::ext_gnu_void_ptr) << 1 /* two pointers */ << LHSExpr->getSourceRange() @@ -5956,7 +5956,7 @@ static void diagnoseArithmeticOnTwoVoidPointers(Sema &S, SourceLocation Loc, /// \brief Diagnose invalid arithmetic on a void pointer. static void diagnoseArithmeticOnVoidPointer(Sema &S, SourceLocation Loc, Expr *Pointer) { - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_void_type : diag::ext_gnu_void_ptr) << 0 /* one pointer */ << Pointer->getSourceRange(); @@ -5967,7 +5967,7 @@ static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS) { assert(LHS->getType()->isAnyPointerType()); assert(RHS->getType()->isAnyPointerType()); - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_function_type : diag::ext_gnu_ptr_func_arith) << 1 /* two pointers */ << LHS->getType()->getPointeeType() @@ -5982,7 +5982,7 @@ static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc, static void diagnoseArithmeticOnFunctionPointer(Sema &S, SourceLocation Loc, Expr *Pointer) { assert(Pointer->getType()->isAnyPointerType()); - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_function_type : diag::ext_gnu_ptr_func_arith) << 0 /* one pointer */ << Pointer->getType()->getPointeeType() @@ -6023,11 +6023,11 @@ static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc, QualType PointeeTy = Operand->getType()->getPointeeType(); if (PointeeTy->isVoidType()) { diagnoseArithmeticOnVoidPointer(S, Loc, Operand); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } if (PointeeTy->isFunctionType()) { diagnoseArithmeticOnFunctionPointer(S, Loc, Operand); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } if (checkArithmeticIncompletePointerType(S, Loc, Operand)) return false; @@ -6062,7 +6062,7 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc, else if (!isLHSVoidPtr) diagnoseArithmeticOnVoidPointer(S, Loc, RHSExpr); else diagnoseArithmeticOnTwoVoidPointers(S, Loc, LHSExpr, RHSExpr); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } bool isLHSFuncPtr = isLHSPointer && LHSPointeeTy->isFunctionType(); @@ -6073,7 +6073,7 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc, RHSExpr); else diagnoseArithmeticOnTwoFunctionPointers(S, Loc, LHSExpr, RHSExpr); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } if (checkArithmeticIncompletePointerType(S, Loc, LHSExpr)) return false; @@ -6271,7 +6271,7 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, = RHS.get()->getType()->getAs()) { QualType rpointee = RHSPTy->getPointeeType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Pointee types must be the same: C++ [expr.add] if (!Context.hasSameUnqualifiedType(lpointee, rpointee)) { diagnosePointerIncompatibility(*this, Loc, LHS.get(), RHS.get()); @@ -6676,7 +6676,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, QualType RCanPointeeTy = RHSType->castAs()->getPointeeType().getCanonicalType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (LCanPointeeTy == RCanPointeeTy) return ResultTy; if (!IsRelational && @@ -6732,7 +6732,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, return ResultTy; } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Comparison of nullptr_t with itself. if (LHSType->isNullPtrType() && RHSType->isNullPtrType()) return ResultTy; @@ -6856,11 +6856,11 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, bool isError = false; if ((LHSIsNull && LHSType->isIntegerType()) || (RHSIsNull && RHSType->isIntegerType())) { - if (IsRelational && !getLangOptions().CPlusPlus) + if (IsRelational && !getLangOpts().CPlusPlus) DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_and_zero; - } else if (IsRelational && !getLangOptions().CPlusPlus) + } else if (IsRelational && !getLangOpts().CPlusPlus) DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_integer; - else if (getLangOptions().CPlusPlus) { + else if (getLangOpts().CPlusPlus) { DiagID = diag::err_typecheck_comparison_of_pointer_integer; isError = true; } else @@ -7023,7 +7023,7 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] // Parens on the RHS are ignored. llvm::APSInt Result; if (RHS.get()->EvaluateAsInt(Result, Context)) - if ((getLangOptions().Bool && !RHS.get()->getType()->isBooleanType()) || + if ((getLangOpts().Bool && !RHS.get()->getType()->isBooleanType()) || (Result != 0 && Result != 1)) { Diag(Loc, diag::warn_logical_instead_of_bitwise) << RHS.get()->getSourceRange() @@ -7033,7 +7033,7 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] << (Opc == BO_LAnd ? "&" : "|") << FixItHint::CreateReplacement(SourceRange( Loc, Lexer::getLocForEndOfToken(Loc, 0, getSourceManager(), - getLangOptions())), + getLangOpts())), Opc == BO_LAnd ? "&" : "|"); if (Opc == BO_LAnd) // Suggest replacing "Foo() && kNonZero" with "Foo()" @@ -7042,12 +7042,12 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] SourceRange( Lexer::getLocForEndOfToken(LHS.get()->getLocEnd(), 0, getSourceManager(), - getLangOptions()), + getLangOpts()), RHS.get()->getLocEnd())); } } - if (!Context.getLangOptions().CPlusPlus) { + if (!Context.getLangOpts().CPlusPlus) { LHS = UsualUnaryConversions(LHS.take()); if (LHS.isInvalid()) return QualType(); @@ -7150,7 +7150,7 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) { // In ARC, use some specialized diagnostics for occasions where we // infer 'const'. These are always pseudo-strong variables. - if (S.getLangOptions().ObjCAutoRefCount) { + if (S.getLangOpts().ObjCAutoRefCount) { DeclRefExpr *declRef = dyn_cast(E->IgnoreParenCasts()); if (declRef && isa(declRef->getDecl())) { VarDecl *var = cast(declRef->getDecl()); @@ -7293,7 +7293,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, if (ConvTy == Compatible) { if (LHSType.getObjCLifetime() == Qualifiers::OCL_Strong) checkRetainCycles(LHSExpr, RHS.get()); - else if (getLangOptions().ObjCAutoRefCount) + else if (getLangOpts().ObjCAutoRefCount) checkUnsafeExprAssigns(Loc, LHSExpr, RHS.get()); } } else { @@ -7314,7 +7314,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, // is converted to the type of the assignment expression (above). // C++ 5.17p1: the type of the assignment expression is that of its left // operand. - return (getLangOptions().CPlusPlus + return (getLangOpts().CPlusPlus ? LHSType : LHSType.getUnqualifiedType()); } @@ -7338,7 +7338,7 @@ static QualType CheckCommaOperands(Sema &S, ExprResult &LHS, ExprResult &RHS, if (LHS.isInvalid()) return QualType(); - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { RHS = S.DefaultFunctionArrayLvalueConversion(RHS.take()); if (RHS.isInvalid()) return QualType(); @@ -7368,7 +7368,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, assert(!ResType.isNull() && "no type for increment/decrement expression"); - if (S.getLangOptions().CPlusPlus && ResType->isBooleanType()) { + if (S.getLangOpts().CPlusPlus && ResType->isBooleanType()) { // Decrement of bool is not allowed. if (!IsInc) { S.Diag(OpLoc, diag::err_decrement_bool) << Op->getSourceRange(); @@ -7395,7 +7395,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, if (PR.isInvalid()) return QualType(); return CheckIncrementDecrementOperand(S, PR.take(), VK, OpLoc, IsInc, IsPrefix); - } else if (S.getLangOptions().AltiVec && ResType->isVectorType()) { + } else if (S.getLangOpts().AltiVec && ResType->isVectorType()) { // OK! ( C/C++ Language Extensions for CBEA(Version 2.6) 10.3 ) } else { S.Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement) @@ -7409,7 +7409,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, // In C++, a prefix increment is the same type as the operand. Otherwise // (in C or with postfix), the increment is the unqualified type of the // operand. - if (IsPrefix && S.getLangOptions().CPlusPlus) { + if (IsPrefix && S.getLangOpts().CPlusPlus) { VK = VK_LValue; return ResType; } else { @@ -7534,7 +7534,7 @@ static QualType CheckAddressOfOperand(Sema &S, ExprResult &OrigOp, // Make sure to ignore parentheses in subsequent checks Expr *op = OrigOp.get()->IgnoreParens(); - if (S.getLangOptions().C99) { + if (S.getLangOpts().C99) { // Implement C99-only parts of addressof rules. if (UnaryOperator* uOp = dyn_cast(op)) { if (uOp->getOpcode() == UO_Deref) @@ -7611,7 +7611,7 @@ static QualType CheckAddressOfOperand(Sema &S, ExprResult &OrigOp, // in C++ it is not error to take address of a register // variable (c++03 7.1.1P3) if (vd->getStorageClass() == SC_Register && - !S.getLangOptions().CPlusPlus) { + !S.getLangOpts().CPlusPlus) { AddressOfError = AO_Register_Variable; } } else if (isa(dcl)) { @@ -7703,7 +7703,7 @@ static QualType CheckIndirectionOperand(Sema &S, Expr *Op, ExprValueKind &VK, VK = VK_LValue; // ...except that certain expressions are never l-values in C. - if (!S.getLangOptions().CPlusPlus && Result.isCForbiddenLValueType()) + if (!S.getLangOpts().CPlusPlus && Result.isCForbiddenLValueType()) VK = VK_RValue; return Result; @@ -7810,7 +7810,7 @@ static void DiagnoseSelfAssignment(Sema &S, Expr *LHSExpr, Expr *RHSExpr, ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr) { - if (getLangOptions().CPlusPlus0x && isa(RHSExpr)) { + if (getLangOpts().CPlusPlus0x && isa(RHSExpr)) { // The syntax only allows initializer lists on the RHS of assignment, // so we don't need to worry about accepting invalid code for // non-assignment operators. @@ -7840,7 +7840,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, switch (Opc) { case BO_Assign: ResultTy = CheckAssignmentOperands(LHS.get(), RHS, OpLoc, QualType()); - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && LHS.get()->getObjectKind() != OK_ObjCProperty) { VK = LHS.get()->getValueKind(); OK = LHS.get()->getObjectKind(); @@ -7931,7 +7931,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, break; case BO_Comma: ResultTy = CheckCommaOperands(*this, LHS, RHS, OpLoc); - if (getLangOptions().CPlusPlus && !RHS.isInvalid()) { + if (getLangOpts().CPlusPlus && !RHS.isInvalid()) { VK = RHS.get()->getValueKind(); OK = RHS.get()->getObjectKind(); } @@ -7947,7 +7947,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, if (CompResultTy.isNull()) return Owned(new (Context) BinaryOperator(LHS.take(), RHS.take(), Opc, ResultTy, VK, OK, OpLoc)); - if (getLangOptions().CPlusPlus && LHS.get()->getObjectKind() != + if (getLangOpts().CPlusPlus && LHS.get()->getObjectKind() != OK_ObjCProperty) { VK = VK_LValue; OK = LHS.get()->getObjectKind(); @@ -8213,7 +8213,7 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, RHSExpr = resolvedRHS.take(); } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // If either expression is type-dependent, always build an // overloaded op. if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent()) @@ -8266,10 +8266,10 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, if (resultType->isArithmeticType() || // C99 6.5.3.3p1 resultType->isVectorType()) break; - else if (getLangOptions().CPlusPlus && // C++ [expr.unary.op]p6-7 + else if (getLangOpts().CPlusPlus && // C++ [expr.unary.op]p6-7 resultType->isEnumeralType()) break; - else if (getLangOptions().CPlusPlus && // C++ [expr.unary.op]p6 + else if (getLangOpts().CPlusPlus && // C++ [expr.unary.op]p6 Opc == UO_Plus && resultType->isPointerType()) break; @@ -8312,7 +8312,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, break; if (resultType->isScalarType()) { // C99 6.5.3.3p1: ok, fallthrough; - if (Context.getLangOptions().CPlusPlus) { + if (Context.getLangOpts().CPlusPlus) { // C++03 [expr.unary.op]p8, C++0x [expr.unary.op]p9: // operand contextually converted to bool. Input = ImpCastExprToType(Input.take(), Context.BoolTy, @@ -8341,7 +8341,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, if (Input.get()->getValueKind() != VK_RValue && Input.get()->getObjectKind() == OK_Ordinary) VK = Input.get()->getValueKind(); - } else if (!getLangOptions().CPlusPlus) { + } else if (!getLangOpts().CPlusPlus) { // In C, a volatile scalar is read by __imag. In C++, it is not. Input = DefaultLvalueConversion(Input.take()); } @@ -8436,7 +8436,7 @@ ExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc, Input = Result.take(); } - if (getLangOptions().CPlusPlus && Input->getType()->isOverloadableType() && + if (getLangOpts().CPlusPlus && Input->getType()->isOverloadableType() && UnaryOperator::getOverloadedOperator(Opc) != OO_None && !(Opc == UO_AddrOf && isQualifiedMemberAccess(Input))) { // Find all of the overloaded operators visible from this @@ -8884,7 +8884,7 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) { if (Param->getIdentifier() == 0 && !Param->isImplicit() && !Param->isInvalidDecl() && - !getLangOptions().CPlusPlus) + !getLangOpts().CPlusPlus) Diag(Param->getLocation(), diag::err_parameter_name_omitted); Params.push_back(Param); } @@ -9159,7 +9159,7 @@ ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) { static void MakeObjCStringLiteralFixItHint(Sema& SemaRef, QualType DstType, Expr *SrcExpr, FixItHint &Hint) { - if (!SemaRef.getLangOptions().ObjC1) + if (!SemaRef.getLangOpts().ObjC1) return; const ObjCObjectPointerType *PT = DstType->getAs(); @@ -9263,7 +9263,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, // expression, rather than a type), which should be done as part // of a larger effort to fix checkPointerTypesForAssignment for // C++ semantics. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && IsStringLiteralToNonConstPointerConversion(SrcExpr, DstType)) return false; DiagKind = diag::ext_typecheck_convert_discards_qualifiers; @@ -9360,7 +9360,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, PartialDiagnostic FoldDiag) { SourceLocation DiagLoc = E->getLocStart(); - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++11 [expr.const]p5: // If an expression of literal class type is used in a context where an // integral constant expression is required, then that class type shall @@ -9399,7 +9399,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, // Circumvent ICE checking in C++11 to avoid evaluating the expression twice // in the non-ICE case. - if (!getLangOptions().CPlusPlus0x && E->isIntegerConstantExpr(Context)) { + if (!getLangOpts().CPlusPlus0x && E->isIntegerConstantExpr(Context)) { if (Result) *Result = E->EvaluateKnownConstInt(Context); return Owned(E); @@ -9417,7 +9417,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, // In C++11, we can rely on diagnostics being produced for any expression // which is not a constant expression. If no diagnostics were produced, then // this is a constant expression. - if (Folded && getLangOptions().CPlusPlus0x && Notes.empty()) { + if (Folded && getLangOpts().CPlusPlus0x && Notes.empty()) { if (Result) *Result = EvalResult.Val.getInt(); return Owned(E); @@ -9769,7 +9769,7 @@ diagnoseUncapturableValueReference(Sema &S, SourceLocation loc, // For C++, things get a bit more nasty... it would be nice to suppress this // diagnostic for certain cases like using a local variable in an array bound // for a member of a local class, but the correct predicate is not obvious. - if (!S.getLangOptions().CPlusPlus && !S.CurContext->isFunctionOrMethod()) + if (!S.getLangOpts().CPlusPlus && !S.CurContext->isFunctionOrMethod()) return; if (isa(VarDC) && @@ -10063,7 +10063,7 @@ bool Sema::tryCaptureVariable(VarDecl *Var, SourceLocation Loc, CaptureType = CaptureType.getNonReferenceType().withConst(); DeclRefType = CaptureType; - if (getLangOptions().CPlusPlus && BuildAndDiagnose) { + if (getLangOpts().CPlusPlus && BuildAndDiagnose) { if (const RecordType *Record = DeclRefType->getAs()) { // The capture logic needs the destructor, so make sure we mark it. // Usually this is unnecessary because most local variables have @@ -10644,7 +10644,7 @@ ExprResult Sema::CheckBooleanCondition(Expr *E, SourceLocation Loc) { E = result.take(); if (!E->isTypeDependent()) { - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return CheckCXXBooleanCondition(E); // C++ 6.4p4 ExprResult ERes = DefaultFunctionArrayLvalueConversion(E); @@ -10731,7 +10731,7 @@ namespace { E->setType(VD->getType()); assert(E->getValueKind() == VK_RValue); - if (S.getLangOptions().CPlusPlus && + if (S.getLangOpts().CPlusPlus && !(isa(VD) && cast(VD)->isInstance())) E->setValueKind(VK_LValue); @@ -11002,7 +11002,7 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) { } // Function references aren't l-values in C. - if (!S.getLangOptions().CPlusPlus) + if (!S.getLangOpts().CPlusPlus) ValueKind = VK_RValue; // - variables diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index b56d3ebfb287..ec2332cc3c73 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -541,7 +541,7 @@ Sema::ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *Ex) { ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope) { // Don't report an error if 'throw' is used in system headers. - if (!getLangOptions().CXXExceptions && + if (!getLangOpts().CXXExceptions && !getSourceManager().isInSystemHeader(OpLoc)) Diag(OpLoc, diag::err_exceptions_disabled) << "throw"; @@ -1102,7 +1102,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, } // In ARC, infer 'retaining' for the allocated - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && AllocType.getObjCLifetime() == Qualifiers::OCL_None && AllocType->isObjCLifetimeType()) { AllocType = Context.getLifetimeQualifiedType(AllocType, @@ -1119,14 +1119,14 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, if (ArraySize && !ArraySize->isTypeDependent()) { ExprResult ConvertedSize = ConvertToIntegralOrEnumerationType( StartLoc, ArraySize, - PDiag(diag::err_array_size_not_integral) << getLangOptions().CPlusPlus0x, + PDiag(diag::err_array_size_not_integral) << getLangOpts().CPlusPlus0x, PDiag(diag::err_array_size_incomplete_type) << ArraySize->getSourceRange(), PDiag(diag::err_array_size_explicit_conversion), PDiag(diag::note_array_size_conversion), PDiag(diag::err_array_size_ambiguous_conversion), PDiag(diag::note_array_size_conversion), - PDiag(getLangOptions().CPlusPlus0x ? + PDiag(getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_array_size_conversion : diag::ext_array_size_conversion), /*AllowScopedEnumerations*/ false); @@ -1156,7 +1156,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, if (Value < llvm::APSInt( llvm::APInt::getNullValue(Value.getBitWidth()), Value.isUnsigned())) { - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(ArraySize->getLocStart(), diag::warn_typecheck_negative_array_new_size) << ArraySize->getSourceRange(); @@ -1168,7 +1168,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, unsigned ActiveSizeBits = ConstantArrayType::getNumAddressingBits(Context, AllocType, Value); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) { - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(ArraySize->getLocStart(), diag::warn_array_new_too_large) << Value.toString(10) @@ -1192,7 +1192,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, } // ARC: warn about ABI issues. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { QualType BaseAllocType = Context.getBaseElementType(AllocType); if (BaseAllocType.hasStrongOrWeakObjCLifetime()) Diag(StartLoc, diag::warn_err_new_delete_object_array) @@ -1381,7 +1381,7 @@ bool Sema::CheckAllocatedType(QualType AllocType, SourceLocation Loc, else if (unsigned AddressSpace = AllocType.getAddressSpace()) return Diag(Loc, diag::err_address_space_qualified_new) << AllocType.getUnqualifiedType() << AddressSpace; - else if (getLangOptions().ObjCAutoRefCount) { + else if (getLangOpts().ObjCAutoRefCount) { if (const ArrayType *AT = Context.getAsArrayType(AllocType)) { QualType BaseAllocType = Context.getBaseElementType(AT); if (BaseAllocType.getObjCLifetime() == Qualifiers::OCL_None && @@ -1469,7 +1469,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, // We don't need an operator delete if we're running under // -fno-exceptions. - if (!getLangOptions().Exceptions) { + if (!getLangOpts().Exceptions) { OperatorDelete = 0; return false; } @@ -1587,7 +1587,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, // as a placement deallocation function, would have been // selected as a match for the allocation function, the program // is ill-formed. - if (NumPlaceArgs && getLangOptions().CPlusPlus0x && + if (NumPlaceArgs && getLangOpts().CPlusPlus0x && isNonPlacementDeallocationFunction(OperatorDelete)) { Diag(StartLoc, diag::err_placement_new_non_placement_delete) << SourceRange(PlaceArgs[0]->getLocStart(), @@ -1763,7 +1763,7 @@ void Sema::DeclareGlobalNewDelete() { // lookup. // Note that the C++0x versions of operator delete are deallocation functions, // and thus are implicitly noexcept. - if (!StdBadAlloc && !getLangOptions().CPlusPlus0x) { + if (!StdBadAlloc && !getLangOpts().CPlusPlus0x) { // The "std::bad_alloc" class has not yet been declared, so build it // implicitly. StdBadAlloc = CXXRecordDecl::Create(Context, TTK_Class, @@ -1778,7 +1778,7 @@ void Sema::DeclareGlobalNewDelete() { QualType VoidPtr = Context.getPointerType(Context.VoidTy); QualType SizeT = Context.getSizeType(); - bool AssumeSaneOperatorNew = getLangOptions().AssumeSaneOperatorNew; + bool AssumeSaneOperatorNew = getLangOpts().AssumeSaneOperatorNew; DeclareGlobalAllocationFunction( Context.DeclarationNames.getCXXOperatorName(OO_New), @@ -1826,20 +1826,20 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, bool HasBadAllocExceptionSpec = (Name.getCXXOverloadedOperator() == OO_New || Name.getCXXOverloadedOperator() == OO_Array_New); - if (HasBadAllocExceptionSpec && !getLangOptions().CPlusPlus0x) { + if (HasBadAllocExceptionSpec && !getLangOpts().CPlusPlus0x) { assert(StdBadAlloc && "Must have std::bad_alloc declared"); BadAllocType = Context.getTypeDeclType(getStdBadAlloc()); } FunctionProtoType::ExtProtoInfo EPI; if (HasBadAllocExceptionSpec) { - if (!getLangOptions().CPlusPlus0x) { + if (!getLangOpts().CPlusPlus0x) { EPI.ExceptionSpecType = EST_Dynamic; EPI.NumExceptions = 1; EPI.Exceptions = &BadAllocType; } } else { - EPI.ExceptionSpecType = getLangOptions().CPlusPlus0x ? + EPI.ExceptionSpecType = getLangOpts().CPlusPlus0x ? EST_BasicNoexcept : EST_DynamicNone; } @@ -2130,7 +2130,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, } } - } else if (getLangOptions().ObjCAutoRefCount && + } else if (getLangOpts().ObjCAutoRefCount && PointeeElem->isObjCLifetimeType() && (PointeeElem.getObjCLifetime() == Qualifiers::OCL_Strong || PointeeElem.getObjCLifetime() == Qualifiers::OCL_Weak) && @@ -2580,7 +2580,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, ToType->isObjCObjectPointerType()) EmitRelatedResultTypeNote(From); } - else if (getLangOptions().ObjCAutoRefCount && + else if (getLangOpts().ObjCAutoRefCount && !CheckObjCARCUnavailableWeakConversion(ToType, From->getType())) { if (Action == AA_Initializing) @@ -2754,7 +2754,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, CK_NoOp, VK, /*BasePath=*/0, CCK).take(); if (SCS.DeprecatedStringLiteralToCharPtr && - !getLangOptions().WritableStrings) + !getLangOpts().WritableStrings) Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion) << ToType.getNonReferenceType(); @@ -3505,7 +3505,7 @@ ExprResult Sema::BuildBinaryTypeTrait(BinaryTypeTrait BTT, QualType RhsT = RhsTSInfo->getType(); if (BTT == BTT_TypeCompatible) { - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Diag(KWLoc, diag::err_types_compatible_p_in_cplusplus) << SourceRange(KWLoc, RParen); return ExprError(); @@ -4215,7 +4215,7 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc, if (NonStandardCompositeType) *NonStandardCompositeType = false; - assert(getLangOptions().CPlusPlus && "This function assumes C++"); + assert(getLangOpts().CPlusPlus && "This function assumes C++"); QualType T1 = E1->getType(), T2 = E2->getType(); if (!T1->isAnyPointerType() && !T1->isMemberPointerType() && @@ -4425,7 +4425,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) { // In ARC, calls that return a retainable type can return retained, // in which case we have to insert a consuming cast. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && E->getType()->isObjCRetainableType()) { bool ReturnsRetained; @@ -4504,7 +4504,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) { VK_RValue)); } - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return Owned(E); // Search for the base element type (cf. ASTContext::getBaseElementType) with @@ -4855,7 +4855,7 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base, return ExprError(); if (!ObjectType->isDependentType() && !ObjectType->isScalarType()) { - if (getLangOptions().MicrosoftMode && ObjectType->isVoidType()) + if (getLangOpts().MicrosoftMode && ObjectType->isVoidType()) Diag(OpLoc, diag::ext_pseudo_dtor_on_void) << Base->getSourceRange(); else Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar) @@ -5186,14 +5186,14 @@ ExprResult Sema::IgnoredValueConversions(Expr *E) { // are r-values, but we still want to do function-to-pointer decay // on them. This is both technically correct and convenient for // some clients. - if (!getLangOptions().CPlusPlus && E->getType()->isFunctionType()) + if (!getLangOpts().CPlusPlus && E->getType()->isFunctionType()) return DefaultFunctionArrayConversion(E); return Owned(E); } // Otherwise, this rule does not apply in C++, at least not for the moment. - if (getLangOptions().CPlusPlus) return Owned(E); + if (getLangOpts().CPlusPlus) return Owned(E); // GCC seems to also exclude expressions of incomplete enum type. if (const EnumType *T = E->getType()->getAs()) { @@ -5225,7 +5225,7 @@ ExprResult Sema::ActOnFinishFullExpr(Expr *FE) { return ExprError(); // Top-level message sends default to 'id' when we're in a debugger. - if (getLangOptions().DebuggerCastResultToId && + if (getLangOpts().DebuggerCastResultToId && FullExpr.get()->getType() == Context.UnknownAnyTy && isa(FullExpr.get())) { FullExpr = forceUnknownAnyToType(FullExpr.take(), Context.getObjCIdType()); diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 64d5d6012c4a..180c1aa0f051 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -139,7 +139,7 @@ static IMAKind ClassifyImplicitMemberAccess(Sema &SemaRef, return IMA_Static; bool IsCXX11UnevaluatedField = false; - if (SemaRef.getLangOptions().CPlusPlus0x && isField) { + if (SemaRef.getLangOpts().CPlusPlus0x && isField) { // C++11 [expr.prim.general]p12: // An id-expression that denotes a non-static data member or non-static // member function of a class can only be used: @@ -433,7 +433,7 @@ Sema::ActOnDependentMemberExpr(Expr *BaseExpr, QualType BaseType, // allows this, while still reporting an error if T is a struct pointer. if (!IsArrow) { const PointerType *PT = BaseType->getAs(); - if (PT && (!getLangOptions().ObjC1 || + if (PT && (!getLangOpts().ObjC1 || PT->getPointeeType()->isRecordType())) { assert(BaseExpr && "cannot happen with implicit member accesses"); Diag(NameInfo.getLoc(), diag::err_typecheck_member_reference_struct_union) @@ -597,9 +597,9 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, R.clear(); if (NamedDecl *ND = Corrected.getCorrectionDecl()) { std::string CorrectedStr( - Corrected.getAsString(SemaRef.getLangOptions())); + Corrected.getAsString(SemaRef.getLangOpts())); std::string CorrectedQuotedStr( - Corrected.getQuoted(SemaRef.getLangOptions())); + Corrected.getQuoted(SemaRef.getLangOpts())); R.setLookupName(Corrected.getCorrection()); R.addDecl(ND); SemaRef.Diag(R.getNameLoc(), diag::err_no_member_suggest) @@ -1104,7 +1104,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, // - an interface ObjCInterfaceDecl *IDecl = OTy->getInterface(); if (!IDecl) { - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (OTy->isObjCId() || OTy->isObjCClass())) goto fail; // There's an implicit 'isa' ivar on all objects. @@ -1189,7 +1189,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, dyn_cast(ObjCImpDecl)) ClassOfMethodDecl = CatImplClass->getClassInterface(); } - if (!getLangOptions().DebuggerSupport) { + if (!getLangOpts().DebuggerSupport) { if (IV->getAccessControl() == ObjCIvarDecl::Private) { if (!declaresSameEntity(ClassDeclared, IDecl) || !declaresSameEntity(ClassOfMethodDecl, ClassDeclared)) @@ -1201,7 +1201,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, << IV->getDeclName(); } } - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { Expr *BaseExp = BaseExpr.get()->IgnoreParenImpCasts(); if (UnaryOperator *UO = dyn_cast(BaseExp)) if (UO->getOpcode() == UO_Deref) @@ -1439,7 +1439,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, return ExprError(); // Warn about the explicit constructor calls Microsoft extension. - if (getLangOptions().MicrosoftExt && + if (getLangOpts().MicrosoftExt && Id.getKind() == UnqualifiedId::IK_ConstructorName) Diag(Id.getSourceRange().getBegin(), diag::ext_ms_explicit_constructor_call); diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 0eae2e269258..448f14596478 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -88,9 +88,9 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){ QualType Ty = Context.getObjCConstantStringInterface(); if (!Ty.isNull()) { Ty = Context.getObjCObjectPointerType(Ty); - } else if (getLangOptions().NoConstantCFStrings) { + } else if (getLangOpts().NoConstantCFStrings) { IdentifierInfo *NSIdent=0; - std::string StringClass(getLangOptions().ObjCConstantStringClass); + std::string StringClass(getLangOpts().ObjCConstantStringClass); if (StringClass.empty()) NSIdent = &Context.Idents.get("NSConstantString"); @@ -163,7 +163,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc, // Look for the appropriate method within NSNumber. ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel);; - if (!Method && S.getLangOptions().DebuggerObjCLiteral) { + if (!Method && S.getLangOpts().DebuggerObjCLiteral) { TypeSourceInfo *ResultTInfo = 0; Method = ObjCMethodDecl::Create(S.Context, SourceLocation(), SourceLocation(), Sel, ReturnType, @@ -213,7 +213,7 @@ ExprResult Sema::BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number) { AtLoc, LookupOrdinaryName); NSNumberDecl = dyn_cast_or_null(IF); - if (!NSNumberDecl && getLangOptions().DebuggerObjCLiteral) + if (!NSNumberDecl && getLangOpts().DebuggerObjCLiteral) NSNumberDecl = ObjCInterfaceDecl::Create (Context, Context.getTranslationUnitDecl(), SourceLocation(), @@ -278,7 +278,7 @@ ExprResult Sema::ActOnObjCBoolLiteral(SourceLocation AtLoc, SourceLocation ValueLoc, bool Value) { ExprResult Inner; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Inner = ActOnCXXBoolLiteral(ValueLoc, Value? tok::kw_true : tok::kw_false); } else { // C doesn't actually have a way to represent literal values of type @@ -306,7 +306,7 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element, // In C++, check for an implicit conversion to an Objective-C object pointer // type. - if (S.getLangOptions().CPlusPlus && Element->getType()->isRecordType()) { + if (S.getLangOpts().CPlusPlus && Element->getType()->isRecordType()) { InitializedEntity Entity = InitializedEntity::InitializeParameter(S.Context, T, /*Consumed=*/false); InitializationKind Kind @@ -422,7 +422,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { SR.getBegin(), LookupOrdinaryName); NSArrayDecl = dyn_cast_or_null(IF); - if (!NSArrayDecl && getLangOptions().DebuggerObjCLiteral) + if (!NSArrayDecl && getLangOpts().DebuggerObjCLiteral) NSArrayDecl = ObjCInterfaceDecl::Create (Context, Context.getTranslationUnitDecl(), SourceLocation(), @@ -441,7 +441,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { Selector Sel = NSAPIObj->getNSArraySelector(NSAPI::NSArr_arrayWithObjectsCount); ArrayWithObjectsMethod = NSArrayDecl->lookupClassMethod(Sel); - if (!ArrayWithObjectsMethod && getLangOptions().DebuggerObjCLiteral) { + if (!ArrayWithObjectsMethod && getLangOpts().DebuggerObjCLiteral) { TypeSourceInfo *ResultTInfo = 0; ArrayWithObjectsMethod = ObjCMethodDecl::Create(Context, @@ -555,7 +555,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, NSAPIObj->getNSClassId(NSAPI::ClassId_NSDictionary), SR.getBegin(), LookupOrdinaryName); NSDictionaryDecl = dyn_cast_or_null(IF); - if (!NSDictionaryDecl && getLangOptions().DebuggerObjCLiteral) + if (!NSDictionaryDecl && getLangOpts().DebuggerObjCLiteral) NSDictionaryDecl = ObjCInterfaceDecl::Create (Context, Context.getTranslationUnitDecl(), SourceLocation(), @@ -575,7 +575,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, Selector Sel = NSAPIObj->getNSDictionarySelector( NSAPI::NSDict_dictionaryWithObjectsForKeysCount); DictionaryWithObjectsMethod = NSDictionaryDecl->lookupClassMethod(Sel); - if (!DictionaryWithObjectsMethod && getLangOptions().DebuggerObjCLiteral) { + if (!DictionaryWithObjectsMethod && getLangOpts().DebuggerObjCLiteral) { DictionaryWithObjectsMethod = ObjCMethodDecl::Create(Context, SourceLocation(), SourceLocation(), Sel, @@ -768,7 +768,7 @@ ExprResult Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, // which is an array type. StrTy = Context.CharTy; // A C++ string literal has a const-qualified element type (C++ 2.13.4p1). - if (getLangOptions().CPlusPlus || getLangOptions().ConstStrings) + if (getLangOpts().CPlusPlus || getLangOpts().ConstStrings) StrTy.addConst(); StrTy = Context.getConstantArrayType(StrTy, llvm::APInt(32, Str.size()+1), ArrayType::Normal, 0); @@ -815,7 +815,7 @@ ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, // In ARC, forbid the user from using @selector for // retain/release/autorelease/dealloc/retainCount. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { switch (Sel.getMethodFamily()) { case OMF_retain: case OMF_release: @@ -968,18 +968,18 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType, } unsigned DiagID; - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) DiagID = diag::err_arc_method_not_found; else DiagID = isClassMessage ? diag::warn_class_method_not_found : diag::warn_inst_method_not_found; - if (!getLangOptions().DebuggerSupport) + if (!getLangOpts().DebuggerSupport) Diag(lbrac, DiagID) << Sel << isClassMessage << SourceRange(lbrac, rbrac); // In debuggers, we want to use __unknown_anytype for these // results so that clients can cast them. - if (getLangOptions().DebuggerSupport) { + if (getLangOpts().DebuggerSupport) { ReturnType = Context.UnknownAnyTy; } else { ReturnType = Context.getObjCIdType(); @@ -1755,7 +1755,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, } assert(Class && "We don't know which class we're messaging?"); // objc++ diagnoses during typename annotation. - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) (void)DiagnoseUseOfDecl(Class, Loc); // Find the method we are messaging. if (!Method) { @@ -1763,14 +1763,14 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, = SuperLoc.isValid()? SourceRange(SuperLoc) : ReceiverTypeInfo->getTypeLoc().getSourceRange(); if (RequireCompleteType(Loc, Context.getObjCInterfaceType(Class), - (getLangOptions().ObjCAutoRefCount + (getLangOpts().ObjCAutoRefCount ? PDiag(diag::err_arc_receiver_forward_class) : PDiag(diag::warn_receiver_forward_class)) << TypeRange)) { // A forward class used in messaging is treated as a 'Class' Method = LookupFactoryMethodInGlobalPool(Sel, SourceRange(LBracLoc, RBracLoc)); - if (Method && !getLangOptions().ObjCAutoRefCount) + if (Method && !getLangOpts().ObjCAutoRefCount) Diag(Method->getLocation(), diag::note_method_sent_forward_class) << Method->getDeclName(); } @@ -2024,14 +2024,14 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // we don't try to recover. const ObjCInterfaceDecl *forwardClass = 0; if (RequireCompleteType(Loc, OCIType->getPointeeType(), - getLangOptions().ObjCAutoRefCount + getLangOpts().ObjCAutoRefCount ? PDiag(diag::err_arc_receiver_forward_instance) << (Receiver ? Receiver->getSourceRange() : SourceRange(SuperLoc)) : PDiag(diag::warn_receiver_forward_instance) << (Receiver ? Receiver->getSourceRange() : SourceRange(SuperLoc)))) { - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) return ExprError(); forwardClass = OCIType->getInterfaceDecl(); @@ -2050,7 +2050,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // If we have implementations in scope, check "private" methods. Method = LookupPrivateInstanceMethod(Sel, ClassDecl); - if (!Method && getLangOptions().ObjCAutoRefCount) { + if (!Method && getLangOpts().ObjCAutoRefCount) { Diag(Loc, diag::err_arc_may_not_respond) << OCIType->getPointeeType() << Sel; return ExprError(); @@ -2071,7 +2071,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, } if (Method && DiagnoseUseOfDecl(Method, Loc, forwardClass)) return ExprError(); - } else if (!getLangOptions().ObjCAutoRefCount && + } else if (!getLangOpts().ObjCAutoRefCount && !Context.getObjCIdType().isNull() && (ReceiverType->isPointerType() || ReceiverType->isIntegerType())) { @@ -2093,7 +2093,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, ReceiverType = Receiver->getType(); } else { ExprResult ReceiverRes; - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) ReceiverRes = PerformContextuallyConvertToObjCPointer(Receiver); if (ReceiverRes.isUsable()) { Receiver = ReceiverRes.take(); @@ -2137,7 +2137,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // In ARC, forbid the user from sending messages to // retain/release/autorelease/dealloc/retainCount explicitly. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { ObjCMethodFamily family = (Method ? Method->getMethodFamily() : Sel.getMethodFamily()); switch (family) { @@ -2231,7 +2231,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, checkCocoaAPI(*this, Result); } - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { // In ARC, annotate delegate init calls. if (Result->getMethodFamily() == OMF_init && (SuperLoc.isValid() || isSelfExpr(Receiver))) { diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 5de785207fd6..78a9f89d5989 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -106,7 +106,7 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, // We have an array of character type with known size. However, // the size may be smaller or larger than the string we are initializing. // FIXME: Avoid truncation for 64-bit length strings. - if (S.getLangOptions().CPlusPlus) { + if (S.getLangOpts().CPlusPlus) { if (StringLiteral *SL = dyn_cast(Str)) { // For Pascal strings it's OK to strip off the terminating null character, // so the example below is valid: @@ -616,8 +616,8 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity, if (Index < IList->getNumInits()) { // We have leftover initializers if (VerifyOnly) { - if (SemaRef.getLangOptions().CPlusPlus || - (SemaRef.getLangOptions().OpenCL && + if (SemaRef.getLangOpts().CPlusPlus || + (SemaRef.getLangOpts().OpenCL && IList->getType()->isVectorType())) { hadError = true; } @@ -627,7 +627,7 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity, if (StructuredIndex == 1 && IsStringInit(StructuredList->getInit(0), T, SemaRef.Context)) { unsigned DK = diag::warn_excess_initializers_in_char_array_initializer; - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { DK = diag::err_excess_initializers_in_char_array_initializer; hadError = true; } @@ -646,11 +646,11 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity, 4; unsigned DK = diag::warn_excess_initializers; - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { DK = diag::err_excess_initializers; hadError = true; } - if (SemaRef.getLangOptions().OpenCL && initKind == 1) { + if (SemaRef.getLangOpts().OpenCL && initKind == 1) { DK = diag::err_excess_initializers; hadError = true; } @@ -782,7 +782,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // Fall through for subaggregate initialization. - } else if (SemaRef.getLangOptions().CPlusPlus) { + } else if (SemaRef.getLangOpts().CPlusPlus) { // C++ [dcl.init.aggr]p12: // All implicit type conversions (clause 4) are considered when // initializing the aggregate member with an initializer from @@ -845,7 +845,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // subaggregate, brace elision is assumed and the initializer is // considered for the initialization of the first member of // the subaggregate. - if (!SemaRef.getLangOptions().OpenCL && + if (!SemaRef.getLangOpts().OpenCL && (ElemType->isAggregateType() || ElemType->isVectorType())) { CheckImplicitInitList(Entity, IList, ElemType, Index, StructuredList, StructuredIndex); @@ -884,7 +884,7 @@ void InitListChecker::CheckComplexType(const InitializedEntity &Entity, // This is an extension in C. (The builtin _Complex type does not exist // in the C++ standard.) - if (!SemaRef.getLangOptions().CPlusPlus && !VerifyOnly) + if (!SemaRef.getLangOpts().CPlusPlus && !VerifyOnly) SemaRef.Diag(IList->getLocStart(), diag::ext_complex_component_init) << IList->getSourceRange(); @@ -909,11 +909,11 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity, if (Index >= IList->getNumInits()) { if (!VerifyOnly) SemaRef.Diag(IList->getLocStart(), - SemaRef.getLangOptions().CPlusPlus0x ? + SemaRef.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_empty_scalar_initializer : diag::err_empty_scalar_initializer) << IList->getSourceRange(); - hadError = !SemaRef.getLangOptions().CPlusPlus0x; + hadError = !SemaRef.getLangOpts().CPlusPlus0x; ++Index; ++StructuredIndex; return; @@ -993,7 +993,7 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity, } Expr *expr = IList->getInit(Index); - if (isa(expr) && !SemaRef.getLangOptions().CPlusPlus0x) { + if (isa(expr) && !SemaRef.getLangOpts().CPlusPlus0x) { if (!VerifyOnly) SemaRef.Diag(IList->getLocStart(), diag::err_init_non_aggr_init_list) << DeclType << IList->getSourceRange(); @@ -1046,7 +1046,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity, return; } - if (!SemaRef.getLangOptions().OpenCL) { + if (!SemaRef.getLangOpts().OpenCL) { // If the initializing element is a vector, try to copy-initialize // instead of breaking it apart (which is doomed to failure anyway). Expr *Init = IList->getInit(Index); @@ -1281,7 +1281,7 @@ bool InitListChecker::CheckFlexibleArrayInit(const InitializedEntity &Entity, cast(InitExpr)->getNumInits() == 0) { // Empty flexible array init always allowed as an extension FlexArrayDiag = diag::ext_flexible_array_init; - } else if (SemaRef.getLangOptions().CPlusPlus) { + } else if (SemaRef.getLangOpts().CPlusPlus) { // Disallow flexible array init in C++; it is not required for gcc // compatibility, and it needs work to IRGen correctly in general. FlexArrayDiag = diag::err_flexible_array_init; @@ -1657,7 +1657,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, Loc = D->getFieldLoc(); if (!VerifyOnly) SemaRef.Diag(Loc, diag::err_field_designator_non_aggr) - << SemaRef.getLangOptions().CPlusPlus << CurrentObjectType; + << SemaRef.getLangOpts().CPlusPlus << CurrentObjectType; ++Index; return true; } @@ -1719,9 +1719,9 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, RT->getDecl()); if (Corrected) { std::string CorrectedStr( - Corrected.getAsString(SemaRef.getLangOptions())); + Corrected.getAsString(SemaRef.getLangOpts())); std::string CorrectedQuotedStr( - Corrected.getQuoted(SemaRef.getLangOptions())); + Corrected.getQuoted(SemaRef.getLangOpts())); ReplacementField = Corrected.getCorrectionDeclAs(); SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_unknown_suggest) @@ -2272,7 +2272,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, InitExpressions.data(), InitExpressions.size(), Loc, GNUSyntax, Init.takeAs()); - if (!getLangOptions().C99) + if (!getLangOpts().C99) Diag(DIE->getLocStart(), diag::ext_designated_init) << DIE->getSourceRange(); @@ -2683,7 +2683,7 @@ void InitializationSequence::SetOverloadFailure(FailureKind Failure, static void MaybeProduceObjCObject(Sema &S, InitializationSequence &Sequence, const InitializedEntity &Entity) { - if (!S.getLangOptions().ObjCAutoRefCount) return; + if (!S.getLangOpts().ObjCAutoRefCount) return; /// When initializing a parameter, produce the value if it's marked /// __attribute__((ns_consumed)). @@ -3023,7 +3023,7 @@ static void TryReferenceListInitialization(Sema &S, InitializationSequence &Sequence) { // First, catch C++03 where this isn't possible. - if (!S.getLangOptions().CPlusPlus0x) { + if (!S.getLangOpts().CPlusPlus0x) { Sequence.SetFailed(InitializationSequence::FK_ReferenceBindingToInitList); return; } @@ -3089,7 +3089,7 @@ static void TryListInitialization(Sema &S, // C++ doesn't allow scalar initialization with more than one argument. // But C99 complex numbers are scalars and it makes sense there. - if (S.getLangOptions().CPlusPlus && DestType->isScalarType() && + if (S.getLangOpts().CPlusPlus && DestType->isScalarType() && !DestType->isAnyComplexType() && InitList->getNumInits() > 1) { Sequence.SetFailed(InitializationSequence::FK_TooManyInitsForScalar); return; @@ -3105,7 +3105,7 @@ static void TryListInitialization(Sema &S, } if (!DestType->isAggregateType()) { - if (S.getLangOptions().CPlusPlus0x) { + if (S.getLangOpts().CPlusPlus0x) { Expr *Arg = InitList; // A direct-initializer is not list-syntax, i.e. there's no special // treatment of "A a({1, 2});". @@ -3122,7 +3122,7 @@ static void TryListInitialization(Sema &S, InitListChecker CheckInitList(S, Entity, InitList, DestType, /*VerifyOnly=*/true, Kind.getKind() != InitializationKind::IK_DirectList || - !S.getLangOptions().CPlusPlus0x); + !S.getLangOpts().CPlusPlus0x); if (CheckInitList.HadError()) { Sequence.SetFailed(InitializationSequence::FK_ListInitializationFailed); return; @@ -3479,9 +3479,9 @@ static void TryReferenceInitializationCore(Sema &S, // // The constructor that would be used to make the copy shall // be callable whether or not the copy is actually done. - if (!S.getLangOptions().CPlusPlus0x && !S.getLangOptions().MicrosoftExt) + if (!S.getLangOpts().CPlusPlus0x && !S.getLangOpts().MicrosoftExt) Sequence.AddExtraneousCopyToTemporary(cv2T2); - else if (S.getLangOptions().CPlusPlus0x) + else if (S.getLangOpts().CPlusPlus0x) CheckCXX98CompatAccessibleCopy(S, Entity, Initializer); } @@ -3612,7 +3612,7 @@ static void TryValueInitialization(Sema &S, // constructor (12.1), then the default constructor for T is // called (and the initialization is ill-formed if T has no // accessible default constructor); - if (!S.getLangOptions().CPlusPlus0x) { + if (!S.getLangOpts().CPlusPlus0x) { if (ClassDecl->hasUserDeclaredConstructor()) // FIXME: we really want to refer to a single subobject of the array, // but Entity doesn't have a way to capture that (yet). @@ -3659,7 +3659,7 @@ static void TryDefaultInitialization(Sema &S, // - if T is a (possibly cv-qualified) class type (Clause 9), the default // constructor for T is called (and the initialization is ill-formed if // T has no accessible default constructor); - if (DestType->isRecordType() && S.getLangOptions().CPlusPlus) { + if (DestType->isRecordType() && S.getLangOpts().CPlusPlus) { TryConstructorInitialization(S, Entity, Kind, 0, 0, DestType, Sequence); return; } @@ -3669,7 +3669,7 @@ static void TryDefaultInitialization(Sema &S, // If a program calls for the default initialization of an object of // a const-qualified type T, T shall be a class type with a user-provided // default constructor. - if (DestType.isConstQualified() && S.getLangOptions().CPlusPlus) { + if (DestType.isConstQualified() && S.getLangOpts().CPlusPlus) { Sequence.SetFailed(InitializationSequence::FK_DefaultInitOfConst); return; } @@ -4079,7 +4079,7 @@ InitializationSequence::InitializationSequence(Sema &S, // Note: as an GNU C extension, we allow initialization of an // array from a compound literal that creates an array of the same // type, so long as the initializer has no side effects. - if (!S.getLangOptions().CPlusPlus && Initializer && + if (!S.getLangOpts().CPlusPlus && Initializer && isa(Initializer->IgnoreParens()) && Initializer->getType()->isArrayType()) { const ArrayType *SourceAT @@ -4094,7 +4094,7 @@ InitializationSequence::InitializationSequence(Sema &S, } // Note: as a GNU C++ extension, we allow initialization of a // class member from a parenthesized initializer list. - else if (S.getLangOptions().CPlusPlus && + else if (S.getLangOpts().CPlusPlus && Entity.getKind() == InitializedEntity::EK_Member && Initializer && isa(Initializer)) { TryListInitialization(S, Entity, Kind, cast(Initializer), @@ -4110,12 +4110,12 @@ InitializationSequence::InitializationSequence(Sema &S, // Determine whether we should consider writeback conversions for // Objective-C ARC. - bool allowObjCWritebackConversion = S.getLangOptions().ObjCAutoRefCount && + bool allowObjCWritebackConversion = S.getLangOpts().ObjCAutoRefCount && Entity.getKind() == InitializedEntity::EK_Parameter; // We're at the end of the line for C: it's either a write-back conversion // or it's a C assignment. There's no need to check anything else. - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { // If allowed, check whether this is an Objective-C writeback conversion. if (allowObjCWritebackConversion && tryObjCWritebackConversion(S, *this, Entity, Initializer)) { @@ -4128,7 +4128,7 @@ InitializationSequence::InitializationSequence(Sema &S, return; } - assert(S.getLangOptions().CPlusPlus); + assert(S.getLangOpts().CPlusPlus); // - If the destination type is a (possibly cv-qualified) class type: if (DestType->isRecordType()) { @@ -4549,7 +4549,7 @@ static ExprResult CopyObject(Sema &S, static void CheckCXX98CompatAccessibleCopy(Sema &S, const InitializedEntity &Entity, Expr *CurInitExpr) { - assert(S.getLangOptions().CPlusPlus0x); + assert(S.getLangOpts().CPlusPlus0x); const RecordType *Record = CurInitExpr->getType()->getAs(); if (!Record) @@ -4959,7 +4959,7 @@ InitializationSequence::Perform(Sema &S, // If we're binding to an Objective-C object that has lifetime, we // need cleanups. - if (S.getLangOptions().ObjCAutoRefCount && + if (S.getLangOpts().ObjCAutoRefCount && CurInit.get()->getType()->isObjCLifetimeType()) S.ExprNeedsCleanups = true; @@ -5114,7 +5114,7 @@ InitializationSequence::Perform(Sema &S, InitListChecker PerformInitList(S, IsTemporary ? TempEntity : Entity, InitList, Ty, /*VerifyOnly=*/false, Kind.getKind() != InitializationKind::IK_DirectList || - !S.getLangOptions().CPlusPlus0x); + !S.getLangOpts().CPlusPlus0x); if (PerformInitList.HadError()) return ExprError(); @@ -5195,7 +5195,7 @@ InitializationSequence::Perform(Sema &S, // the call to the object's constructor within the next step. ConstructorInitRequiresZeroInit = true; } else if (Kind.getKind() == InitializationKind::IK_Value && - S.getLangOptions().CPlusPlus && + S.getLangOpts().CPlusPlus && !Kind.isImplicitValueInit()) { TypeSourceInfo *TSInfo = Entity.getTypeSourceInfo(); if (!TSInfo) @@ -5716,7 +5716,7 @@ bool InitializationSequence::Diagnose(Sema &S, InitListChecker DiagnoseInitList(S, Entity, InitList, DestType, /*VerifyOnly=*/false, Kind.getKind() != InitializationKind::IK_DirectList || - !S.getLangOptions().CPlusPlus0x); + !S.getLangOpts().CPlusPlus0x); assert(DiagnoseInitList.HadError() && "Inconsistent init list check result."); break; @@ -6055,7 +6055,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, // narrowing conversion even if the value is a constant and can be // represented exactly as an integer. S.Diag(PostInit->getLocStart(), - S.getLangOptions().MicrosoftExt || !S.getLangOptions().CPlusPlus0x? + S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus0x? diag::warn_init_list_type_narrowing : S.isSFINAEContext()? diag::err_init_list_type_narrowing_sfinae @@ -6068,7 +6068,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, case NK_Constant_Narrowing: // A constant value was narrowed. S.Diag(PostInit->getLocStart(), - S.getLangOptions().MicrosoftExt || !S.getLangOptions().CPlusPlus0x? + S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus0x? diag::warn_init_list_constant_narrowing : S.isSFINAEContext()? diag::err_init_list_constant_narrowing_sfinae @@ -6081,7 +6081,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, case NK_Variable_Narrowing: // A variable's value may have been narrowed. S.Diag(PostInit->getLocStart(), - S.getLangOptions().MicrosoftExt || !S.getLangOptions().CPlusPlus0x? + S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus0x? diag::warn_init_list_variable_narrowing : S.isSFINAEContext()? diag::err_init_list_variable_narrowing_sfinae @@ -6103,7 +6103,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, // getQualifiedNameAsString() includes non-machine-parsable components. OS << *TT->getDecl(); } else if (const BuiltinType *BT = EntityType->getAs()) - OS << BT->getName(S.getLangOptions()); + OS << BT->getName(S.getLangOpts()); else { // Oops, we didn't find the actual type of the variable. Don't emit a fixit // with a broken cast. diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 3611350de0eb..2a09da0f94bf 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -643,7 +643,7 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, // non-explicit const conversion function to a block pointer having the // same parameter and return types as the closure type's function call // operator. - if (getLangOptions().Blocks && getLangOptions().ObjC1) + if (getLangOpts().Blocks && getLangOpts().ObjC1) addBlockPointerConversion(*this, IntroducerRange, Class, CallOperator); // Finalize the lambda class. diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index ea92b9dcd5c1..f1eb52241585 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -281,7 +281,7 @@ static inline unsigned getIDNS(Sema::LookupNameKind NameKind, } void LookupResult::configure() { - IDNS = getIDNS(LookupKind, SemaRef.getLangOptions().CPlusPlus, + IDNS = getIDNS(LookupKind, SemaRef.getLangOpts().CPlusPlus, isForRedeclaration()); // If we're looking for one of the allocation or deallocation @@ -497,7 +497,7 @@ static bool LookupBuiltin(Sema &S, LookupResult &R) { if (unsigned BuiltinID = II->getBuiltinID()) { // In C++, we don't have any predefined library functions like // 'malloc'. Instead, we'll just error. - if (S.getLangOptions().CPlusPlus && + if (S.getLangOpts().CPlusPlus && S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) return false; @@ -555,7 +555,7 @@ void Sema::ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class) { if (!Class->hasDeclaredCopyAssignment()) DeclareImplicitCopyAssignment(Class); - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // If the move constructor has not yet been declared, do so now. if (Class->needsImplicitMoveConstructor()) DeclareImplicitMoveConstructor(Class); // might not actually do it @@ -606,7 +606,7 @@ static void DeclareImplicitMemberFunctionsWithName(Sema &S, S.DeclareImplicitDefaultConstructor(Class); if (!Record->hasDeclaredCopyConstructor()) S.DeclareImplicitCopyConstructor(Class); - if (S.getLangOptions().CPlusPlus0x && + if (S.getLangOpts().CPlusPlus0x && Record->needsImplicitMoveConstructor()) S.DeclareImplicitMoveConstructor(Class); } @@ -629,7 +629,7 @@ static void DeclareImplicitMemberFunctionsWithName(Sema &S, CXXRecordDecl *Class = const_cast(Record); if (!Record->hasDeclaredCopyAssignment()) S.DeclareImplicitCopyAssignment(Class); - if (S.getLangOptions().CPlusPlus0x && + if (S.getLangOpts().CPlusPlus0x && Record->needsImplicitMoveAssignment()) S.DeclareImplicitMoveAssignment(Class); } @@ -647,7 +647,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) { bool Found = false; // Lazily declare C++ special member functions. - if (S.getLangOptions().CPlusPlus) + if (S.getLangOpts().CPlusPlus) DeclareImplicitMemberFunctionsWithName(S, R.getLookupName(), DC); // Perform lookup into this declaration context. @@ -835,7 +835,7 @@ static std::pair findOuterContext(Scope *S) { } bool Sema::CppLookupName(LookupResult &R, Scope *S) { - assert(getLangOptions().CPlusPlus && "Can perform only C++ lookup"); + assert(getLangOpts().CPlusPlus && "Can perform only C++ lookup"); DeclarationName Name = R.getLookupName(); @@ -1112,7 +1112,7 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) { LookupNameKind NameKind = R.getLookupKind(); - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // Unqualified name lookup in C/Objective-C is purely lexical, so // search in the declarations attached to the name. if (NameKind == Sema::LookupRedeclarationWithLinkage) { @@ -2295,13 +2295,13 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD, Name = Context.DeclarationNames.getCXXConstructorName(CanTy); if (!RD->hasDeclaredCopyConstructor()) DeclareImplicitCopyConstructor(RD); - if (getLangOptions().CPlusPlus0x && RD->needsImplicitMoveConstructor()) + if (getLangOpts().CPlusPlus0x && RD->needsImplicitMoveConstructor()) DeclareImplicitMoveConstructor(RD); } else { Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal); if (!RD->hasDeclaredCopyAssignment()) DeclareImplicitCopyAssignment(RD); - if (getLangOptions().CPlusPlus0x && RD->needsImplicitMoveAssignment()) + if (getLangOpts().CPlusPlus0x && RD->needsImplicitMoveAssignment()) DeclareImplicitMoveAssignment(RD); } @@ -2465,7 +2465,7 @@ DeclContext::lookup_result Sema::LookupConstructors(CXXRecordDecl *Class) { DeclareImplicitDefaultConstructor(Class); if (!Class->hasDeclaredCopyConstructor()) DeclareImplicitCopyConstructor(Class); - if (getLangOptions().CPlusPlus0x && Class->needsImplicitMoveConstructor()) + if (getLangOpts().CPlusPlus0x && Class->needsImplicitMoveConstructor()) DeclareImplicitMoveConstructor(Class); } @@ -3097,7 +3097,7 @@ void Sema::LookupVisibleDecls(Scope *S, LookupNameKind Kind, // unqualified name lookup. Scope *Initial = S; UnqualUsingDirectiveSet UDirs; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Find the first namespace or translation-unit scope. while (S && !isNamespaceOrTranslationUnitScope(S)) S = S->getParent(); @@ -3287,8 +3287,8 @@ void TypoCorrectionConsumer::addCorrection(TypoCorrection Correction) { // FIXME: The following should be rolled up into an operator< on // TypoCorrection with a more principled definition. CurrentCorrection.isKeyword() < Correction.isKeyword() || - Correction.getAsString(SemaRef.getLangOptions()) < - CurrentCorrection.getAsString(SemaRef.getLangOptions())) + Correction.getAsString(SemaRef.getLangOpts()) < + CurrentCorrection.getAsString(SemaRef.getLangOpts())) CurrentCorrection = Correction; while (BestResults.size() > MaxTypoDistanceResultSets) { @@ -3566,19 +3566,19 @@ static void AddKeywordsToConsumer(Sema &SemaRef, for (unsigned I = 0; I != NumCTypeSpecs; ++I) Consumer.addKeywordResult(CTypeSpecs[I]); - if (SemaRef.getLangOptions().C99) + if (SemaRef.getLangOpts().C99) Consumer.addKeywordResult("restrict"); - if (SemaRef.getLangOptions().Bool || SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().Bool || SemaRef.getLangOpts().CPlusPlus) Consumer.addKeywordResult("bool"); - else if (SemaRef.getLangOptions().C99) + else if (SemaRef.getLangOpts().C99) Consumer.addKeywordResult("_Bool"); - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("class"); Consumer.addKeywordResult("typename"); Consumer.addKeywordResult("wchar_t"); - if (SemaRef.getLangOptions().CPlusPlus0x) { + if (SemaRef.getLangOpts().CPlusPlus0x) { Consumer.addKeywordResult("char16_t"); Consumer.addKeywordResult("char32_t"); Consumer.addKeywordResult("constexpr"); @@ -3587,11 +3587,11 @@ static void AddKeywordsToConsumer(Sema &SemaRef, } } - if (SemaRef.getLangOptions().GNUMode) + if (SemaRef.getLangOpts().GNUMode) Consumer.addKeywordResult("typeof"); } - if (CCC.WantCXXNamedCasts && SemaRef.getLangOptions().CPlusPlus) { + if (CCC.WantCXXNamedCasts && SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("const_cast"); Consumer.addKeywordResult("dynamic_cast"); Consumer.addKeywordResult("reinterpret_cast"); @@ -3600,12 +3600,12 @@ static void AddKeywordsToConsumer(Sema &SemaRef, if (CCC.WantExpressionKeywords) { Consumer.addKeywordResult("sizeof"); - if (SemaRef.getLangOptions().Bool || SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().Bool || SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("false"); Consumer.addKeywordResult("true"); } - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { const char *CXXExprs[] = { "delete", "new", "operator", "throw", "typeid" }; @@ -3617,7 +3617,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef, cast(SemaRef.CurContext)->isInstance()) Consumer.addKeywordResult("this"); - if (SemaRef.getLangOptions().CPlusPlus0x) { + if (SemaRef.getLangOpts().CPlusPlus0x) { Consumer.addKeywordResult("alignof"); Consumer.addKeywordResult("nullptr"); } @@ -3633,7 +3633,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef, for (unsigned I = 0; I != NumCStmts; ++I) Consumer.addKeywordResult(CStmts[I]); - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("catch"); Consumer.addKeywordResult("try"); } @@ -3649,7 +3649,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef, Consumer.addKeywordResult("default"); } } else { - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("namespace"); Consumer.addKeywordResult("template"); } @@ -3665,10 +3665,10 @@ static void AddKeywordsToConsumer(Sema &SemaRef, } } - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("using"); - if (SemaRef.getLangOptions().CPlusPlus0x) + if (SemaRef.getLangOpts().CPlusPlus0x) Consumer.addKeywordResult("static_assert"); } } @@ -3718,13 +3718,13 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, DeclContext *MemberContext, bool EnteringContext, const ObjCObjectPointerType *OPT) { - if (Diags.hasFatalErrorOccurred() || !getLangOptions().SpellChecking) + if (Diags.hasFatalErrorOccurred() || !getLangOpts().SpellChecking) return TypoCorrection(); // In Microsoft mode, don't perform typo correction in a template member // function dependent context because it interferes with the "lookup into // dependent bases of class templates" feature. - if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && isa(CurContext)) return TypoCorrection(); @@ -3852,7 +3852,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, } // Build the NestedNameSpecifiers for the KnownNamespaces - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Load any externally-known namespaces. if (ExternalSource && !LoadedExternalKnownNamespaces) { SmallVector ExternalKnownNamespaces; @@ -3942,12 +3942,12 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, if (DI->second->empty()) Consumer.erase(DI); - else if (!getLangOptions().CPlusPlus || QualifiedResults.empty() || !ED) + else if (!getLangOpts().CPlusPlus || QualifiedResults.empty() || !ED) // If there are results in the closest possible bucket, stop break; // Only perform the qualified lookups for C++ - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { TmpRes.suppressDiagnostics(); for (llvm::SmallVector::iterator QRI = QualifiedResults.begin(), diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 617460d492b8..5c28db4c5e61 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -112,9 +112,9 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, unsigned Attributes = ODS.getPropertyAttributes(); TypeSourceInfo *TSI = GetTypeForDeclarator(FD.D, S); QualType T = TSI->getType(); - if ((getLangOptions().getGC() != LangOptions::NonGC && + if ((getLangOpts().getGC() != LangOptions::NonGC && T.isObjCGCWeak()) || - (getLangOptions().ObjCAutoRefCount && + (getLangOpts().ObjCAutoRefCount && T.getObjCLifetime() == Qualifiers::OCL_Weak)) Attributes |= ObjCDeclSpec::DQ_PR_weak; @@ -145,7 +145,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, MethodImplKind); if (Res) { CheckObjCPropertyAttributes(Res, AtLoc, Attributes); - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) checkARCPropertyDecl(*this, cast(Res)); } return Res; @@ -163,7 +163,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, // Validate the attributes on the @property. CheckObjCPropertyAttributes(Res, AtLoc, Attributes); - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) checkARCPropertyDecl(*this, Res); return Res; @@ -391,7 +391,7 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S, // Issue a warning if property is 'assign' as default and its object, which is // gc'able conforms to NSCopying protocol - if (getLangOptions().getGC() != LangOptions::NonGC && + if (getLangOpts().getGC() != LangOptions::NonGC && isAssign && !(Attributes & ObjCDeclSpec::DQ_PR_assign)) if (const ObjCObjectPointerType *ObjPtrTy = T->getAs()) { @@ -665,7 +665,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, QualType PropType = property->getType(); QualType PropertyIvarType = PropType.getNonReferenceType(); - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (property->getPropertyAttributesAsWritten() & ObjCPropertyDecl::OBJC_PR_readonly) && PropertyIvarType->isObjCRetainableType()) { @@ -677,8 +677,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, // Add GC __weak to the ivar type if the property is weak. if ((kind & ObjCPropertyDecl::OBJC_PR_weak) && - getLangOptions().getGC() != LangOptions::NonGC) { - assert(!getLangOptions().ObjCAutoRefCount); + getLangOpts().getGC() != LangOptions::NonGC) { + assert(!getLangOpts().ObjCAutoRefCount); if (PropertyIvarType.isObjCGCStrong()) { Diag(PropertyLoc, diag::err_gc_weak_property_strong_type); Diag(property->getLocation(), diag::note_property_declare); @@ -691,7 +691,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, if (!Ivar) { // In ARC, give the ivar a lifetime qualifier based on the // property attributes. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && !PropertyIvarType.getObjCLifetime() && PropertyIvarType->isObjCRetainableType()) { @@ -715,7 +715,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, Diag(property->getLocation(), diag::note_property_declare); err = true; } - if (!err && !getLangOptions().ObjCRuntimeHasWeak) { + if (!err && !getLangOpts().ObjCRuntimeHasWeak) { Diag(PropertyLoc, diag::err_arc_weak_no_runtime); Diag(property->getLocation(), diag::note_property_declare); } @@ -728,8 +728,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, } if (kind & ObjCPropertyDecl::OBJC_PR_weak && - !getLangOptions().ObjCAutoRefCount && - getLangOptions().getGC() == LangOptions::NonGC) { + !getLangOpts().ObjCAutoRefCount && + getLangOpts().getGC() == LangOptions::NonGC) { Diag(PropertyLoc, diag::error_synthesize_weak_non_arc_or_gc); Diag(property->getLocation(), diag::note_property_declare); } @@ -743,11 +743,11 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, IDecl->makeDeclVisibleInContext(Ivar, false); property->setPropertyIvarDecl(Ivar); - if (!getLangOptions().ObjCNonFragileABI) + if (!getLangOpts().ObjCNonFragileABI) Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId; // Note! I deliberately want it to fall thru so, we have a // a property implementation and to avoid future warnings. - } else if (getLangOptions().ObjCNonFragileABI && + } else if (getLangOpts().ObjCNonFragileABI && !declaresSameEntity(ClassDeclared, IDecl)) { Diag(PropertyLoc, diag::error_ivar_in_superclass_use) << property->getDeclName() << Ivar->getDeclName() @@ -796,7 +796,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, } // __weak is explicit. So it works on Canonical type. if ((PropType.isObjCGCWeak() && !IvarType.isObjCGCWeak() && - getLangOptions().getGC() != LangOptions::NonGC)) { + getLangOpts().getGC() != LangOptions::NonGC)) { Diag(PropertyLoc, diag::error_weak_property) << property->getDeclName() << Ivar->getDeclName(); Diag(Ivar->getLocation(), diag::note_ivar_decl); @@ -805,13 +805,13 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, // Fall thru - see previous comment if ((property->getType()->isObjCObjectPointerType() || PropType.isObjCGCStrong()) && IvarType.isObjCGCWeak() && - getLangOptions().getGC() != LangOptions::NonGC) { + getLangOpts().getGC() != LangOptions::NonGC) { Diag(PropertyLoc, diag::error_strong_property) << property->getDeclName() << Ivar->getDeclName(); // Fall thru - see previous comment } } - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) checkARCPropertyImpl(*this, PropertyLoc, property, Ivar); } else if (PropertyIvar) // @dynamic @@ -827,7 +827,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, Ivar, PropertyIvarLoc); if (ObjCMethodDecl *getterMethod = property->getGetterMethodDecl()) { getterMethod->createImplicitParams(Context, IDecl); - if (getLangOptions().CPlusPlus && Synthesize && + if (getLangOpts().CPlusPlus && Synthesize && Ivar->getType()->isRecordType()) { // For Objective-C++, need to synthesize the AST for the IVAR object to be // returned by the getter as it must conform to C++'s copy-return rules. @@ -862,7 +862,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, } if (ObjCMethodDecl *setterMethod = property->getSetterMethodDecl()) { setterMethod->createImplicitParams(Context, IDecl); - if (getLangOptions().CPlusPlus && Synthesize + if (getLangOpts().CPlusPlus && Synthesize && Ivar->getType()->isRecordType()) { // FIXME. Eventually we want to do this for Objective-C as well. ImplicitParamDecl *SelfDecl = setterMethod->getSelfDecl(); @@ -915,8 +915,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, return 0; } IC->addPropertyImplementation(PIDecl); - if (getLangOptions().ObjCDefaultSynthProperties && - getLangOptions().ObjCNonFragileABI2 && + if (getLangOpts().ObjCDefaultSynthProperties && + getLangOpts().ObjCNonFragileABI2 && !IDecl->isObjCRequiresPropertyDefs()) { // Diagnose if an ivar was lazily synthesdized due to a previous // use and if 1) property is @dynamic or 2) property is synthesized @@ -1482,7 +1482,7 @@ void Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, ObjCContainerDecl* IDecl) { // Rules apply in non-GC mode only - if (getLangOptions().getGC() != LangOptions::NonGC) + if (getLangOpts().getGC() != LangOptions::NonGC) return; for (ObjCContainerDecl::prop_iterator I = IDecl->prop_begin(), E = IDecl->prop_end(); @@ -1569,7 +1569,7 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, } void Sema::DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D) { - if (getLangOptions().getGC() == LangOptions::GCOnly) + if (getLangOpts().getGC() == LangOptions::GCOnly) return; for (ObjCImplementationDecl::propimpl_iterator @@ -1587,7 +1587,7 @@ void Sema::DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D ObjCMethodFamily family = method->getMethodFamily(); if (family == OMF_alloc || family == OMF_copy || family == OMF_mutableCopy || family == OMF_new) { - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) Diag(PID->getLocation(), diag::err_ownin_getter_rule); else Diag(PID->getLocation(), diag::warn_owning_getter_rule); @@ -1765,7 +1765,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, ObjCPropertyDecl *PropertyDecl = cast(PDecl); QualType PropertyTy = PropertyDecl->getType(); - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_readonly) && PropertyTy->isObjCRetainableType()) { // 'readonly' property with no obvious lifetime. @@ -1833,7 +1833,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, << "assign" << "strong"; Attributes &= ~ObjCDeclSpec::DQ_PR_strong; } - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_weak)) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "assign" << "weak"; @@ -1855,7 +1855,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, << "unsafe_unretained" << "strong"; Attributes &= ~ObjCDeclSpec::DQ_PR_strong; } - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_weak)) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "unsafe_unretained" << "weak"; @@ -1905,7 +1905,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong | ObjCDeclSpec::DQ_PR_weak)) && PropertyTy->isObjCObjectPointerType()) { - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) // With arc, @property definitions should default to (strong) when // not specified; including when property is 'readonly'. PropertyDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong); @@ -1915,15 +1915,15 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, PropertyTy->isObjCQualifiedClassType()); // In non-gc, non-arc mode, 'Class' is treated as a 'void *' no need to // issue any warning. - if (isAnyClassTy && getLangOptions().getGC() == LangOptions::NonGC) + if (isAnyClassTy && getLangOpts().getGC() == LangOptions::NonGC) ; else { // Skip this warning in gc-only mode. - if (getLangOptions().getGC() != LangOptions::GCOnly) + if (getLangOpts().getGC() != LangOptions::GCOnly) Diag(Loc, diag::warn_objc_property_no_assignment_attribute); // If non-gc code warn that this is likely inappropriate. - if (getLangOptions().getGC() == LangOptions::NonGC) + if (getLangOpts().getGC() == LangOptions::NonGC) Diag(Loc, diag::warn_objc_property_default_assign_on_object); } } @@ -1936,10 +1936,10 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, if (!(Attributes & ObjCDeclSpec::DQ_PR_copy) &&!(Attributes & ObjCDeclSpec::DQ_PR_readonly) - && getLangOptions().getGC() == LangOptions::GCOnly + && getLangOpts().getGC() == LangOptions::GCOnly && PropertyTy->isBlockPointerType()) Diag(Loc, diag::warn_objc_property_copy_missing_on_block); - else if (getLangOptions().ObjCAutoRefCount && + else if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_retain) && !(Attributes & ObjCDeclSpec::DQ_PR_readonly) && !(Attributes & ObjCDeclSpec::DQ_PR_strong) && diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 49301c2dc2ca..fe999b159987 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -292,7 +292,7 @@ NarrowingKind StandardConversionSequence::getNarrowingKind(ASTContext &Ctx, const Expr *Converted, APValue &ConstantValue) const { - assert(Ctx.getLangOptions().CPlusPlus && "narrowing check outside C++"); + assert(Ctx.getLangOpts().CPlusPlus && "narrowing check outside C++"); // C++11 [dcl.init.list]p7: // A narrowing conversion is an implicit conversion ... @@ -1107,7 +1107,7 @@ TryImplicitConversion(Sema &S, Expr *From, QualType ToType, return ICS; } - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { ICS.setBad(BadConversionSequence::no_conversion, From, ToType); return ICS; } @@ -1180,7 +1180,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, // Objective-C ARC: Determine whether we will allow the writeback conversion. bool AllowObjCWritebackConversion - = getLangOptions().ObjCAutoRefCount && + = getLangOpts().ObjCAutoRefCount && (Action == AA_Passing || Action == AA_Sending); ICS = clang::TryImplicitConversion(*this, From, ToType, @@ -1276,7 +1276,7 @@ static bool IsVectorConversion(ASTContext &Context, QualType FromType, // same size if (ToType->isVectorType() && FromType->isVectorType()) { if (Context.areCompatibleVectorTypes(FromType, ToType) || - (Context.getLangOptions().LaxVectorConversions && + (Context.getLangOpts().LaxVectorConversions && (Context.getTypeSize(FromType) == Context.getTypeSize(ToType)))) { ICK = ICK_Vector_Conversion; return true; @@ -1311,7 +1311,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, // There are no standard conversions for class types in C++, so // abort early. When overloading in C, however, we do permit if (FromType->isRecordType() || ToType->isRecordType()) { - if (S.getLangOptions().CPlusPlus) + if (S.getLangOpts().CPlusPlus) return false; // When we're overloading in C, we allow, as standard conversions, @@ -1499,7 +1499,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, } else if (IsVectorConversion(S.Context, FromType, ToType, SecondICK)) { SCS.Second = SecondICK; FromType = ToType.getUnqualifiedType(); - } else if (!S.getLangOptions().CPlusPlus && + } else if (!S.getLangOpts().CPlusPlus && S.Context.typesAreCompatible(ToType, FromType)) { // Compatible conversions (Clang extension for C function overloading) SCS.Second = ICK_Compatible_Conversion; @@ -1732,7 +1732,7 @@ bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType) { // C99 6.3.1.5p1: // When a float is promoted to double or long double, or a // double is promoted to long double [...]. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && (FromBuiltin->getKind() == BuiltinType::Float || FromBuiltin->getKind() == BuiltinType::Double) && (ToBuiltin->getKind() == BuiltinType::LongDouble)) @@ -1898,7 +1898,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, // , including objective-c pointers. QualType ToPointeeType = ToTypePtr->getPointeeType(); if (FromType->isObjCObjectPointerType() && ToPointeeType->isVoidType() && - !getLangOptions().ObjCAutoRefCount) { + !getLangOpts().ObjCAutoRefCount) { ConvertedType = BuildSimilarlyQualifiedPointerType( FromType->getAs(), ToPointeeType, @@ -1929,7 +1929,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, } // MSVC allows implicit function to void* type conversion. - if (getLangOptions().MicrosoftExt && FromPointeeType->isFunctionType() && + if (getLangOpts().MicrosoftExt && FromPointeeType->isFunctionType() && ToPointeeType->isVoidType()) { ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, ToPointeeType, @@ -1939,7 +1939,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, // When we're overloading in C, we allow a special kind of pointer // conversion for compatible-but-not-identical pointee types. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && Context.typesAreCompatible(FromPointeeType, ToPointeeType)) { ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, ToPointeeType, @@ -1960,7 +1960,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, // // Note that we do not check for ambiguity or inaccessibility // here. That is handled by CheckPointerConversion. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && FromPointeeType->isRecordType() && ToPointeeType->isRecordType() && !Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType) && !RequireCompleteType(From->getLocStart(), FromPointeeType, PDiag()) && @@ -2002,7 +2002,7 @@ static QualType AdoptQualifiers(ASTContext &Context, QualType T, Qualifiers Qs){ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, QualType& ConvertedType, bool &IncompatibleObjC) { - if (!getLangOptions().ObjC1) + if (!getLangOpts().ObjC1) return false; // The set of qualifiers on the type we're converting from. @@ -2041,7 +2041,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, if (Context.canAssignObjCInterfaces(ToObjCPtr, FromObjCPtr)) { const ObjCInterfaceType* LHS = ToObjCPtr->getInterfaceType(); const ObjCInterfaceType* RHS = FromObjCPtr->getInterfaceType(); - if (getLangOptions().CPlusPlus && LHS && RHS && + if (getLangOpts().CPlusPlus && LHS && RHS && !ToObjCPtr->getPointeeType().isAtLeastAsQualifiedAs( FromObjCPtr->getPointeeType())) return false; @@ -2197,7 +2197,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, /// this conversion. bool Sema::isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType) { - if (!getLangOptions().ObjCAutoRefCount || + if (!getLangOpts().ObjCAutoRefCount || Context.hasSameUnqualifiedType(FromType, ToType)) return false; @@ -2301,7 +2301,7 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType, } else { QualType RHS = FromFunctionType->getResultType(); QualType LHS = ToFunctionType->getResultType(); - if ((!getLangOptions().CPlusPlus || !RHS->isRecordType()) && + if ((!getLangOpts().CPlusPlus || !RHS->isRecordType()) && !RHS.hasQualifiers() && LHS.hasQualifiers()) LHS = LHS.getUnqualifiedType(); @@ -2450,7 +2450,7 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos) { - if (!getLangOptions().ObjC1) { + if (!getLangOpts().ObjC1) { for (FunctionProtoType::arg_type_iterator O = OldType->arg_type_begin(), N = NewType->arg_type_begin(), E = OldType->arg_type_end(); O && (O != E); ++O, ++N) { @@ -3072,7 +3072,7 @@ static ImplicitConversionSequence::CompareKind compareConversionFunctions(Sema &S, FunctionDecl *Function1, FunctionDecl *Function2) { - if (!S.getLangOptions().ObjC1 || !S.getLangOptions().CPlusPlus0x) + if (!S.getLangOpts().ObjC1 || !S.getLangOpts().CPlusPlus0x) return ImplicitConversionSequence::Indistinguishable; // Objective-C++: @@ -3422,7 +3422,7 @@ CompareStandardConversionSequences(Sema &S, // } // Here, MSVC will call f(int) instead of generating a compile error // as clang will do in standard mode. - if (S.getLangOptions().MicrosoftMode && + if (S.getLangOpts().MicrosoftMode && SCS1.Second == ICK_Integral_Conversion && SCS2.Second == ICK_Floating_Integral && S.Context.getTypeSize(SCS1.getFromType()) == @@ -4089,7 +4089,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, // allow the use of rvalue references in C++98/03 for the benefit of // standard library implementors; therefore, we need the xvalue check here. ICS.Standard.DirectBinding = - S.getLangOptions().CPlusPlus0x || + S.getLangOpts().CPlusPlus0x || (InitCategory.isPRValue() && !T2->isRecordType()); ICS.Standard.IsLvalueReference = !isRValRef; ICS.Standard.BindsToFunctionLvalue = T2->isFunctionType(); @@ -4970,7 +4970,7 @@ Sema::ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *From, // If we don't have a class type in C++, there's no way we can get an // expression of integral or enumeration type. const RecordType *RecordTy = T->getAs(); - if (!RecordTy || !getLangOptions().CPlusPlus) { + if (!RecordTy || !getLangOpts().CPlusPlus) { if (NotIntDiag.getDiagID()) Diag(Loc, NotIntDiag) << T << From->getSourceRange(); return Owned(From); @@ -5193,7 +5193,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, } // (CUDA B.1): Check for invalid calls between targets. - if (getLangOptions().CUDA) + if (getLangOpts().CUDA) if (const FunctionDecl *Caller = dyn_cast(CurContext)) if (CheckCUDATarget(Caller, Function)) { Candidate.Viable = false; @@ -5215,7 +5215,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, SuppressUserConversions, /*InOverloadResolution=*/true, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount, + getLangOpts().ObjCAutoRefCount, AllowExplicit); if (Candidate.Conversions[ArgIdx].isBad()) { Candidate.Viable = false; @@ -5388,7 +5388,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, SuppressUserConversions, /*InOverloadResolution=*/true, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount); + getLangOpts().ObjCAutoRefCount); if (Candidate.Conversions[ArgIdx + 1].isBad()) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_bad_conversion; @@ -5775,7 +5775,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, /*SuppressUserConversions=*/false, /*InOverloadResolution=*/false, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount); + getLangOpts().ObjCAutoRefCount); if (Candidate.Conversions[ArgIdx + 1].isBad()) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_bad_conversion; @@ -5893,7 +5893,7 @@ void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, ArgIdx == 0 && IsAssignmentOperator, /*InOverloadResolution=*/false, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount); + getLangOpts().ObjCAutoRefCount); } if (Candidate.Conversions[ArgIdx].isBad()) { Candidate.Viable = false; @@ -7238,7 +7238,7 @@ public: S.AddBuiltinCandidate(*MemPtr, ParamTypes, Args, 2, CandidateSet); } - if (S.getLangOptions().CPlusPlus0x) { + if (S.getLangOpts().CPlusPlus0x) { for (BuiltinCandidateTypeSet::iterator Enum = CandidateTypes[ArgIdx].enumeration_begin(), EnumEnd = CandidateTypes[ArgIdx].enumeration_end(); @@ -8520,7 +8520,7 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand, SuppressUserConversions, /*InOverloadResolution*/ true, /*AllowObjCWritebackConversion=*/ - S.getLangOptions().ObjCAutoRefCount); + S.getLangOpts().ObjCAutoRefCount); return; } @@ -8533,7 +8533,7 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand, SuppressUserConversions, /*InOverloadResolution=*/true, /*AllowObjCWritebackConversion=*/ - S.getLangOptions().ObjCAutoRefCount); + S.getLangOpts().ObjCAutoRefCount); // Store the FixIt in the candidate if it exists. if (!Unfixable && Cand->Conversions[ConvIdx].isBad()) Unfixable = !Cand->TryToFixBadConversion(ConvIdx, S); @@ -8779,7 +8779,7 @@ private: return false; if (FunctionDecl *FunDecl = dyn_cast(Fn)) { - if (S.getLangOptions().CUDA) + if (S.getLangOpts().CUDA) if (FunctionDecl *Caller = dyn_cast(S.CurContext)) if (S.CheckCUDATarget(Caller, FunDecl)) return false; @@ -9344,7 +9344,7 @@ class RecoveryCallCCC : public CorrectionCandidateCallback { public: RecoveryCallCCC(Sema &SemaRef, unsigned NumArgs, bool HasExplicitTemplateArgs) : NumArgs(NumArgs), HasExplicitTemplateArgs(HasExplicitTemplateArgs) { - WantTypeSpecifiers = SemaRef.getLangOptions().CPlusPlus; + WantTypeSpecifiers = SemaRef.getLangOpts().CPlusPlus; WantRemainingKeywords = false; } @@ -9488,7 +9488,7 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, llvm_unreachable("performing ADL for builtin"); // We don't perform ADL in C. - assert(getLangOptions().CPlusPlus && "ADL enabled in C"); + assert(getLangOpts().CPlusPlus && "ADL enabled in C"); } else assert(!ULE->isStdAssociatedNamespace() && "std is associated namespace but not doing ADL"); @@ -9513,7 +9513,7 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, // create a type dependent CallExpr. The goal is to postpone name lookup // to instantiation time to be able to search into type dependent base // classes. - if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && (isa(CurContext) || isa(CurContext))) { CallExpr *CE = new (Context) CallExpr(Context, Fn, Args, NumArgs, Context.DependentTy, VK_RValue, @@ -10354,7 +10354,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, // Microsoft supports direct constructor calls. - if (getLangOptions().MicrosoftExt && isa(Func)) { + if (getLangOpts().MicrosoftExt && isa(Func)) { AddOverloadCandidate(cast(Func), I.getPair(), llvm::makeArrayRef(Args, NumArgs), CandidateSet); } else if ((Method = dyn_cast(Func))) { diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index c51eb3f4956c..effb372303b0 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -594,9 +594,9 @@ ExprResult ObjCPropertyOpBuilder::buildSet(Expr *op, SourceLocation opcLoc, // Use assignment constraints when possible; they give us better // diagnostics. "When possible" basically means anything except a // C++ class type. - if (!S.getLangOptions().CPlusPlus || !op->getType()->isRecordType()) { + if (!S.getLangOpts().CPlusPlus || !op->getType()->isRecordType()) { QualType paramType = (*Setter->param_begin())->getType(); - if (!S.getLangOptions().CPlusPlus || !paramType->isRecordType()) { + if (!S.getLangOpts().CPlusPlus || !paramType->isRecordType()) { ExprResult opResult = op; Sema::AssignConvertType assignResult = S.CheckSingleAssignmentConstraints(paramType, opResult); @@ -675,7 +675,7 @@ ExprResult ObjCPropertyOpBuilder::buildRValueOperation(Expr *op) { /// succeeded bool ObjCPropertyOpBuilder::tryBuildGetOfReference(Expr *op, ExprResult &result) { - if (!S.getLangOptions().CPlusPlus) return false; + if (!S.getLangOpts().CPlusPlus) return false; findGetter(); assert(Getter && "property has no setter and no getter!"); @@ -727,7 +727,7 @@ ObjCPropertyOpBuilder::buildAssignmentOperation(Scope *Sc, if (result.isInvalid()) return ExprError(); // Various warnings about property assignments in ARC. - if (S.getLangOptions().ObjCAutoRefCount && InstanceReceiver) { + if (S.getLangOpts().ObjCAutoRefCount && InstanceReceiver) { S.checkRetainCycles(InstanceReceiver->getSourceExpr(), RHS); S.checkUnsafeExprAssigns(opcLoc, LHS, RHS); } @@ -806,7 +806,7 @@ ObjCSubscriptOpBuilder::buildAssignmentOperation(Scope *Sc, if (result.isInvalid()) return ExprError(); // Various warnings about objc Index'ed assignments in ARC. - if (S.getLangOptions().ObjCAutoRefCount && InstanceBase) { + if (S.getLangOpts().ObjCAutoRefCount && InstanceBase) { S.checkRetainCycles(InstanceBase->getSourceExpr(), RHS); S.checkUnsafeExprAssigns(opcLoc, LHS, RHS); } @@ -846,7 +846,7 @@ Sema::ObjCSubscriptKind // All other scalar cases are assumed to be dictionary indexing which // caller handles, with diagnostics if needed. return OS_Dictionary; - if (!getLangOptions().CPlusPlus || RecordTy->isIncompleteType()) { + if (!getLangOpts().CPlusPlus || RecordTy->isIncompleteType()) { // No indexing can be done. Issue diagnostics and quit. Diag(FromE->getExprLoc(), diag::err_objc_subscript_type_conversion) << FromE->getType(); @@ -952,7 +952,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() { bool receiverIdType = (BaseT->isObjCIdType() || BaseT->isObjCQualifiedIdType()); - if (!AtIndexGetter && S.getLangOptions().DebuggerObjCLiteral) { + if (!AtIndexGetter && S.getLangOpts().DebuggerObjCLiteral) { AtIndexGetter = ObjCMethodDecl::Create(S.Context, SourceLocation(), SourceLocation(), AtIndexGetterSelector, S.Context.getObjCIdType() /*ReturnType*/, @@ -1062,7 +1062,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() { bool receiverIdType = (BaseT->isObjCIdType() || BaseT->isObjCQualifiedIdType()); - if (!AtIndexSetter && S.getLangOptions().DebuggerObjCLiteral) { + if (!AtIndexSetter && S.getLangOpts().DebuggerObjCLiteral) { TypeSourceInfo *ResultTInfo = 0; QualType ReturnType = S.Context.VoidTy; AtIndexSetter = ObjCMethodDecl::Create(S.Context, SourceLocation(), diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index b9022e6200cd..ef453f5c6ae8 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -78,7 +78,7 @@ void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) { // In ARC, we don't need to retain the iteration variable of a fast // enumeration loop. Rather than actually trying to catch that // during declaration processing, we remove the consequences here. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { QualType type = var->getType(); // Only do this if we inferred the lifetime. Inferred lifetime @@ -190,7 +190,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) { } } } else if (const ObjCMessageExpr *ME = dyn_cast(E)) { - if (getLangOptions().ObjCAutoRefCount && ME->isDelegateInitCall()) { + if (getLangOpts().ObjCAutoRefCount && ME->isDelegateInitCall()) { Diag(Loc, diag::err_arc_unused_init_message) << R1; return; } @@ -248,7 +248,7 @@ Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, Stmt **Elts = reinterpret_cast(elts.release()); // If we're in C89 mode, check that we don't have any decls after stmts. If // so, emit an extension diagnostic. - if (!getLangOptions().C99 && !getLangOptions().CPlusPlus) { + if (!getLangOpts().C99 && !getLangOpts().CPlusPlus) { // Note that __extension__ can be around a decl. unsigned i = 0; // Skip over all declarations. @@ -296,7 +296,7 @@ Sema::ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal, return StmtError(); } - if (!getLangOptions().CPlusPlus0x) { + if (!getLangOpts().CPlusPlus0x) { // C99 6.8.4.2p3: The expression shall be an integer constant. // However, GCC allows any evaluatable integer expression. if (!LHSVal->isTypeDependent() && !LHSVal->isValueDependent()) { @@ -645,7 +645,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, llvm::APSInt LoVal; - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++11 [stmt.switch]p2: the constant-expression shall be a converted // constant expression of the promoted type of the switch condition. ExprResult ConvLo = @@ -743,7 +743,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Expr *Hi = CR->getRHS(); llvm::APSInt HiVal; - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++11 [stmt.switch]p2: the constant-expression shall be a converted // constant expression of the promoted type of the switch condition. ExprResult ConvHi = @@ -1033,7 +1033,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, FullExprArg second, Decl *secondVar, FullExprArg third, SourceLocation RParenLoc, Stmt *Body) { - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { if (DeclStmt *DS = dyn_cast_or_null(First)) { // C99 6.8.5p3: The declaration part of a 'for' statement shall only // declare identifiers for objects having storage class 'auto' or @@ -1115,7 +1115,7 @@ Sema::ActOnObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) { // Under ARC, it is an error not to have a forward-declared class. if (iface && RequireCompleteType(forLoc, QualType(objectType, 0), - getLangOptions().ObjCAutoRefCount + getLangOpts().ObjCAutoRefCount ? PDiag(diag::err_arc_collection_forward) << collection->getSourceRange() : PDiag(0))) { @@ -1235,7 +1235,7 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init, // In ARC, infer lifetime. // FIXME: ARC may want to turn this into 'const __unsafe_unretained' if // we're doing the equivalent of fast iteration. - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && SemaRef.inferObjCARCLifetime(Decl)) Decl->setInvalidDecl(); @@ -1883,7 +1883,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // types we can conclusively prove aren't void. } else if (FnRetType->isVoidType()) { if (RetValExp && !isa(RetValExp) && - !(getLangOptions().CPlusPlus && + !(getLangOpts().CPlusPlus && (RetValExp->isTypeDependent() || RetValExp->getType()->isVoidType()))) { Diag(ReturnLoc, diag::err_return_block_has_expr); @@ -1923,7 +1923,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // If we need to check for the named return value optimization, save the // return statement in our scope for later processing. - if (getLangOptions().CPlusPlus && FnRetType->isRecordType() && + if (getLangOpts().CPlusPlus && FnRetType->isRecordType() && !CurContext->isDependentContext()) FunctionScopes.back()->Returns.push_back(Result); @@ -2001,7 +2001,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // return (some void expression); is legal in C++. if (D != diag::ext_return_has_void_expr || - !getLangOptions().CPlusPlus) { + !getLangOpts().CPlusPlus) { NamedDecl *CurDecl = getCurFunctionOrMethodDecl(); int FunctionKind = 0; @@ -2028,7 +2028,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { } else if (!RetValExp && !FnRetType->isDependentType()) { unsigned DiagID = diag::warn_return_missing_expr; // C90 6.6.6.4p4 // C99 6.8.6.4p1 (ext_ since GCC warns) - if (getLangOptions().C99) DiagID = diag::ext_return_missing_expr; + if (getLangOpts().C99) DiagID = diag::ext_return_missing_expr; if (FunctionDecl *FD = getCurFunctionDecl()) Diag(ReturnLoc, DiagID) << FD->getIdentifier() << 0/*fn*/; @@ -2082,7 +2082,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // If we need to check for the named return value optimization, save the // return statement in our scope for later processing. - if (getLangOptions().CPlusPlus && FnRetType->isRecordType() && + if (getLangOpts().CPlusPlus && FnRetType->isRecordType() && !CurContext->isDependentContext()) FunctionScopes.back()->Returns.push_back(Result); @@ -2108,7 +2108,7 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) { // are supposed to allow. const Expr *E2 = E->IgnoreParenNoopCasts(S.Context); if (E != E2 && E2->isLValue()) { - if (!S.getLangOptions().HeinousExtensions) + if (!S.getLangOpts().HeinousExtensions) S.Diag(E2->getLocStart(), diag::err_invalid_asm_cast_lvalue) << E->getSourceRange(); else @@ -2386,7 +2386,7 @@ Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) { StmtResult Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg CatchStmts, Stmt *Finally) { - if (!getLangOptions().ObjCExceptions) + if (!getLangOpts().ObjCExceptions) Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@try"; getCurFunction()->setHasBranchProtectedScope(); @@ -2423,7 +2423,7 @@ StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, StmtResult Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope) { - if (!getLangOptions().ObjCExceptions) + if (!getLangOpts().ObjCExceptions) Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@throw"; if (!Throw) { @@ -2523,7 +2523,7 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, MultiStmtArg RawHandlers) { // Don't report an error if 'try' is used in system headers. - if (!getLangOptions().CXXExceptions && + if (!getLangOpts().CXXExceptions && !getSourceManager().isInSystemHeader(TryLoc)) Diag(TryLoc, diag::err_exceptions_disabled) << "try"; diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 71677fc15721..af6b319e901b 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -138,7 +138,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S, bool EnteringContext, TemplateTy &TemplateResult, bool &MemberOfUnknownSpecialization) { - assert(getLangOptions().CPlusPlus && "No template names in C!"); + assert(getLangOpts().CPlusPlus && "No template names in C!"); DeclarationName TName; MemberOfUnknownSpecialization = false; @@ -328,8 +328,8 @@ void Sema::LookupTemplateName(LookupResult &Found, Found.addDecl(Corrected.getCorrectionDecl()); FilterAcceptableTemplateNames(Found); if (!Found.empty()) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); if (LookupCtx) Diag(Found.getNameLoc(), diag::err_no_member_template_suggest) << Name << LookupCtx << CorrectedQuotedStr << SS.getRange() @@ -452,7 +452,7 @@ void Sema::DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl) { assert(PrevDecl->isTemplateParameter() && "Not a template parameter"); // Microsoft Visual C++ permits template parameters to be shadowed. - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) return; // C++ [temp.local]p4: @@ -1132,7 +1132,7 @@ static bool DiagnoseDefaultTemplateArgument(Sema &S, // template-argument, that declaration shall be a definition and shall be // the only declaration of the function template in the translation unit. // (C++98/03 doesn't have this wording; see DR226). - S.Diag(ParamLoc, S.getLangOptions().CPlusPlus0x ? + S.Diag(ParamLoc, S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_parameter_default_in_function_template : diag::ext_template_parameter_default_in_function_template) << DefArgRange; @@ -2307,7 +2307,7 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S, TemplateTy &Result) { if (TemplateKWLoc.isValid() && S && !S->getTemplateParamParent()) Diag(TemplateKWLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_outside_of_template : diag::ext_template_outside_of_template) << FixItHint::CreateRemoval(TemplateKWLoc); @@ -2430,7 +2430,7 @@ bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, // Objective-C ARC: // If an explicitly-specified template argument type is a lifetime type // with no lifetime qualifier, the __strong lifetime qualifier is inferred. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && ArgType->isObjCLifetimeType() && !ArgType.getObjCLifetime()) { Qualifiers Qs; @@ -2871,7 +2871,7 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, // We have a template template parameter but the template // argument does not refer to a template. Diag(Arg.getLocation(), diag::err_template_arg_must_be_template) - << getLangOptions().CPlusPlus0x; + << getLangOpts().CPlusPlus0x; return true; case TemplateArgument::Declaration: @@ -3375,7 +3375,7 @@ bool UnnamedLocalNoLinkageFinder::VisitAtomicType(const AtomicType* T) { bool UnnamedLocalNoLinkageFinder::VisitTagDecl(const TagDecl *Tag) { if (Tag->getDeclContext()->isFunctionOrMethod()) { S.Diag(SR.getBegin(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_local_type : diag::ext_template_arg_local_type) << S.Context.getTypeDeclType(Tag) << SR; @@ -3384,7 +3384,7 @@ bool UnnamedLocalNoLinkageFinder::VisitTagDecl(const TagDecl *Tag) { if (!Tag->getDeclName() && !Tag->getTypedefNameForAnonDecl()) { S.Diag(SR.getBegin(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_unnamed_type : diag::ext_template_arg_unnamed_type) << SR; S.Diag(Tag->getLocation(), diag::note_template_unnamed_type_here); @@ -3484,7 +3484,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, while (ParenExpr *Parens = dyn_cast(Arg)) { if (!Invalid && !ExtraParens) { S.Diag(Arg->getLocStart(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_extra_parens : diag::ext_template_arg_extra_parens) << Arg->getSourceRange(); @@ -3508,7 +3508,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, } } - if (S.getLangOptions().MicrosoftExt && isa(Arg)) { + if (S.getLangOpts().MicrosoftExt && isa(Arg)) { Converted = TemplateArgument(ArgIn); return false; } @@ -3751,7 +3751,7 @@ bool Sema::CheckTemplateArgumentPointerToMember(Expr *Arg, while (ParenExpr *Parens = dyn_cast(Arg)) { if (!Invalid && !ExtraParens) { Diag(Arg->getLocStart(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_extra_parens : diag::ext_template_arg_extra_parens) << Arg->getSourceRange(); @@ -3877,7 +3877,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, return ExprError(); } - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // We can't check arbitrary value-dependent arguments. // FIXME: If there's no viable conversion to the template parameter type, // we should be able to diagnose that prior to instantiation. @@ -4718,7 +4718,7 @@ static bool CheckTemplateSpecializationScope(Sema &S, } if (S.CurContext->isRecord() && !IsPartialSpecialization) { - if (S.getLangOptions().MicrosoftExt) { + if (S.getLangOpts().MicrosoftExt) { // Do not warn for class scope explicit specialization during // instantiation, warning was already emitted during pattern // semantic analysis. @@ -4774,7 +4774,7 @@ static bool CheckTemplateSpecializationScope(Sema &S, int Diag; if (!IsCPlusPlus0xExtension) Diag = diag::err_template_spec_decl_out_of_scope; - else if (!S.getLangOptions().CPlusPlus0x) + else if (!S.getLangOpts().CPlusPlus0x) Diag = diag::ext_template_spec_decl_out_of_scope; else Diag = diag::warn_cxx98_compat_template_spec_decl_out_of_scope; @@ -4784,7 +4784,7 @@ static bool CheckTemplateSpecializationScope(Sema &S, S.Diag(Specialized->getLocation(), diag::note_specialized_entity); ComplainedAboutScope = - !(IsCPlusPlus0xExtension && S.getLangOptions().CPlusPlus0x); + !(IsCPlusPlus0xExtension && S.getLangOpts().CPlusPlus0x); } } @@ -5523,7 +5523,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, // In C++98/03 mode, we only give an extension warning here, because it // is not harmful to try to explicitly instantiate something that // has been explicitly specialized. - Diag(NewLoc, getLangOptions().CPlusPlus0x ? + Diag(NewLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_explicit_instantiation_after_specialization : diag::ext_explicit_instantiation_after_specialization) << PrevDecl; @@ -5955,19 +5955,19 @@ static bool CheckExplicitInstantiationScope(Sema &S, NamedDecl *D, if (NamespaceDecl *NS = dyn_cast(OrigContext)) { if (WasQualifiedName) S.Diag(InstLoc, - S.getLangOptions().CPlusPlus0x? + S.getLangOpts().CPlusPlus0x? diag::err_explicit_instantiation_out_of_scope : diag::warn_explicit_instantiation_out_of_scope_0x) << D << NS; else S.Diag(InstLoc, - S.getLangOptions().CPlusPlus0x? + S.getLangOpts().CPlusPlus0x? diag::err_explicit_instantiation_unqualified_wrong_namespace : diag::warn_explicit_instantiation_unqualified_wrong_namespace_0x) << D << NS; } else S.Diag(InstLoc, - S.getLangOptions().CPlusPlus0x? + S.getLangOpts().CPlusPlus0x? diag::err_explicit_instantiation_must_be_global : diag::warn_explicit_instantiation_must_be_global_0x) << D; @@ -6367,7 +6367,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, // well. if (D.getDeclSpec().isInlineSpecified()) Diag(D.getDeclSpec().getInlineSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::err_explicit_instantiation_inline : diag::warn_explicit_instantiation_inline_0x) << FixItHint::CreateRemoval(D.getDeclSpec().getInlineSpecLoc()); @@ -6626,7 +6626,7 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, if (TypenameLoc.isValid() && S && !S->getTemplateParamParent()) Diag(TypenameLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_typename_outside_of_template : diag::ext_typename_outside_of_template) << FixItHint::CreateRemoval(TypenameLoc); @@ -6665,7 +6665,7 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation RAngleLoc) { if (TypenameLoc.isValid() && S && !S->getTemplateParamParent()) Diag(TypenameLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_typename_outside_of_template : diag::ext_typename_outside_of_template) << FixItHint::CreateRemoval(TypenameLoc); diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index f6ed7d6af947..1d43b3fd4d52 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1029,7 +1029,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S, // Objective-C ARC: // If template deduction would produce an argument type with lifetime type // but no lifetime qualifier, the __strong lifetime qualifier is inferred. - if (S.getLangOptions().ObjCAutoRefCount && + if (S.getLangOpts().ObjCAutoRefCount && DeducedType->isObjCLifetimeType() && !DeducedQs.hasObjCLifetime()) DeducedQs.setObjCLifetime(Qualifiers::OCL_Strong); @@ -3584,17 +3584,17 @@ static bool isAtLeastAsSpecializedAs(Sema &S, // first argument of the free function or static member, which // seems to match existing practice. SmallVector Args1; - unsigned Skip1 = !S.getLangOptions().CPlusPlus0x && + unsigned Skip1 = !S.getLangOpts().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1; - if (S.getLangOptions().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2) + if (S.getLangOpts().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2) MaybeAddImplicitObjectParameterType(S.Context, Method1, Args1); Args1.insert(Args1.end(), Proto1->arg_type_begin() + Skip1, Proto1->arg_type_end()); SmallVector Args2; - Skip2 = !S.getLangOptions().CPlusPlus0x && + Skip2 = !S.getLangOpts().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2; - if (S.getLangOptions().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) + if (S.getLangOpts().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) MaybeAddImplicitObjectParameterType(S.Context, Method2, Args2); Args2.insert(Args2.end(), Proto2->arg_type_begin() + Skip2, Proto2->arg_type_end()); @@ -3663,7 +3663,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, unsigned NumParams = std::min(NumCallArguments, std::min(Proto1->getNumArgs(), Proto2->getNumArgs())); - if (S.getLangOptions().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) + if (S.getLangOpts().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) ::MarkUsedTemplateParameters(S.Context, Method2->getThisType(S.Context), false, TemplateParams->getDepth(), UsedParameters); diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 073d64407a15..697ac0ecd431 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -404,15 +404,15 @@ bool Sema::InstantiatingTemplate::CheckInstantiationDepth( SemaRef.ActiveTemplateInstantiations.size()); if ((SemaRef.ActiveTemplateInstantiations.size() - SemaRef.NonInstantiationEntries) - <= SemaRef.getLangOptions().InstantiationDepth) + <= SemaRef.getLangOpts().InstantiationDepth) return false; SemaRef.Diag(PointOfInstantiation, diag::err_template_recursion_depth_exceeded) - << SemaRef.getLangOptions().InstantiationDepth + << SemaRef.getLangOpts().InstantiationDepth << InstantiationRange; SemaRef.Diag(PointOfInstantiation, diag::note_template_recursion_depth) - << SemaRef.getLangOptions().InstantiationDepth; + << SemaRef.getLangOpts().InstantiationDepth; return true; } diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 7d2ec16cbacd..56ce50e592cf 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -312,7 +312,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { SemaRef.LookupQualifiedName(Previous, Owner, false); // In ARC, infer 'retaining' for variables of retainable type. - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && SemaRef.inferObjCARCLifetime(Var)) Var->setInvalidDecl(); @@ -1203,7 +1203,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, // // If -Wc++98-compat is enabled, we go through the motions of checking for a // redefinition, but don't instantiate the function. - if ((!SemaRef.getLangOptions().CPlusPlus0x || + if ((!SemaRef.getLangOpts().CPlusPlus0x || SemaRef.Diags.getDiagnosticLevel( diag::warn_cxx98_compat_friend_redefinition, Function->getLocation()) @@ -1214,11 +1214,11 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, if (Function->isDefined(Definition) && Definition->getTemplateSpecializationKind() == TSK_Undeclared) { SemaRef.Diag(Function->getLocation(), - SemaRef.getLangOptions().CPlusPlus0x ? + SemaRef.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_redefinition : diag::err_redefinition) << Function->getDeclName(); SemaRef.Diag(Definition->getLocation(), diag::note_previous_definition); - if (!SemaRef.getLangOptions().CPlusPlus0x) + if (!SemaRef.getLangOpts().CPlusPlus0x) Function->setInvalidDecl(); } // Check for redefinitions due to other instantiations of this or @@ -1230,7 +1230,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, continue; switch (R->getFriendObjectKind()) { case Decl::FOK_None: - if (!SemaRef.getLangOptions().CPlusPlus0x && + if (!SemaRef.getLangOpts().CPlusPlus0x && !queuedInstantiation && R->isUsed(false)) { if (MemberSpecializationInfo *MSInfo = Function->getMemberSpecializationInfo()) { @@ -1249,12 +1249,12 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, = R->getTemplateInstantiationPattern()) if (RPattern->isDefined(RPattern)) { SemaRef.Diag(Function->getLocation(), - SemaRef.getLangOptions().CPlusPlus0x ? + SemaRef.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_redefinition : diag::err_redefinition) << Function->getDeclName(); SemaRef.Diag(R->getLocation(), diag::note_previous_definition); - if (!SemaRef.getLangOptions().CPlusPlus0x) + if (!SemaRef.getLangOpts().CPlusPlus0x) Function->setInvalidDecl(); break; } diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index 9528f4c37473..87c8b4d40e57 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -761,12 +761,12 @@ ExprResult Sema::ActOnSizeofParameterPackExpr(Scope *S, if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, 0, Validator)) { - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); ParameterPack = Corrected.getCorrectionDecl(); Diag(NameLoc, diag::err_sizeof_pack_no_pack_name_suggest) << &Name << CorrectedQuotedStr << FixItHint::CreateReplacement( - NameLoc, Corrected.getAsString(getLangOptions())); + NameLoc, Corrected.getAsString(getLangOpts())); Diag(ParameterPack->getLocation(), diag::note_parameter_pack_here) << CorrectedQuotedStr; } diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 919faa0a3cb7..f1b00e38d73e 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -505,7 +505,7 @@ static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state, break; case AttributeList::AT_ns_returns_retained: - if (!state.getSema().getLangOptions().ObjCAutoRefCount) + if (!state.getSema().getLangOpts().ObjCAutoRefCount) break; // fallthrough @@ -656,7 +656,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // allowed to be completely missing a declspec. This is handled in the // parser already though by it pretending to have seen an 'int' in this // case. - if (S.getLangOptions().ImplicitInt) { + if (S.getLangOpts().ImplicitInt) { // In C89 mode, we only warn if there is a completely missing declspec // when one is not allowed. if (DS.isEmpty()) { @@ -670,8 +670,8 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // specifiers in each declaration, and in the specifier-qualifier list in // each struct declaration and type name." // FIXME: Does Microsoft really have the implicit int extension in C++? - if (S.getLangOptions().CPlusPlus && - !S.getLangOptions().MicrosoftExt) { + if (S.getLangOpts().CPlusPlus && + !S.getLangOpts().MicrosoftExt) { S.Diag(DeclLoc, diag::err_missing_type_specifier) << DS.getSourceRange(); @@ -696,9 +696,9 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.LongLongTy; // long long is a C99 feature. - if (!S.getLangOptions().C99) + if (!S.getLangOpts().C99) S.Diag(DS.getTypeSpecWidthLoc(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_longlong : diag::ext_longlong); break; } @@ -711,9 +711,9 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.UnsignedLongLongTy; // long long is a C99 feature. - if (!S.getLangOptions().C99) + if (!S.getLangOpts().C99) S.Diag(DS.getTypeSpecWidthLoc(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_longlong : diag::ext_longlong); break; } @@ -728,7 +728,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { else Result = Context.DoubleTy; - if (S.getLangOptions().OpenCL && !S.getOpenCLOptions().cl_khr_fp64) { + if (S.getLangOpts().OpenCL && !S.getOpenCLOptions().cl_khr_fp64) { S.Diag(DS.getTypeSpecTypeLoc(), diag::err_double_requires_fp64); declarator.setInvalidType(true); } @@ -881,7 +881,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // Handle complex types. if (DS.getTypeSpecComplex() == DeclSpec::TSC_complex) { - if (S.getLangOptions().Freestanding) + if (S.getLangOpts().Freestanding) S.Diag(DS.getTypeSpecComplexLoc(), diag::ext_freestanding_complex); Result = Context.getComplexType(Result); } else if (DS.isTypeAltiVecVector()) { @@ -1108,7 +1108,7 @@ QualType Sema::BuildPointerType(QualType T, assert(!T->isObjCObjectType() && "Should build ObjCObjectPointerType"); // In ARC, it is forbidden to build pointers to unqualified pointers. - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) T = inferARCLifetimeForPointee(*this, T, Loc, /*reference*/ false); // Build the pointer type. @@ -1165,7 +1165,7 @@ QualType Sema::BuildReferenceType(QualType T, bool SpelledAsLValue, } // In ARC, it is forbidden to build references to unqualified pointers. - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) T = inferARCLifetimeForPointee(*this, T, Loc, /*reference*/ true); // Handle restrict on references. @@ -1207,7 +1207,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, SourceRange Brackets, DeclarationName Entity) { SourceLocation Loc = Brackets.getBegin(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++ [dcl.array]p1: // T is called the array element type; this type shall not be a reference // type, the (possibly cv-qualified) type void, a function type or an @@ -1277,7 +1277,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, // C99 6.7.5.2p1: The size expression shall have integer type. // C++11 allows contextual conversions to such types. - if (!getLangOptions().CPlusPlus0x && + if (!getLangOpts().CPlusPlus0x && ArraySize && !ArraySize->isTypeDependent() && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) @@ -1298,7 +1298,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, isArraySizeVLA(*this, ArraySize, ConstVal)) { // Even in C++11, don't allow contextual conversions in the array bound // of a VLA. - if (getLangOptions().CPlusPlus0x && + if (getLangOpts().CPlusPlus0x && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) << ArraySize->getType() << ArraySize->getSourceRange(); @@ -1349,7 +1349,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, T = Context.getConstantArrayType(T, ConstVal, ASM, Quals); } // If this is not C99, extwarn about VLA's and C99 array size modifiers. - if (!getLangOptions().C99) { + if (!getLangOpts().C99) { if (T->isVariableArrayType()) { // Prohibit the use of non-POD types in VLAs. QualType BaseT = Context.getBaseElementType(T); @@ -1370,7 +1370,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Diag(Loc, diag::ext_vla); } else if (ASM != ArrayType::Normal || Quals != 0) Diag(Loc, - getLangOptions().CPlusPlus? diag::err_c99_array_usage_cxx + getLangOpts().CPlusPlus? diag::err_c99_array_usage_cxx : diag::ext_c99_array_usage) << ASM; } @@ -1792,7 +1792,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, // type (this is checked later) and we can skip this. In other languages // using auto, we need to check regardless. if (D.getDeclSpec().getTypeSpecType() == DeclSpec::TST_auto && - (!SemaRef.getLangOptions().CPlusPlus0x || !D.isFunctionDeclarator())) { + (!SemaRef.getLangOpts().CPlusPlus0x || !D.isFunctionDeclarator())) { int Error = -1; switch (D.getContext()) { @@ -1854,7 +1854,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, // contains a trailing return type. That is only legal at the outermost // level. Check all declarator chunks (outermost first) anyway, to give // better diagnostics. - if (SemaRef.getLangOptions().CPlusPlus0x && Error != -1) { + if (SemaRef.getLangOpts().CPlusPlus0x && Error != -1) { for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { unsigned chunkIndex = e - i - 1; state.setCurrentChunkIndex(chunkIndex); @@ -1880,7 +1880,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, diag::warn_cxx98_compat_auto_type_specifier); } - if (SemaRef.getLangOptions().CPlusPlus && + if (SemaRef.getLangOpts().CPlusPlus && OwnedTagDecl && OwnedTagDecl->isCompleteDefinition()) { // Check the contexts where C++ forbids the declaration of a new class // or enumeration in a type-specifier-seq. @@ -2003,7 +2003,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, Declarator &D = state.getDeclarator(); Sema &S = state.getSema(); ASTContext &Context = S.Context; - const LangOptions &LangOpts = S.getLangOptions(); + const LangOptions &LangOpts = S.getLangOpts(); bool ImplicitlyNoexcept = false; if (D.getName().getKind() == UnqualifiedId::IK_OperatorFunctionId && @@ -2639,7 +2639,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { if (T.isNull()) return Context.getNullTypeSourceInfo(); - if (D.isPrototypeContext() && getLangOptions().ObjCAutoRefCount) + if (D.isPrototypeContext() && getLangOpts().ObjCAutoRefCount) inferARCWriteback(state, T); return GetFullTypeForDeclarator(state, T, ReturnTypeInfo); @@ -2750,7 +2750,7 @@ TypeSourceInfo *Sema::GetTypeForDeclaratorCast(Declarator &D, QualType FromTy) { if (declSpecTy.isNull()) return Context.getNullTypeSourceInfo(); - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { Qualifiers::ObjCLifetime ownership = Context.getInnerObjCOwnership(FromTy); if (ownership != Qualifiers::OCL_None) transferARCOwnership(state, declSpecTy, ownership); @@ -3171,7 +3171,7 @@ TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) { if (D.getContext() != Declarator::ObjCParameterContext) checkUnusedDeclAttributes(D); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -3319,7 +3319,7 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, // Consume lifetime attributes without further comment outside of // ARC mode. - if (!S.getLangOptions().ObjCAutoRefCount) + if (!S.getLangOpts().ObjCAutoRefCount) return true; Qualifiers::ObjCLifetime lifetime; @@ -3390,7 +3390,7 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, // Forbid __weak if the runtime doesn't support it. if (lifetime == Qualifiers::OCL_Weak && - !S.getLangOptions().ObjCRuntimeHasWeak && !NonObjCPointer) { + !S.getLangOpts().ObjCRuntimeHasWeak && !NonObjCPointer) { // Actually, delay this until we know what we're parsing. if (S.DelayedDiagnostics.shouldDelayDiagnostics()) { @@ -3637,7 +3637,7 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, // ns_returns_retained is not always a type attribute, but if we got // here, we're treating it as one right now. if (attr.getKind() == AttributeList::AT_ns_returns_retained) { - assert(S.getLangOptions().ObjCAutoRefCount && + assert(S.getLangOpts().ObjCAutoRefCount && "ns_returns_retained treated as type attribute in non-ARC"); if (attr.getNumArgs()) return true; @@ -3980,7 +3980,7 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type, break; case AttributeList::AT_ns_returns_retained: - if (!state.getSema().getLangOptions().ObjCAutoRefCount) + if (!state.getSema().getLangOpts().ObjCAutoRefCount) break; // fallthrough into the function attrs diff --git a/clang/lib/Sema/TargetAttributesSema.cpp b/clang/lib/Sema/TargetAttributesSema.cpp index aa0bc08ef7f4..8b19be74dd43 100644 --- a/clang/lib/Sema/TargetAttributesSema.cpp +++ b/clang/lib/Sema/TargetAttributesSema.cpp @@ -169,7 +169,7 @@ static void HandleDLLImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { // Apparently Visual C++ thinks it is okay to not emit a warning // in this case, so only emit a warning when -fms-extensions is not // specified. - if (!S.getLangOptions().MicrosoftExt) + if (!S.getLangOpts().MicrosoftExt) S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << Attr.getName() << 2 /*variable and function*/; return; diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 9bb51b4124fb..16cfc3b2e361 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -2716,7 +2716,7 @@ TreeTransform::TransformNestedNameSpecifierLoc( return NestedNameSpecifierLoc(); if (TL.getType()->isDependentType() || TL.getType()->isRecordType() || - (SemaRef.getLangOptions().CPlusPlus0x && + (SemaRef.getLangOpts().CPlusPlus0x && TL.getType()->isEnumeralType())) { assert(!TL.getType().hasLocalQualifiers() && "Can't get cv-qualifiers here"); diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 03f3e278db7f..4c6c9dc524c4 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -64,7 +64,7 @@ ASTReaderListener::~ASTReaderListener() {} bool PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) { - const LangOptions &PPLangOpts = PP.getLangOptions(); + const LangOptions &PPLangOpts = PP.getLangOpts(); #define LANGOPT(Name, Bits, Default, Description) \ if (PPLangOpts.Name != LangOpts.Name) { \ @@ -1615,7 +1615,7 @@ namespace { void ASTReader::updateOutOfDateIdentifier(IdentifierInfo &II) { unsigned PriorGeneration = 0; - if (getContext().getLangOptions().Modules) + if (getContext().getLangOpts().Modules) PriorGeneration = IdentifierGeneration[&II]; IdentifierLookupVisitor Visitor(II.getName(), PriorGeneration); @@ -1630,7 +1630,7 @@ void ASTReader::markIdentifierUpToDate(IdentifierInfo *II) { II->setOutOfDate(false); // Update the generation for this identifier. - if (getContext().getLangOptions().Modules) + if (getContext().getLangOpts().Modules) IdentifierGeneration[II] = CurrentGeneration; } @@ -3321,7 +3321,7 @@ ASTReader::ASTReadResult ASTReader::ReadSubmoduleBlock(ModuleFile &F) { break; CurrentModule->addRequirement(StringRef(BlobStart, BlobLen), - Context.getLangOptions(), + Context.getLangOpts(), Context.getTargetInfo()); break; } diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index bf22bc89d852..8a65538fce21 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1534,7 +1534,7 @@ template void ASTDeclReader::mergeRedeclarable(Redeclarable *D, RedeclarableResult &Redecl) { // If modules are not available, there is no reason to perform this merge. - if (!Reader.getContext().getLangOptions().Modules) + if (!Reader.getContext().getLangOpts().Modules) return; if (FindExistingResult ExistingRes = findExisting(static_cast(D))) { diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index f457393dcf0e..cb3206844260 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -2789,7 +2789,7 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context, // IdentifierInfo chains, don't bother to build a visible-declarations table. // FIXME: In C++ we need the visible declarations in order to "see" the // friend declarations, is there a way to do this without writing the table ? - if (DC->isTranslationUnit() && !Context.getLangOptions().CPlusPlus) + if (DC->isTranslationUnit() && !Context.getLangOpts().CPlusPlus) return 0; // Force the DeclContext to build a its name-lookup table. @@ -2914,7 +2914,7 @@ void ASTWriter::WriteFPPragmaOptions(const FPOptions &Opts) { /// \brief Write an OPENCL_EXTENSIONS block for the given OpenCLOptions. void ASTWriter::WriteOpenCLExtensions(Sema &SemaRef) { - if (!SemaRef.Context.getLangOptions().OpenCL) + if (!SemaRef.Context.getLangOpts().OpenCL) return; const OpenCLOptions &Opts = SemaRef.getOpenCLOptions(); @@ -3222,7 +3222,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, IdentifierTable &Table = PP.getIdentifierTable(); SmallVector BuiltinNames; Context.BuiltinInfo.GetBuiltinNames(BuiltinNames, - Context.getLangOptions().NoBuiltin); + Context.getLangOpts().NoBuiltin); for (unsigned I = 0, N = BuiltinNames.size(); I != N; ++I) getIdentifierRef(&Table.get(BuiltinNames[I])); } @@ -3336,7 +3336,7 @@ void ASTWriter::WriteASTCore(Sema &SemaRef, MemorizeStatCalls *StatCalls, RecordData Record; Stream.EnterSubblock(AST_BLOCK_ID, 5); WriteMetadata(Context, isysroot, OutputFile); - WriteLanguageOptions(Context.getLangOptions()); + WriteLanguageOptions(Context.getLangOpts()); if (StatCalls && isysroot.empty()) WriteStatCache(*StatCalls); diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp index 07383317c0e4..257dcca413c3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -278,9 +278,9 @@ class ObjCDeallocChecker : public Checker< public: void checkASTDecl(const ObjCImplementationDecl *D, AnalysisManager& mgr, BugReporter &BR) const { - if (mgr.getLangOptions().getGC() == LangOptions::GCOnly) + if (mgr.getLangOpts().getGC() == LangOptions::GCOnly) return; - checkObjCDealloc(cast(D), mgr.getLangOptions(), BR); + checkObjCDealloc(cast(D), mgr.getLangOpts(), BR); } }; } diff --git a/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp b/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp index 900c30554375..34053cdad638 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp @@ -74,7 +74,7 @@ public: void checkASTCodeBody(const Decl *D, AnalysisManager& mgr, BugReporter &BR) const { if (CFG *cfg = mgr.getCFG(D)) { - cfg->viewCFG(mgr.getLangOptions()); + cfg->viewCFG(mgr.getLangOpts()); } } }; @@ -94,7 +94,7 @@ public: void checkASTCodeBody(const Decl *D, AnalysisManager& mgr, BugReporter &BR) const { if (CFG *cfg = mgr.getCFG(D)) { - cfg->dump(mgr.getLangOptions(), + cfg->dump(mgr.getLangOpts(), llvm::sys::Process::StandardErrHasColors()); } } diff --git a/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp index 1da3bd7de224..4989ba88680e 100644 --- a/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp @@ -84,6 +84,6 @@ void NSAutoreleasePoolChecker::checkPreObjCMessage(ObjCMessage msg, } void ento::registerNSAutoreleasePoolChecker(CheckerManager &mgr) { - if (mgr.getLangOptions().getGC() != LangOptions::NonGC) + if (mgr.getLangOpts().getGC() != LangOptions::NonGC) mgr.registerChecker(); } diff --git a/clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp index 25caf98b6d51..777e9ea219b3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp @@ -91,6 +91,6 @@ void ObjCAtSyncChecker::checkPreStmt(const ObjCAtSynchronizedStmt *S, } void ento::registerObjCAtSyncChecker(CheckerManager &mgr) { - if (mgr.getLangOptions().ObjC2) + if (mgr.getLangOpts().ObjC2) mgr.registerChecker(); } diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index a5146b7cb2f0..e01db9508f72 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2448,7 +2448,7 @@ public: bool GCEnabled) const { // FIXME: We don't support ARC being turned on and off during one analysis. // (nor, for that matter, do we support changing ASTContexts) - bool ARCEnabled = (bool)Ctx.getLangOptions().ObjCAutoRefCount; + bool ARCEnabled = (bool)Ctx.getLangOpts().ObjCAutoRefCount; if (GCEnabled) { if (!SummariesGC) SummariesGC.reset(new RetainSummaryManager(Ctx, true, ARCEnabled)); @@ -2911,7 +2911,7 @@ RetainCountChecker::updateSymbol(ProgramStateRef state, SymbolRef sym, // In ARC mode they shouldn't exist at all, but we just ignore them. bool IgnoreRetainMsg = C.isObjCGCEnabled(); if (!IgnoreRetainMsg) - IgnoreRetainMsg = (bool)C.getASTContext().getLangOptions().ObjCAutoRefCount; + IgnoreRetainMsg = (bool)C.getASTContext().getLangOpts().ObjCAutoRefCount; switch (E) { default: break; @@ -3076,7 +3076,7 @@ void RetainCountChecker::processNonLeakError(ProgramStateRef St, } assert(BT); - CFRefReport *report = new CFRefReport(*BT, C.getASTContext().getLangOptions(), + CFRefReport *report = new CFRefReport(*BT, C.getASTContext().getLangOpts(), C.isObjCGCEnabled(), SummaryLog, N, Sym); report->addRange(ErrorRange); @@ -3308,7 +3308,7 @@ void RetainCountChecker::checkReturnWithRetEffect(const ReturnStmt *S, ReturnOwnLeakTag("RetainCountChecker : ReturnsOwnLeak"); ExplodedNode *N = C.addTransition(state, Pred, &ReturnOwnLeakTag); if (N) { - const LangOptions &LOpts = C.getASTContext().getLangOptions(); + const LangOptions &LOpts = C.getASTContext().getLangOpts(); bool GCEnabled = C.isObjCGCEnabled(); CFRefReport *report = new CFRefLeakReport(*getLeakAtReturnBug(LOpts, GCEnabled), @@ -3333,7 +3333,7 @@ void RetainCountChecker::checkReturnWithRetEffect(const ReturnStmt *S, CFRefReport *report = new CFRefReport(*returnNotOwnedForOwned, - C.getASTContext().getLangOptions(), + C.getASTContext().getLangOpts(), C.isObjCGCEnabled(), SummaryLog, N, Sym); C.EmitReport(report); } @@ -3499,7 +3499,7 @@ RetainCountChecker::handleAutoreleaseCounts(ProgramStateRef state, if (!overAutorelease) overAutorelease.reset(new OverAutorelease()); - const LangOptions &LOpts = Ctx.getASTContext().getLangOptions(); + const LangOptions &LOpts = Ctx.getASTContext().getLangOpts(); CFRefReport *report = new CFRefReport(*overAutorelease, LOpts, /* GCEnabled = */ false, SummaryLog, N, Sym, os.str()); @@ -3542,7 +3542,7 @@ RetainCountChecker::processLeaks(ProgramStateRef state, for (SmallVectorImpl::iterator I = Leaked.begin(), E = Leaked.end(); I != E; ++I) { - const LangOptions &LOpts = Ctx.getASTContext().getLangOptions(); + const LangOptions &LOpts = Ctx.getASTContext().getLangOpts(); bool GCEnabled = Ctx.isObjCGCEnabled(); CFRefBug *BT = Pred ? getLeakWithinFunctionBug(LOpts, GCEnabled) : getLeakAtReturnBug(LOpts, GCEnabled); diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index 8c76cc523d63..54cf5690c9ea 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -137,7 +137,7 @@ void StackAddrEscapeChecker::checkPreStmt(const ReturnStmt *RS, return; // Automatic reference counting automatically copies blocks. - if (C.getASTContext().getLangOptions().ObjCAutoRefCount && + if (C.getASTContext().getLangOpts().ObjCAutoRefCount && isa(R)) return; @@ -173,7 +173,7 @@ void StackAddrEscapeChecker::checkEndPath(CheckerContext &Ctx) const { // Under automated retain release, it is okay to assign a block // directly to a global variable. - if (Ctx.getASTContext().getLangOptions().ObjCAutoRefCount && + if (Ctx.getASTContext().getLangOpts().ObjCAutoRefCount && isa(vR)) return true; diff --git a/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp b/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp index 821b1fbbe4b9..139bc88de9f2 100644 --- a/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp @@ -35,7 +35,7 @@ AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags, unsigned inlineMaxFunctionSize, AnalysisInliningMode IMode) : AnaCtxMgr(useUnoptimizedCFG, addImplicitDtors, addInitializers), - Ctx(ctx), Diags(diags), LangInfo(lang), PD(pd), + Ctx(ctx), Diags(diags), LangOpts(lang), PD(pd), CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr), CheckerMgr(checkerMgr), Idxer(idxer), AScope(ScopeDecl), MaxNodes(maxnodes), MaxVisit(maxvisit), @@ -56,7 +56,7 @@ AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags, ParentAM.AnaCtxMgr.getCFGBuildOptions().AddImplicitDtors, ParentAM.AnaCtxMgr.getCFGBuildOptions().AddInitializers), Ctx(ctx), Diags(diags), - LangInfo(ParentAM.LangInfo), PD(ParentAM.getPathDiagnosticConsumer()), + LangOpts(ParentAM.LangOpts), PD(ParentAM.getPathDiagnosticConsumer()), CreateStoreMgr(ParentAM.CreateStoreMgr), CreateConstraintMgr(ParentAM.CreateConstraintMgr), CheckerMgr(ParentAM.CheckerMgr), diff --git a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp index 19942b85909e..0a047d922aa9 100644 --- a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp +++ b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp @@ -76,8 +76,8 @@ bool CheckerContext::isCLibraryFunction(const FunctionDecl *FD, StringRef CheckerContext::getMacroNameOrSpelling(SourceLocation &Loc) { if (Loc.isMacroID()) return Lexer::getImmediateMacroName(Loc, getSourceManager(), - getLangOptions()); + getLangOpts()); SmallVector buf; - return Lexer::getSpelling(Loc, buf, getSourceManager(), getLangOptions()); + return Lexer::getSpelling(Loc, buf, getSourceManager(), getLangOpts()); } diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp index e06e71699f2a..f277a2eaacb9 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -366,7 +366,7 @@ void ExprEngine::VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred, // We bound the temp obj region to the CXXConstructExpr. Now recover // the lazy compound value when the variable is not a reference. - if (AMgr.getLangOptions().CPlusPlus && VD->getType()->isRecordType() && + if (AMgr.getLangOpts().CPlusPlus && VD->getType()->isRecordType() && !VD->getType()->isReferenceType() && isa(InitVal)){ InitVal = state->getSVal(cast(InitVal).getRegion()); assert(isa(InitVal)); diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index 09c2f794d647..629f1eab4356 100644 --- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -164,7 +164,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D, assert(!FID.isInvalid()); // Create a new rewriter to generate HTML. - Rewriter R(const_cast(SMgr), PP.getLangOptions()); + Rewriter R(const_cast(SMgr), PP.getLangOpts()); // Process the path. unsigned n = path.size(); @@ -442,7 +442,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, assert(L.isFileID()); StringRef BufferInfo = L.getBufferData(); const char* MacroName = L.getDecomposedLoc().second + BufferInfo.data(); - Lexer rawLexer(L, PP.getLangOptions(), BufferInfo.begin(), + Lexer rawLexer(L, PP.getLangOpts(), BufferInfo.begin(), MacroName, BufferInfo.end()); Token TheTok; diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index d63ec94c2999..501fd41cdfa3 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -491,11 +491,11 @@ void ObjCIvarRegion::dumpToStream(raw_ostream &os) const { } void StringRegion::dumpToStream(raw_ostream &os) const { - Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOptions())); + Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOpts())); } void ObjCStringRegion::dumpToStream(raw_ostream &os) const { - Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOptions())); + Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOpts())); } void SymbolicRegion::dumpToStream(raw_ostream &os) const { diff --git a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp index 2c8270a2dd15..cce75ad5554e 100644 --- a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -60,7 +60,7 @@ PlistDiagnostics::PlistDiagnostics(const std::string& output, PathDiagnosticConsumer* ento::createPlistDiagnosticConsumer(const std::string& s, const Preprocessor &PP, PathDiagnosticConsumer *subPD) { - return new PlistDiagnostics(s, PP.getLangOptions(), subPD); + return new PlistDiagnostics(s, PP.getLangOpts(), subPD); } PathDiagnosticConsumer::PathGenerationScheme diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 51761fb1512b..7fd26894f242 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -165,10 +165,10 @@ public: virtual void Initialize(ASTContext &Context) { Ctx = &Context; - checkerMgr.reset(createCheckerManager(Opts, PP.getLangOptions(), Plugins, + checkerMgr.reset(createCheckerManager(Opts, PP.getLangOpts(), Plugins, PP.getDiagnostics())); Mgr.reset(new AnalysisManager(*Ctx, PP.getDiagnostics(), - PP.getLangOptions(), PD, + PP.getLangOpts(), PD, CreateStoreMgr, CreateConstraintMgr, checkerMgr.get(), /* Indexer */ 0, @@ -457,7 +457,7 @@ void AnalysisConsumer::ActionExprEngine(Decl *D, bool ObjCGCEnabled, void AnalysisConsumer::RunPathSensitiveChecks(Decl *D, SetOfDecls *Visited) { - switch (Mgr->getLangOptions().getGC()) { + switch (Mgr->getLangOpts().getGC()) { case LangOptions::NonGC: ActionExprEngine(D, false, Visited); break; diff --git a/clang/tools/arcmt-test/arcmt-test.cpp b/clang/tools/arcmt-test/arcmt-test.cpp index 2dc8034e329b..3983c249022e 100644 --- a/clang/tools/arcmt-test/arcmt-test.cpp +++ b/clang/tools/arcmt-test/arcmt-test.cpp @@ -318,7 +318,7 @@ static void printSourceLocation(SourceLocation loc, ASTContext &Ctx, static void printSourceRange(CharSourceRange range, ASTContext &Ctx, raw_ostream &OS) { SourceManager &SM = Ctx.getSourceManager(); - const LangOptions &langOpts = Ctx.getLangOptions(); + const LangOptions &langOpts = Ctx.getLangOpts(); PresumedLoc PL = SM.getPresumedLoc(range.getBegin()); diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 92c9fde041cf..52a7cd6a5dd9 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2586,7 +2586,7 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { for (ASTUnit::stored_diag_iterator D = Unit->stored_diag_begin(), DEnd = Unit->stored_diag_end(); D != DEnd; ++D) { - CXStoredDiagnostic Diag(*D, Unit->getASTContext().getLangOptions()); + CXStoredDiagnostic Diag(*D, Unit->getASTContext().getLangOpts()); CXString Msg = clang_formatDiagnostic(&Diag, clang_defaultDiagnosticDisplayOptions()); fprintf(stderr, "%s\n", clang_getCString(Msg)); @@ -3782,7 +3782,7 @@ CXCursor cxcursor::getCursor(CXTranslationUnit TU, SourceLocation SLoc) { // Translate the given source location to make it point at the beginning of // the token under the cursor. SLoc = Lexer::GetBeginningOfToken(SLoc, CXXUnit->getSourceManager(), - CXXUnit->getASTContext().getLangOptions()); + CXXUnit->getASTContext().getLangOpts()); CXCursor Result = MakeCXCursorInvalid(CXCursor_NoDeclFound); if (SLoc.isValid()) { @@ -4487,7 +4487,7 @@ static void getTokens(ASTUnit *CXXUnit, SourceRange Range, return; Lexer Lex(SourceMgr.getLocForStartOfFile(BeginLocInfo.first), - CXXUnit->getASTContext().getLangOptions(), + CXXUnit->getASTContext().getLangOpts(), Buffer.begin(), Buffer.data() + BeginLocInfo.second, Buffer.end()); Lex.SetCommentRetentionState(true); @@ -5020,7 +5020,7 @@ static void annotatePreprocessorTokens(CXTranslationUnit TU, return; Lexer Lex(SourceMgr.getLocForStartOfFile(BeginLocInfo.first), - CXXUnit->getASTContext().getLangOptions(), + CXXUnit->getASTContext().getLangOpts(), Buffer.begin(), Buffer.data() + BeginLocInfo.second, Buffer.end()); Lex.SetCommentRetentionState(true); diff --git a/clang/tools/libclang/CIndexCodeCompletion.cpp b/clang/tools/libclang/CIndexCodeCompletion.cpp index caf8fe7fd140..10f24113207d 100644 --- a/clang/tools/libclang/CIndexCodeCompletion.cpp +++ b/clang/tools/libclang/CIndexCodeCompletion.cpp @@ -332,7 +332,7 @@ static unsigned long long getContextsForContextKind( case CodeCompletionContext::CCC_Type: { contexts = CXCompletionContext_AnyType | CXCompletionContext_ObjCInterface; - if (S.getLangOptions().CPlusPlus) { + if (S.getLangOpts().CPlusPlus) { contexts |= CXCompletionContext_EnumTag | CXCompletionContext_UnionTag | CXCompletionContext_StructTag | @@ -345,7 +345,7 @@ static unsigned long long getContextsForContextKind( contexts = CXCompletionContext_AnyType | CXCompletionContext_ObjCInterface | CXCompletionContext_AnyValue; - if (S.getLangOptions().CPlusPlus) { + if (S.getLangOpts().CPlusPlus) { contexts |= CXCompletionContext_EnumTag | CXCompletionContext_UnionTag | CXCompletionContext_StructTag | @@ -356,7 +356,7 @@ static unsigned long long getContextsForContextKind( } case CodeCompletionContext::CCC_Expression: { contexts = CXCompletionContext_AnyValue; - if (S.getLangOptions().CPlusPlus) { + if (S.getLangOpts().CPlusPlus) { contexts |= CXCompletionContext_AnyType | CXCompletionContext_ObjCInterface | CXCompletionContext_EnumTag | @@ -371,7 +371,7 @@ static unsigned long long getContextsForContextKind( contexts = CXCompletionContext_ObjCObjectValue | CXCompletionContext_ObjCSelectorValue | CXCompletionContext_ObjCInterface; - if (S.getLangOptions().CPlusPlus) { + if (S.getLangOpts().CPlusPlus) { contexts |= CXCompletionContext_CXXClassTypeValue | CXCompletionContext_AnyType | CXCompletionContext_EnumTag | @@ -438,7 +438,7 @@ static unsigned long long getContextsForContextKind( contexts = CXCompletionContext_AnyType | CXCompletionContext_ObjCInterface | CXCompletionContext_AnyValue; - if (S.getLangOptions().CPlusPlus) { + if (S.getLangOpts().CPlusPlus) { contexts |= CXCompletionContext_EnumTag | CXCompletionContext_UnionTag | CXCompletionContext_StructTag | diff --git a/clang/tools/libclang/CIndexDiagnostic.cpp b/clang/tools/libclang/CIndexDiagnostic.cpp index 24a2652f7f57..67aa77027fa9 100644 --- a/clang/tools/libclang/CIndexDiagnostic.cpp +++ b/clang/tools/libclang/CIndexDiagnostic.cpp @@ -180,7 +180,7 @@ CXDiagnosticSetImpl *cxdiag::lazyCreateDiags(CXTranslationUnit TU, TU->Diagnostics = Set; DiagnosticOptions DOpts; CXDiagnosticRenderer Renderer(AU->getSourceManager(), - AU->getASTContext().getLangOptions(), + AU->getASTContext().getLangOpts(), DOpts, Set); for (ASTUnit::stored_diag_iterator it = AU->stored_diag_begin(), diff --git a/clang/tools/libclang/CIndexUSRs.cpp b/clang/tools/libclang/CIndexUSRs.cpp index 8cd549bae842..7c79b69315dd 100644 --- a/clang/tools/libclang/CIndexUSRs.cpp +++ b/clang/tools/libclang/CIndexUSRs.cpp @@ -194,7 +194,7 @@ void USRGenerator::VisitFunctionDecl(FunctionDecl *D) { D->printName(Out); ASTContext &Ctx = *Context; - if (!Ctx.getLangOptions().CPlusPlus || D->isExternC()) + if (!Ctx.getLangOpts().CPlusPlus || D->isExternC()) return; if (const TemplateArgumentList * diff --git a/clang/tools/libclang/CXSourceLocation.h b/clang/tools/libclang/CXSourceLocation.h index 7a502059634a..6c5e858aaae7 100644 --- a/clang/tools/libclang/CXSourceLocation.h +++ b/clang/tools/libclang/CXSourceLocation.h @@ -41,7 +41,7 @@ translateSourceLocation(const SourceManager &SM, const LangOptions &LangOpts, static inline CXSourceLocation translateSourceLocation(ASTContext &Context, SourceLocation Loc) { return translateSourceLocation(Context.getSourceManager(), - Context.getLangOptions(), + Context.getLangOpts(), Loc); } @@ -59,7 +59,7 @@ CXSourceRange translateSourceRange(const SourceManager &SM, static inline CXSourceRange translateSourceRange(ASTContext &Context, SourceRange R) { return translateSourceRange(Context.getSourceManager(), - Context.getLangOptions(), + Context.getLangOpts(), CharSourceRange::getTokenRange(R)); }