Date: Thu, 5 Nov 2009 17:18:10 +0000 (UTC) From: Roman Divacky <rdivacky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r198954 - in vendor/clang/dist: include/clang/AST include/clang/Analysis include/clang/Analysis/PathSensitive include/clang/Analysis/PathSensitive/Checkers include/clang/Basic include/c... Message-ID: <200911051718.nA5HIAua084802@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rdivacky Date: Thu Nov 5 17:18:09 2009 New Revision: 198954 URL: http://svn.freebsd.org/changeset/base/198954 Log: Update clang to r86140. Added: vendor/clang/dist/test/SemaCXX/compare.cpp Modified: vendor/clang/dist/include/clang/AST/ASTConsumer.h vendor/clang/dist/include/clang/Analysis/PathDiagnostic.h vendor/clang/dist/include/clang/Analysis/PathSensitive/AnalysisManager.h vendor/clang/dist/include/clang/Analysis/PathSensitive/BugType.h vendor/clang/dist/include/clang/Analysis/PathSensitive/Checker.h vendor/clang/dist/include/clang/Analysis/PathSensitive/Checkers/UndefinedAssignmentChecker.h vendor/clang/dist/include/clang/Analysis/PathSensitive/GRExprEngine.h vendor/clang/dist/include/clang/Basic/Diagnostic.h vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Frontend/ASTConsumers.h vendor/clang/dist/include/clang/Frontend/AnalysisConsumer.h vendor/clang/dist/include/clang/Frontend/InitPreprocessor.h vendor/clang/dist/include/clang/Frontend/PathDiagnosticClients.h vendor/clang/dist/include/clang/Frontend/TextDiagnosticPrinter.h vendor/clang/dist/include/clang/Frontend/Utils.h vendor/clang/dist/include/clang/Lex/Preprocessor.h vendor/clang/dist/include/clang/Parse/Action.h vendor/clang/dist/include/clang/Parse/DeclSpec.h vendor/clang/dist/include/clang/Parse/Parser.h vendor/clang/dist/include/clang/Rewrite/HTMLRewrite.h vendor/clang/dist/lib/AST/ASTContext.cpp vendor/clang/dist/lib/AST/DeclarationName.cpp vendor/clang/dist/lib/AST/RecordLayoutBuilder.cpp vendor/clang/dist/lib/AST/RecordLayoutBuilder.h vendor/clang/dist/lib/AST/Type.cpp vendor/clang/dist/lib/Analysis/GRExprEngine.cpp vendor/clang/dist/lib/Analysis/UndefinedAssignmentChecker.cpp vendor/clang/dist/lib/Analysis/VLASizeChecker.cpp vendor/clang/dist/lib/CodeGen/CGCXX.cpp vendor/clang/dist/lib/CodeGen/CGDecl.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/Frontend/AnalysisConsumer.cpp vendor/clang/dist/lib/Frontend/HTMLDiagnostics.cpp vendor/clang/dist/lib/Frontend/HTMLPrint.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Frontend/PlistDiagnostics.cpp vendor/clang/dist/lib/Frontend/TextDiagnosticPrinter.cpp vendor/clang/dist/lib/Headers/stdint.h vendor/clang/dist/lib/Lex/Preprocessor.cpp vendor/clang/dist/lib/Parse/DeclSpec.cpp vendor/clang/dist/lib/Parse/MinimalAction.cpp vendor/clang/dist/lib/Parse/ParseDecl.cpp vendor/clang/dist/lib/Parse/ParseDeclCXX.cpp vendor/clang/dist/lib/Parse/ParseExprCXX.cpp vendor/clang/dist/lib/Parse/ParseTemplate.cpp vendor/clang/dist/lib/Parse/ParseTentative.cpp vendor/clang/dist/lib/Rewrite/HTMLRewrite.cpp vendor/clang/dist/lib/Sema/Sema.h vendor/clang/dist/lib/Sema/SemaCXXCast.cpp vendor/clang/dist/lib/Sema/SemaCXXScopeSpec.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaExprCXX.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaTemplate.cpp vendor/clang/dist/lib/Sema/SemaType.cpp vendor/clang/dist/lib/Sema/TreeTransform.h vendor/clang/dist/test/Analysis/misc-ps.m vendor/clang/dist/test/CMakeLists.txt vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p5-cxx0x.cpp vendor/clang/dist/test/CodeGenCXX/array-construction.cpp vendor/clang/dist/test/CodeGenCXX/ptr-to-datamember.cpp vendor/clang/dist/test/CodeGenCXX/ptr-to-member-function.cpp vendor/clang/dist/test/CodeGenCXX/virt.cpp vendor/clang/dist/test/Coverage/html-diagnostics.c vendor/clang/dist/test/Frontend/dependency-gen.c vendor/clang/dist/test/Makefile vendor/clang/dist/test/Parser/if-scope-c90.c vendor/clang/dist/test/Parser/if-scope-c99.c vendor/clang/dist/test/Preprocessor/stdint.c vendor/clang/dist/test/Sema/compare.c vendor/clang/dist/test/Sema/conditional-expr.c vendor/clang/dist/test/SemaCXX/conditional-expr.cpp vendor/clang/dist/test/SemaCXX/constructor-initializer.cpp vendor/clang/dist/test/SemaCXX/overload-member-call.cpp vendor/clang/dist/test/SemaCXX/overloaded-operator.cpp vendor/clang/dist/test/SemaCXX/primary-base.cpp vendor/clang/dist/test/SemaTemplate/example-dynarray.cpp vendor/clang/dist/test/SemaTemplate/instantiate-complete.cpp vendor/clang/dist/test/SemaTemplate/instantiate-deeply.cpp vendor/clang/dist/test/SemaTemplate/instantiate-expr-1.cpp vendor/clang/dist/test/SemaTemplate/member-access-expr.cpp vendor/clang/dist/test/SemaTemplate/member-template-access-expr.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp vendor/clang/dist/test/SemaTemplate/template-id-expr.cpp vendor/clang/dist/test/lit.cfg vendor/clang/dist/tools/clang-cc/clang-cc.cpp vendor/clang/dist/utils/C++Tests/LLVM-Syntax/lit.local.cfg vendor/clang/dist/www/analyzer/latest_checker.html.incl Modified: vendor/clang/dist/include/clang/AST/ASTConsumer.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTConsumer.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/AST/ASTConsumer.h Thu Nov 5 17:18:09 2009 (r198954) @@ -38,17 +38,17 @@ public: virtual ~ASTConsumer() {} /// Initialize - This is called to initialize the consumer, providing the - /// ASTContext and the Action. + /// ASTContext. virtual void Initialize(ASTContext &Context) {} /// HandleTopLevelDecl - Handle the specified top-level declaration. This is - /// called by the parser to process every top-level Decl*. Note that D can - /// be the head of a chain of Decls (e.g. for `int a, b` the chain will have - /// two elements). Use Decl::getNextDeclarator() to walk the chain. + /// called by the parser to process every top-level Decl*. Note that D can be + /// the head of a chain of Decls (e.g. for `int a, b` the chain will have two + /// elements). Use Decl::getNextDeclarator() to walk the chain. virtual void HandleTopLevelDecl(DeclGroupRef D); /// HandleTranslationUnit - This method is called when the ASTs for entire - /// translation unit have been parsed. + /// translation unit have been parsed. virtual void HandleTranslationUnit(ASTContext &Ctx) {} /// HandleTagDeclDefinition - This callback is invoked each time a TagDecl @@ -57,9 +57,9 @@ public: /// can be defined in declspecs). virtual void HandleTagDeclDefinition(TagDecl *D) {} - /// \brief Callback invoked at the end of a translation unit to - /// notify the consumer that the given tentative definition should - /// be completed. + /// CompleteTentativeDefinition - Callback invoked at the end of a translation + /// unit to notify the consumer that the given tentative definition should be + /// completed. /// /// The variable declaration itself will be a tentative /// definition. If it had an incomplete array type, its type will @@ -69,8 +69,7 @@ public: virtual void CompleteTentativeDefinition(VarDecl *D) {} /// PrintStats - If desired, print any statistics. - virtual void PrintStats() { - } + virtual void PrintStats() {} // Support isa/cast/dyn_cast static bool classof(const ASTConsumer *) { return true; } Modified: vendor/clang/dist/include/clang/Analysis/PathDiagnostic.h ============================================================================== --- vendor/clang/dist/include/clang/Analysis/PathDiagnostic.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Analysis/PathDiagnostic.h Thu Nov 5 17:18:09 2009 (r198954) @@ -43,8 +43,18 @@ class Preprocessor; class PathDiagnosticClient : public DiagnosticClient { public: PathDiagnosticClient() {} - virtual ~PathDiagnosticClient() {} - virtual void SetPreprocessor(Preprocessor *PP) {} + + virtual ~PathDiagnosticClient() {}; + + virtual void + FlushDiagnostics(llvm::SmallVectorImpl<std::string> *FilesMade = 0) = 0; + + void FlushDiagnostics(llvm::SmallVectorImpl<std::string> &FilesMade) { + FlushDiagnostics(&FilesMade); + } + + virtual llvm::StringRef getName() const = 0; + virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, const DiagnosticInfo &Info); virtual void HandlePathDiagnostic(const PathDiagnostic* D) = 0; Modified: vendor/clang/dist/include/clang/Analysis/PathSensitive/AnalysisManager.h ============================================================================== --- vendor/clang/dist/include/clang/Analysis/PathSensitive/AnalysisManager.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Analysis/PathSensitive/AnalysisManager.h Thu Nov 5 17:18:09 2009 (r198954) @@ -66,6 +66,8 @@ public: VisualizeEGDot(vizdot), VisualizeEGUbi(vizubi), PurgeDead(purge), EagerlyAssume(eager), TrimGraph(trim) {} + ~AnalysisManager() { FlushDiagnostics(); } + void ClearContexts() { LocCtxMgr.clear(); AnaCtxMgr.clear(); @@ -98,6 +100,11 @@ public: virtual PathDiagnosticClient *getPathDiagnosticClient() { return PD.get(); } + + void FlushDiagnostics() { + if (PD.get()) + PD->FlushDiagnostics(); + } bool shouldVisualizeGraphviz() const { return VisualizeEGDot; } Modified: vendor/clang/dist/include/clang/Analysis/PathSensitive/BugType.h ============================================================================== --- vendor/clang/dist/include/clang/Analysis/PathSensitive/BugType.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Analysis/PathSensitive/BugType.h Thu Nov 5 17:18:09 2009 (r198954) @@ -64,10 +64,10 @@ protected: const std::string desc; public: BuiltinBug(GRExprEngine *eng, const char* n, const char* d) - : BugType(n, "Logic errors"), Eng(*eng), desc(d) {} + : BugType(n, "Logic error"), Eng(*eng), desc(d) {} BuiltinBug(GRExprEngine *eng, const char* n) - : BugType(n, "Logic errors"), Eng(*eng), desc(n) {} + : BugType(n, "Logic error"), Eng(*eng), desc(n) {} const std::string &getDescription() const { return desc; } Modified: vendor/clang/dist/include/clang/Analysis/PathSensitive/Checker.h ============================================================================== --- vendor/clang/dist/include/clang/Analysis/PathSensitive/Checker.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Analysis/PathSensitive/Checker.h Thu Nov 5 17:18:09 2009 (r198954) @@ -116,12 +116,13 @@ private: void GR_VisitBind(ExplodedNodeSet &Dst, GRStmtNodeBuilder &Builder, GRExprEngine &Eng, - const Stmt *stmt, ExplodedNode *Pred, void *tag, + const Stmt *AssignE, + const Stmt *StoreE, ExplodedNode *Pred, void *tag, SVal location, SVal val, bool isPrevisit) { CheckerContext C(Dst, Builder, Eng, Pred, tag, isPrevisit); assert(isPrevisit && "Only previsit supported for now."); - PreVisitBind(C, stmt, location, val); + PreVisitBind(C, AssignE, StoreE, location, val); } public: @@ -135,7 +136,8 @@ public: return Pred; } - virtual void PreVisitBind(CheckerContext &C, const Stmt *ST, + virtual void PreVisitBind(CheckerContext &C, + const Stmt *AssignE, const Stmt *StoreE, SVal location, SVal val) {} virtual ExplodedNode *CheckType(QualType T, ExplodedNode *Pred, Modified: vendor/clang/dist/include/clang/Analysis/PathSensitive/Checkers/UndefinedAssignmentChecker.h ============================================================================== --- vendor/clang/dist/include/clang/Analysis/PathSensitive/Checkers/UndefinedAssignmentChecker.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Analysis/PathSensitive/Checkers/UndefinedAssignmentChecker.h Thu Nov 5 17:18:09 2009 (r198954) @@ -24,7 +24,8 @@ class UndefinedAssignmentChecker public: UndefinedAssignmentChecker() : BT(0) {} static void *getTag(); - virtual void PreVisitBind(CheckerContext &C, const Stmt *S, SVal location, + virtual void PreVisitBind(CheckerContext &C, const Stmt *AssignE, + const Stmt *StoreE, SVal location, SVal val); }; } Modified: vendor/clang/dist/include/clang/Analysis/PathSensitive/GRExprEngine.h ============================================================================== --- vendor/clang/dist/include/clang/Analysis/PathSensitive/GRExprEngine.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Analysis/PathSensitive/GRExprEngine.h Thu Nov 5 17:18:09 2009 (r198954) @@ -412,7 +412,8 @@ protected: void CheckerVisit(Stmt *S, ExplodedNodeSet &Dst, ExplodedNodeSet &Src, bool isPrevisit); - void CheckerVisitBind(Stmt *S, ExplodedNodeSet &Dst, ExplodedNodeSet &Src, + void CheckerVisitBind(const Stmt *AssignE, const Stmt *StoreE, + ExplodedNodeSet &Dst, ExplodedNodeSet &Src, SVal location, SVal val, bool isPrevisit); @@ -566,7 +567,8 @@ protected: /// EvalBind - Handle the semantics of binding a value to a specific location. /// This method is used by EvalStore, VisitDeclStmt, and others. - void EvalBind(ExplodedNodeSet& Dst, Stmt* Ex, ExplodedNode* Pred, + void EvalBind(ExplodedNodeSet& Dst, Stmt *AssignE, + Stmt* StoreE, ExplodedNode* Pred, const GRState* St, SVal location, SVal Val, bool atDeclInit = false); @@ -578,14 +580,10 @@ public: const GRState* St, SVal location, const void *tag = 0); - - void EvalStore(ExplodedNodeSet& Dst, Expr* E, ExplodedNode* Pred, const GRState* St, - SVal TargetLV, SVal Val, const void *tag = 0); - - void EvalStore(ExplodedNodeSet& Dst, Expr* E, Expr* StoreE, ExplodedNode* Pred, + void EvalStore(ExplodedNodeSet& Dst, Expr* AssignE, Expr* StoreE, + ExplodedNode* Pred, const GRState* St, SVal TargetLV, SVal Val, const void *tag = 0); - }; } // end clang namespace Modified: vendor/clang/dist/include/clang/Basic/Diagnostic.h ============================================================================== --- vendor/clang/dist/include/clang/Basic/Diagnostic.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Basic/Diagnostic.h Thu Nov 5 17:18:09 2009 (r198954) @@ -769,17 +769,28 @@ class DiagnosticClient { public: virtual ~DiagnosticClient(); - /// setLangOptions - This is set by clients of diagnostics when they know the - /// language parameters of the diagnostics that may be sent through. Note - /// that this can change over time if a DiagClient has multiple languages sent - /// through it. It may also be set to null (e.g. when processing command line - /// options). - virtual void setLangOptions(const LangOptions *LO) {} + /// BeginSourceFile - Callback to inform the diagnostic client that processing + /// of a source file is beginning. + /// + /// Note that diagnostics may be emitted outside the processing of a source + /// file, for example during the parsing of command line options. However, + /// diagnostics with source range information are required to only be emitted + /// in between BeginSourceFile() and EndSourceFile(). + /// + /// \arg LO - The language options for the source file being processed. + /// \arg PP - The preprocessor object being used for the source; this optional + /// and may not be present, for example when processing AST source files. + virtual void BeginSourceFile(const LangOptions &LangOpts) {} + + /// EndSourceFile - Callback to inform the diagnostic client that processing + /// of a source file has ended. The diagnostic client should assume that any + /// objects made available via \see BeginSourceFile() are inaccessible. + virtual void EndSourceFile() {} /// IncludeInDiagnosticCounts - This method (whose default implementation - /// returns true) indicates whether the diagnostics handled by this - /// DiagnosticClient should be included in the number of diagnostics - /// reported by Diagnostic. + /// returns true) indicates whether the diagnostics handled by this + /// DiagnosticClient should be included in the number of diagnostics reported + /// by Diagnostic. virtual bool IncludeInDiagnosticCounts() const; /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or Modified: vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td Thu Nov 5 17:18:09 2009 (r198954) @@ -23,6 +23,7 @@ def : DiagGroup<"address">; def : DiagGroup<"aggregate-return">; def : DiagGroup<"attributes">; def : DiagGroup<"bad-function-cast">; +def : DiagGroup<"c++-compat">; def : DiagGroup<"cast-align">; def : DiagGroup<"cast-qual">; def : DiagGroup<"char-align">; @@ -47,6 +48,7 @@ def : DiagGroup<"invalid-pch">; def : DiagGroup<"missing-braces">; def : DiagGroup<"missing-declarations">; def : DiagGroup<"missing-format-attribute">; +def : DiagGroup<"missing-include-dirs">; def : DiagGroup<"missing-noreturn">; def MultiChar : DiagGroup<"multichar">; def : DiagGroup<"nested-externs">; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Thu Nov 5 17:18:09 2009 (r198954) @@ -166,9 +166,6 @@ def err_use_of_tag_name_without_tag : Er "use of tagged type %0 without '%1' tag">; def err_expected_ident_in_using : Error< "expected an identifier in using directive">; -def err_using_decl_can_not_refer_to_template_spec : Error< - "using declaration can not refer to template specialization">; - /// Objective-C parser diagnostics def err_objc_no_attributes_on_category : Error< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Thu Nov 5 17:18:09 2009 (r198954) @@ -107,8 +107,14 @@ def err_using_decl_nested_name_specifier "using declaration refers into '%0', which is not a base class of %1">; def err_using_decl_can_not_refer_to_class_member : Error< "using declaration can not refer to class member">; - def err_using_decl_can_not_refer_to_namespace : Error< +def err_using_decl_can_not_refer_to_namespace : Error< "using declaration can not refer to namespace">; +def err_using_decl_constructor : Error< + "using declaration can not refer to a constructor">; +def err_using_decl_destructor : Error< + "using declaration can not refer to a destructor">; +def err_using_decl_template_id : Error< + "using declaration can not refer to a template specialization">; def err_invalid_thread : Error< "'__thread' is only allowed on variable declarations">; @@ -512,6 +518,8 @@ def err_init_reference_member_uninitiali "reference member of type %0 uninitialized">; def note_uninit_reference_member : Note< "uninitialized reference member is here">; +def warn_field_is_uninit : Warning<"field is uninitialized when used here">, + InGroup<DiagGroup<"uninitialized">>; // C++0x decltype def err_cannot_determine_declared_type_of_overloaded_function : Error< @@ -1529,6 +1537,12 @@ def err_typecheck_vector_comparison : Er def err_typecheck_assign_const : Error<"read-only variable is not assignable">; def err_stmtexpr_file_scope : Error< "statement expression not allowed at file scope">; +def warn_mixed_sign_comparison : Warning< + "comparison of integers of different signs: %0 and %1">, + InGroup<DiagGroup<"sign-compare">>; +def warn_mixed_sign_conditional : Warning< + "operands of ? are integers of different signs: %0 and %1">, + InGroup<DiagGroup<"sign-compare">>; def err_invalid_this_use : Error< "invalid use of 'this' outside of a nonstatic member function">; Modified: vendor/clang/dist/include/clang/Frontend/ASTConsumers.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/ASTConsumers.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Frontend/ASTConsumers.h Thu Nov 5 17:18:09 2009 (r198954) @@ -28,7 +28,6 @@ class ASTConsumer; class Diagnostic; class FileManager; class Preprocessor; -class PreprocessorFactory; class CompileOptions; class LangOptions; @@ -86,10 +85,11 @@ ASTConsumer *CreateBackendConsumer(Backe llvm::raw_ostream *OS, llvm::LLVMContext& C); -// HTML printer: uses the rewriter to convert source code to HTML with -// syntax highlighting suitable for viewing in a web-browser. -ASTConsumer* CreateHTMLPrinter(llvm::raw_ostream *OS, Diagnostic &D, - Preprocessor *PP, PreprocessorFactory *PPF); +/// CreateHTMLPrinter - Create an AST consumer which rewrites source code to +/// HTML with syntax highlighting suitable for viewing in a web-browser. +ASTConsumer *CreateHTMLPrinter(llvm::raw_ostream *OS, Preprocessor &PP, + bool SyntaxHighlight = true, + bool HighlightMacros = true); // PCH generator: generates a precompiled header file; this file can be // used later with the PCHReader (clang-cc option -include-pch) Modified: vendor/clang/dist/include/clang/Frontend/AnalysisConsumer.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/AnalysisConsumer.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Frontend/AnalysisConsumer.h Thu Nov 5 17:18:09 2009 (r198954) @@ -19,7 +19,6 @@ namespace clang { class ASTConsumer; class Diagnostic; class Preprocessor; -class PreprocessorFactory; class LangOptions; /// Analysis - Set of available source code analyses. @@ -69,9 +68,7 @@ struct AnalyzerOptions { /// CreateAnalysisConsumer - Creates an ASTConsumer to run various code /// analysis passes. (The set of analyses run is controlled by command-line /// options.) -ASTConsumer* CreateAnalysisConsumer(Diagnostic &diags, Preprocessor *pp, - PreprocessorFactory *ppf, - const LangOptions &lopts, +ASTConsumer* CreateAnalysisConsumer(const Preprocessor &pp, const std::string &output, const AnalyzerOptions& Opts); Modified: vendor/clang/dist/include/clang/Frontend/InitPreprocessor.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/InitPreprocessor.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Frontend/InitPreprocessor.h Thu Nov 5 17:18:09 2009 (r198954) @@ -29,7 +29,16 @@ class PreprocessorInitOptions { std::vector<std::pair<std::string, bool/*isPTH*/> > Includes; std::vector<std::string> MacroIncludes; + unsigned UsePredefines : 1; /// Initialize the preprocessor with the compiler + /// and target specific predefines. + public: + PreprocessorInitOptions() : UsePredefines(true) {} + + bool getUsePredefines() const { return UsePredefines; } + void setUsePredefines(bool Value) { + UsePredefines = Value; + } void addMacroDef(const std::string &Name) { Macros.push_back(std::make_pair(Name, false)); @@ -60,11 +69,10 @@ public: }; /// InitializePreprocessor - Initialize the preprocessor getting it and the -/// environment ready to process a single file. This returns true on error. +/// environment ready to process a single file. /// -bool InitializePreprocessor(Preprocessor &PP, - const PreprocessorInitOptions& InitOptions, - bool undef_macros); +void InitializePreprocessor(Preprocessor &PP, + const PreprocessorInitOptions& InitOptions); } // end namespace clang Modified: vendor/clang/dist/include/clang/Frontend/PathDiagnosticClients.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/PathDiagnosticClients.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Frontend/PathDiagnosticClients.h Thu Nov 5 17:18:09 2009 (r198954) @@ -22,33 +22,13 @@ namespace clang { class PathDiagnosticClient; class Preprocessor; -class PreprocessorFactory; - -class PathDiagnosticClientFactory { -public: - PathDiagnosticClientFactory() {} - virtual ~PathDiagnosticClientFactory() {} - - virtual const char *getName() const = 0; - - virtual PathDiagnosticClient* - createPathDiagnosticClient(llvm::SmallVectorImpl<std::string> *FilesMade) = 0; -}; PathDiagnosticClient* -CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP = 0, - PreprocessorFactory* PPF = 0, - llvm::SmallVectorImpl<std::string>* FilesMade = 0); - -PathDiagnosticClientFactory* -CreateHTMLDiagnosticClientFactory(const std::string& prefix, - Preprocessor* PP = 0, - PreprocessorFactory* PPF = 0); +CreateHTMLDiagnosticClient(const std::string& prefix, const Preprocessor &PP); PathDiagnosticClient* -CreatePlistDiagnosticClient(const std::string& prefix, Preprocessor* PP, - PreprocessorFactory* PPF, - PathDiagnosticClientFactory *PF = 0); +CreatePlistDiagnosticClient(const std::string& prefix, const Preprocessor &PP, + PathDiagnosticClient *SubPD = 0); } // end clang namespace #endif Modified: vendor/clang/dist/include/clang/Frontend/TextDiagnosticPrinter.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/TextDiagnosticPrinter.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Frontend/TextDiagnosticPrinter.h Thu Nov 5 17:18:09 2009 (r198954) @@ -39,8 +39,12 @@ class TextDiagnosticPrinter : public Dia public: TextDiagnosticPrinter(llvm::raw_ostream &os, const DiagnosticOptions &diags); - void setLangOptions(const LangOptions *LO) { - LangOpts = LO; + void BeginSourceFile(const LangOptions &LO) { + LangOpts = &LO; + } + + void EndSourceFile() { + LangOpts = 0; } void PrintIncludeStack(SourceLocation Loc, const SourceManager &SM); Modified: vendor/clang/dist/include/clang/Frontend/Utils.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/Utils.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Frontend/Utils.h Thu Nov 5 17:18:09 2009 (r198954) @@ -30,7 +30,6 @@ class Diagnostic; class ASTConsumer; class IdentifierTable; class SourceManager; -class PreprocessorFactory; class LangOptions; class Decl; class Stmt; Modified: vendor/clang/dist/include/clang/Lex/Preprocessor.h ============================================================================== --- vendor/clang/dist/include/clang/Lex/Preprocessor.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Lex/Preprocessor.h Thu Nov 5 17:18:09 2009 (r198954) @@ -96,7 +96,7 @@ class Preprocessor { /// Identifiers - This is mapping/lookup information for all identifiers in /// the program, including program keywords. - IdentifierTable Identifiers; + mutable IdentifierTable Identifiers; /// Selectors - This table contains all the selectors in the program. Unlike /// IdentifierTable above, this table *isn't* populated by the preprocessor. @@ -296,12 +296,8 @@ public: /// pointers is preferred unless the identifier is already available as a /// string (this avoids allocation and copying of memory to construct an /// std::string). - IdentifierInfo *getIdentifierInfo(const char *NameStart, - const char *NameEnd) { - return &Identifiers.get(NameStart, NameEnd); - } - IdentifierInfo *getIdentifierInfo(const char *NameStr) { - return getIdentifierInfo(NameStr, NameStr+strlen(NameStr)); + IdentifierInfo *getIdentifierInfo(llvm::StringRef Name) const { + return &Identifiers.get(Name); } /// AddPragmaHandler - Add the specified pragma handler to the preprocessor. @@ -583,7 +579,7 @@ public: /// LookUpIdentifierInfo - Given a tok::identifier token, look up the /// identifier information for the token and install it into the token. IdentifierInfo *LookUpIdentifierInfo(Token &Identifier, - const char *BufPtr = 0); + const char *BufPtr = 0) const; /// HandleIdentifier - This callback is invoked when the lexer reads an /// identifier and has filled in the tokens IdentifierInfo member. This @@ -831,14 +827,6 @@ public: void HandleComment(SourceRange Comment); }; -/// PreprocessorFactory - A generic factory interface for lazily creating -/// Preprocessor objects on-demand when they are needed. -class PreprocessorFactory { -public: - virtual ~PreprocessorFactory(); - virtual Preprocessor* CreatePreprocessor() = 0; -}; - /// \brief Abstract base class that describes a handler that will receive /// source ranges for each of the comments encountered in the source file. class CommentHandler { Modified: vendor/clang/dist/include/clang/Parse/Action.h ============================================================================== --- vendor/clang/dist/include/clang/Parse/Action.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Parse/Action.h Thu Nov 5 17:18:09 2009 (r198954) @@ -1174,14 +1174,41 @@ public: return DeclPtrTy(); } - /// ActOnUsingDirective - This is called when using-directive is parsed. + /// \brief Parsed a C++ using-declaration. + /// + /// This callback will be invoked when the parser has parsed a C++ + /// using-declaration, e.g., + /// + /// \code + /// namespace std { + /// template<typename T, typename Alloc> class vector; + /// } + /// + /// using std::vector; // using-declaration here + /// \endcode + /// + /// \param CurScope the scope in which this using declaration was parsed. + /// + /// \param AS the currently-active access specifier. + /// + /// \param UsingLoc the location of the 'using' keyword. + /// + /// \param SS the nested-name-specifier that precedes the name. + /// + /// \param Name the name to which the using declaration refers. + /// + /// \param AttrList attributes applied to this using declaration, if any. + /// + /// \param IsTypeName whether this using declaration started with the + /// 'typename' keyword. FIXME: This will eventually be split into a + /// separate action. + /// + /// \returns a representation of the using declaration. virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, const CXXScopeSpec &SS, - SourceLocation IdentLoc, - IdentifierInfo *TargetName, - OverloadedOperatorKind Op, + UnqualifiedId &Name, AttributeList *AttrList, bool IsTypeName); Modified: vendor/clang/dist/include/clang/Parse/DeclSpec.h ============================================================================== --- vendor/clang/dist/include/clang/Parse/DeclSpec.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Parse/DeclSpec.h Thu Nov 5 17:18:09 2009 (r198954) @@ -131,6 +131,9 @@ private: // friend-specifier bool Friend_specified : 1; + // constexpr-specifier + bool Constexpr_specified : 1; + /// TypeRep - This contains action-specific information about a specific TST. /// For example, for a typedef or struct, it might contain the declaration for /// these. @@ -155,7 +158,7 @@ private: SourceLocation TSWLoc, TSCLoc, TSSLoc, TSTLoc; SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc; SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc; - SourceLocation FriendLoc; + SourceLocation FriendLoc, ConstexprLoc; DeclSpec(const DeclSpec&); // DO NOT IMPLEMENT void operator=(const DeclSpec&); // DO NOT IMPLEMENT @@ -174,6 +177,7 @@ public: FS_virtual_specified(false), FS_explicit_specified(false), Friend_specified(false), + Constexpr_specified(false), TypeRep(0), AttrList(0), ProtocolQualifiers(0), @@ -309,9 +313,15 @@ public: bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID); + bool SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec, + unsigned &DiagID); + bool isFriendSpecified() const { return Friend_specified; } SourceLocation getFriendSpecLoc() const { return FriendLoc; } + bool isConstexprSpecified() const { return Constexpr_specified; } + SourceLocation getConstexprSpecLoc() const { return ConstexprLoc; } + /// AddAttributes - contatenates two attribute lists. /// The GCC attribute syntax allows for the following: /// Modified: vendor/clang/dist/include/clang/Parse/Parser.h ============================================================================== --- vendor/clang/dist/include/clang/Parse/Parser.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Parse/Parser.h Thu Nov 5 17:18:09 2009 (r198954) @@ -1321,13 +1321,6 @@ private: UnqualifiedId &Result); //===--------------------------------------------------------------------===// - // C++ 13.5: Overloaded operators [over.oper] - // EndLoc, if non-NULL, is filled with the location of the last token of - // the ID. - OverloadedOperatorKind TryParseOperatorFunctionId(SourceLocation *EndLoc = 0); - TypeTy *ParseConversionFunctionId(SourceLocation *EndLoc = 0); - - //===--------------------------------------------------------------------===// // C++ 14: Templates [temp] typedef llvm::SmallVector<DeclPtrTy, 4> TemplateParameterList; Modified: vendor/clang/dist/include/clang/Rewrite/HTMLRewrite.h ============================================================================== --- vendor/clang/dist/include/clang/Rewrite/HTMLRewrite.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/include/clang/Rewrite/HTMLRewrite.h Thu Nov 5 17:18:09 2009 (r198954) @@ -23,7 +23,6 @@ namespace clang { class Rewriter; class RewriteBuffer; class Preprocessor; -class PreprocessorFactory; namespace html { @@ -68,14 +67,14 @@ namespace html { /// SyntaxHighlight - Relex the specified FileID and annotate the HTML with /// information about keywords, comments, etc. - void SyntaxHighlight(Rewriter &R, FileID FID, Preprocessor &PP); + void SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP); /// HighlightMacros - This uses the macro table state from the end of the /// file, to reexpand macros and insert (into the HTML) information about the /// macro expansions. This won't be perfectly perfect, but it will be /// reasonably close. - void HighlightMacros(Rewriter &R, FileID FID, Preprocessor &PP); - void HighlightMacros(Rewriter &R, FileID FID, PreprocessorFactory &PPF); + void HighlightMacros(Rewriter &R, FileID FID, const Preprocessor &PP); + } // end html namespace } // end clang namespace Modified: vendor/clang/dist/lib/AST/ASTContext.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ASTContext.cpp Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/lib/AST/ASTContext.cpp Thu Nov 5 17:18:09 2009 (r198954) @@ -1374,7 +1374,7 @@ QualType ASTContext::getMemberPointerTyp // If the pointee or class type isn't canonical, this won't be a canonical // type either, so fill in the canonical type field. QualType Canonical; - if (!T.isCanonical()) { + if (!T.isCanonical() || !Cls->isCanonicalUnqualified()) { Canonical = getMemberPointerType(getCanonicalType(T),getCanonicalType(Cls)); // Get the new insert position for the node we care about. @@ -1395,7 +1395,8 @@ QualType ASTContext::getConstantArrayTyp const llvm::APInt &ArySizeIn, ArrayType::ArraySizeModifier ASM, unsigned EltTypeQuals) { - assert((EltTy->isDependentType() || EltTy->isConstantSizeType()) && + assert((EltTy->isDependentType() || + EltTy->isIncompleteType() || EltTy->isConstantSizeType()) && "Constant array of VLAs is illegal!"); // Convert the array size into a canonical width matching the pointer size for Modified: vendor/clang/dist/lib/AST/DeclarationName.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclarationName.cpp Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/lib/AST/DeclarationName.cpp Thu Nov 5 17:18:09 2009 (r198954) @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "clang/AST/DeclarationName.h" #include "clang/AST/Type.h" +#include "clang/AST/TypeOrdering.h" #include "clang/AST/Decl.h" #include "clang/Basic/IdentifierTable.h" #include "llvm/ADT/DenseMap.h" @@ -49,11 +50,50 @@ public: }; bool operator<(DeclarationName LHS, DeclarationName RHS) { - if (IdentifierInfo *LhsId = LHS.getAsIdentifierInfo()) - if (IdentifierInfo *RhsId = RHS.getAsIdentifierInfo()) - return LhsId->getName() < RhsId->getName(); - - return LHS.getAsOpaqueInteger() < RHS.getAsOpaqueInteger(); + if (LHS.getNameKind() != RHS.getNameKind()) + return LHS.getNameKind() < RHS.getNameKind(); + + switch (LHS.getNameKind()) { + case DeclarationName::Identifier: + return LHS.getAsIdentifierInfo()->getName() < + RHS.getAsIdentifierInfo()->getName(); + + case DeclarationName::ObjCZeroArgSelector: + case DeclarationName::ObjCOneArgSelector: + case DeclarationName::ObjCMultiArgSelector: { + Selector LHSSelector = LHS.getObjCSelector(); + Selector RHSSelector = RHS.getObjCSelector(); + for (unsigned I = 0, + N = std::min(LHSSelector.getNumArgs(), RHSSelector.getNumArgs()); + I != N; ++I) { + IdentifierInfo *LHSId = LHSSelector.getIdentifierInfoForSlot(I); + IdentifierInfo *RHSId = RHSSelector.getIdentifierInfoForSlot(I); + if (!LHSId || !RHSId) + return LHSId && !RHSId; + + switch (LHSId->getName().compare(RHSId->getName())) { + case -1: return true; + case 1: return false; + default: break; + } + } + + return LHSSelector.getNumArgs() < RHSSelector.getNumArgs(); + } + + case DeclarationName::CXXConstructorName: + case DeclarationName::CXXDestructorName: + case DeclarationName::CXXConversionFunctionName: + return QualTypeOrdering()(LHS.getCXXNameType(), RHS.getCXXNameType()); + + case DeclarationName::CXXOperatorName: + return LHS.getCXXOverloadedOperator() < RHS.getCXXOverloadedOperator(); + + case DeclarationName::CXXUsingDirective: + return false; + } + + return false; } } // end namespace clang Modified: vendor/clang/dist/lib/AST/RecordLayoutBuilder.cpp ============================================================================== --- vendor/clang/dist/lib/AST/RecordLayoutBuilder.cpp Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/lib/AST/RecordLayoutBuilder.cpp Thu Nov 5 17:18:09 2009 (r198954) @@ -174,9 +174,24 @@ void ASTRecordLayoutBuilder::LayoutVirtu LayoutBaseNonVirtually(RD, true); } -void ASTRecordLayoutBuilder::LayoutVirtualBases(const CXXRecordDecl *RD, +uint64_t ASTRecordLayoutBuilder::getBaseOffset(const CXXRecordDecl *Base) { + for (size_t i = 0; i < Bases.size(); ++i) { + if (Bases[i].first == Base) + return Bases[i].second; + } + for (size_t i = 0; i < VBases.size(); ++i) { + if (VBases[i].first == Base) + return VBases[i].second; + } + assert(0 && "missing base"); + return 0; +} + + +void ASTRecordLayoutBuilder::LayoutVirtualBases(const CXXRecordDecl *Class, + const CXXRecordDecl *RD, const CXXRecordDecl *PB, - int64_t Offset, + uint64_t Offset, llvm::SmallSet<const CXXRecordDecl*, 32> &mark, llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary) { for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(), @@ -185,20 +200,7 @@ void ASTRecordLayoutBuilder::LayoutVirtu "Cannot layout class with dependent bases."); const CXXRecordDecl *Base = cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl()); -#if 0 - const ASTRecordLayout &L = Ctx.getASTRecordLayout(Base); - const CXXRecordDecl *PB = L.getPrimaryBase(); - if (PB && L.getPrimaryBaseWasVirtual() - && IndirectPrimary.count(PB)) { - int64_t BaseOffset; - // FIXME: calculate this. - BaseOffset = (1<<63) | (1<<31); - VBases.push_back(PB); - VBaseOffsets.push_back(BaseOffset); - } -#endif - int64_t BaseOffset = Offset;; - // FIXME: Calculate BaseOffset. + uint64_t BaseOffset = Offset; if (i->isVirtual()) { if (Base == PB) { // Only lay things out once. @@ -220,11 +222,20 @@ void ASTRecordLayoutBuilder::LayoutVirtu LayoutVirtualBase(Base); BaseOffset = VBases.back().second; } + } else { + if (RD == Class) + BaseOffset = getBaseOffset(Base); + else { + const ASTRecordLayout &Layout + = Ctx.getASTRecordLayout(RD); + BaseOffset = Offset + Layout.getBaseClassOffset(Base); + } } + if (Base->getNumVBases()) { const ASTRecordLayout &L = Ctx.getASTRecordLayout(Base); const CXXRecordDecl *PB = L.getPrimaryBase(); - LayoutVirtualBases(Base, PB, BaseOffset, mark, IndirectPrimary); + LayoutVirtualBases(Class, Base, PB, BaseOffset, mark, IndirectPrimary); } } } @@ -295,7 +306,7 @@ bool ASTRecordLayoutBuilder::canPlaceFie const ASTRecordLayout &Info = Ctx.getASTRecordLayout(RD); uint64_t NumElements = Ctx.getConstantArrayElementCount(AT); - unsigned ElementOffset = Offset; + uint64_t ElementOffset = Offset; for (uint64_t I = 0; I != NumElements; ++I) { if (!canPlaceRecordAtOffset(RD, ElementOffset)) return false; @@ -366,7 +377,7 @@ ASTRecordLayoutBuilder::UpdateEmptyClass const ASTRecordLayout &Info = Ctx.getASTRecordLayout(RD); uint64_t NumElements = Ctx.getConstantArrayElementCount(AT); - unsigned ElementOffset = Offset; + uint64_t ElementOffset = Offset; for (uint64_t I = 0; I != NumElements; ++I) { UpdateEmptyClassOffsets(RD, ElementOffset); @@ -419,29 +430,13 @@ uint64_t ASTRecordLayoutBuilder::LayoutB void ASTRecordLayoutBuilder::LayoutBaseNonVirtually(const CXXRecordDecl *RD, bool IsVirtualBase) { // Layout the base. - unsigned Offset = LayoutBase(RD); + uint64_t Offset = LayoutBase(RD); // Add base class offsets. if (IsVirtualBase) VBases.push_back(std::make_pair(RD, Offset)); else Bases.push_back(std::make_pair(RD, Offset)); - -#if 0 - // And now add offsets for all our primary virtual bases as well, so - // they all have offsets. - const ASTRecordLayout *L = &BaseInfo; - const CXXRecordDecl *PB = L->getPrimaryBase(); - while (PB) { - if (L->getPrimaryBaseWasVirtual()) { - VBases.push_back(PB); - VBaseOffsets.push_back(Size); - } - PB = L->getPrimaryBase(); - if (PB) - L = &Ctx.getASTRecordLayout(PB); - } -#endif } void ASTRecordLayoutBuilder::Layout(const RecordDecl *D) { @@ -476,7 +471,7 @@ void ASTRecordLayoutBuilder::Layout(cons if (RD) { llvm::SmallSet<const CXXRecordDecl*, 32> mark; - LayoutVirtualBases(RD, PrimaryBase, 0, mark, IndirectPrimaryBases); + LayoutVirtualBases(RD, RD, PrimaryBase, 0, mark, IndirectPrimaryBases); } // Finally, round the size of the total struct up to the alignment of the Modified: vendor/clang/dist/lib/AST/RecordLayoutBuilder.h ============================================================================== --- vendor/clang/dist/lib/AST/RecordLayoutBuilder.h Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/lib/AST/RecordLayoutBuilder.h Thu Nov 5 17:18:09 2009 (r198954) @@ -99,9 +99,9 @@ class ASTRecordLayoutBuilder { void LayoutNonVirtualBases(const CXXRecordDecl *RD); void LayoutBaseNonVirtually(const CXXRecordDecl *RD, bool IsVBase); void LayoutVirtualBase(const CXXRecordDecl *RD); - void LayoutVirtualBases(const CXXRecordDecl *RD, const CXXRecordDecl *PB, - int64_t Offset, - llvm::SmallSet<const CXXRecordDecl*, 32> &mark, + void LayoutVirtualBases(const CXXRecordDecl *Class, const CXXRecordDecl *RD, + const CXXRecordDecl *PB, uint64_t Offset, + llvm::SmallSet<const CXXRecordDecl*, 32> &mark, llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary); /// canPlaceRecordAtOffset - Return whether a record (either a base class @@ -124,6 +124,9 @@ class ASTRecordLayoutBuilder { /// given offset. void UpdateEmptyClassOffsets(const FieldDecl *FD, uint64_t Offset); + /// getBaseOffset - Get the offset of a direct base class. + uint64_t getBaseOffset(const CXXRecordDecl *Base); + /// FinishLayout - Finalize record layout. Adjust record size based on the /// alignment. void FinishLayout(); Modified: vendor/clang/dist/lib/AST/Type.cpp ============================================================================== --- vendor/clang/dist/lib/AST/Type.cpp Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/lib/AST/Type.cpp Thu Nov 5 17:18:09 2009 (r198954) @@ -550,6 +550,12 @@ bool Type::isIncompleteType() const { // A tagged type (struct/union/enum/class) is incomplete if the decl is a // forward declaration, but not a full definition (C99 6.2.5p22). return !cast<TagType>(CanonicalType)->getDecl()->isDefinition(); + case ConstantArray: + // An array is incomplete if its element type is incomplete + // (C++ [dcl.array]p1). + // We don't handle variable arrays (they're not allowed in C++) or + // dependent-sized arrays (dependent types are never treated as incomplete). + return cast<ArrayType>(CanonicalType)->getElementType()->isIncompleteType(); case IncompleteArray: // An array of unknown size is an incomplete type (C99 6.2.5p22). return true; Modified: vendor/clang/dist/lib/Analysis/GRExprEngine.cpp ============================================================================== --- vendor/clang/dist/lib/Analysis/GRExprEngine.cpp Thu Nov 5 17:17:44 2009 (r198953) +++ vendor/clang/dist/lib/Analysis/GRExprEngine.cpp Thu Nov 5 17:18:09 2009 (r198954) @@ -141,7 +141,8 @@ void GRExprEngine::CheckerVisit(Stmt *S, // FIXME: This is largely copy-paste from CheckerVisit(). Need to // unify. -void GRExprEngine::CheckerVisitBind(Stmt *S, ExplodedNodeSet &Dst, +void GRExprEngine::CheckerVisitBind(const Stmt *AssignE, const Stmt *StoreE, + ExplodedNodeSet &Dst, ExplodedNodeSet &Src, SVal location, SVal val, bool isPrevisit) { @@ -164,8 +165,8 @@ void GRExprEngine::CheckerVisitBind(Stmt for (ExplodedNodeSet::iterator NI = PrevSet->begin(), NE = PrevSet->end(); NI != NE; ++NI) - checker->GR_VisitBind(*CurrSet, *Builder, *this, S, *NI, tag, location, - val, isPrevisit); + checker->GR_VisitBind(*CurrSet, *Builder, *this, AssignE, StoreE, + *NI, tag, location, val, isPrevisit); // Update which NodeSet is the current one. PrevSet = CurrSet; @@ -1125,7 +1126,8 @@ void GRExprEngine::VisitMemberExpr(Membe /// EvalBind - Handle the semantics of binding a value to a specific location. /// This method is used by EvalStore and (soon) VisitDeclStmt, and others. -void GRExprEngine::EvalBind(ExplodedNodeSet& Dst, Stmt* Ex, ExplodedNode* Pred, +void GRExprEngine::EvalBind(ExplodedNodeSet& Dst, Stmt *AssignE, + Stmt* StoreE, ExplodedNode* Pred, const GRState* state, SVal location, SVal Val, bool atDeclInit) { @@ -1133,7 +1135,7 @@ void GRExprEngine::EvalBind(ExplodedNode // Do a previsit of the bind. ExplodedNodeSet CheckedSet, Src; Src.Add(Pred); - CheckerVisitBind(Ex, CheckedSet, Src, location, Val, true); + CheckerVisitBind(AssignE, StoreE, CheckedSet, Src, location, Val, true); for (ExplodedNodeSet::iterator I = CheckedSet.begin(), E = CheckedSet.end(); I!=E; ++I) { @@ -1166,7 +1168,7 @@ void GRExprEngine::EvalBind(ExplodedNode // The next thing to do is check if the GRTransferFuncs object wants to // update the state based on the new binding. If the GRTransferFunc object // doesn't do anything, just auto-propagate the current state. - GRStmtNodeBuilderRef BuilderRef(Dst, *Builder, *this, *I, newState, Ex, + GRStmtNodeBuilderRef BuilderRef(Dst, *Builder, *this, *I, newState, StoreE, newState != state); getTF().EvalBind(BuilderRef, location, Val); @@ -1179,14 +1181,16 @@ void GRExprEngine::EvalBind(ExplodedNode /// @param state The current simulation state /// @param location The location to store the value /// @param Val The value to be stored -void GRExprEngine::EvalStore(ExplodedNodeSet& Dst, Expr* Ex, ExplodedNode* Pred, +void GRExprEngine::EvalStore(ExplodedNodeSet& Dst, Expr *AssignE, + Expr* StoreE, + ExplodedNode* Pred, const GRState* state, SVal location, SVal Val, const void *tag) { - assert (Builder && "GRStmtNodeBuilder must be defined."); + assert(Builder && "GRStmtNodeBuilder must be defined."); // Evaluate the location (checks for bad dereferences). - Pred = EvalLocation(Ex, Pred, state, location, tag); + Pred = EvalLocation(StoreE, Pred, state, location, tag); if (!Pred) return; @@ -1199,7 +1203,7 @@ void GRExprEngine::EvalStore(ExplodedNod SaveAndRestore<const void*> OldTag(Builder->Tag); Builder->PointKind = ProgramPoint::PostStoreKind; Builder->Tag = tag; - EvalBind(Dst, Ex, Pred, state, location, Val); + EvalBind(Dst, AssignE, StoreE, Pred, state, location, Val); } void GRExprEngine::EvalLoad(ExplodedNodeSet& Dst, Expr* Ex, ExplodedNode* Pred, @@ -1231,17 +1235,6 @@ void GRExprEngine::EvalLoad(ExplodedNode } } -void GRExprEngine::EvalStore(ExplodedNodeSet& Dst, Expr* Ex, Expr* StoreE, - ExplodedNode* Pred, const GRState* state, - SVal location, SVal Val, const void *tag) { - - ExplodedNodeSet TmpDst; - EvalStore(TmpDst, StoreE, Pred, state, location, Val, tag); - - for (ExplodedNodeSet::iterator I=TmpDst.begin(), E=TmpDst.end(); I!=E; ++I) - MakeNode(Dst, Ex, *I, (*I)->getState(), ProgramPoint::PostStmtKind, tag); -} - ExplodedNode* GRExprEngine::EvalLocation(Stmt* Ex, ExplodedNode* Pred, const GRState* state, SVal location, const void *tag) { @@ -1402,7 +1395,7 @@ static bool EvalOSAtomicCompareAndSwap(E newValueExpr->getType()); } - Engine.EvalStore(TmpStore, theValueExpr, N, stateEqual, location, + Engine.EvalStore(TmpStore, NULL, theValueExpr, N, stateEqual, location, val, OSAtomicStoreTag); // Now bind the result of the comparison. @@ -2147,8 +2140,8 @@ void GRExprEngine::VisitDeclStmt(DeclStm Builder->getCurrentBlockCount()); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911051718.nA5HIAua084802>