Date: Tue, 30 May 2017 17:37:44 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r319233 - in vendor/clang/dist: include/clang-c include/clang/Basic include/clang/Frontend include/clang/Lex include/clang/Serialization include/clang/StaticAnalyzer/Checkers include/cl... Message-ID: <201705301737.v4UHbik6045762@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Tue May 30 17:37:44 2017 New Revision: 319233 URL: https://svnweb.freebsd.org/changeset/base/319233 Log: Vendor import of clang trunk r304222: https://llvm.org/svn/llvm-project/cfe/trunk@304222 Added: vendor/clang/dist/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp (contents, props changed) vendor/clang/dist/test/Analysis/iterator-range.cpp (contents, props changed) vendor/clang/dist/test/CodeGen/altivec-ct.c (contents, props changed) vendor/clang/dist/test/Lexer/preamble2.c (contents, props changed) vendor/clang/dist/test/Modules/Inputs/preprocess/a.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/preprocess/b.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/preprocess/c.h (contents, props changed) vendor/clang/dist/test/Modules/preprocess-nested.cpp (contents, props changed) vendor/clang/dist/test/Modules/preprocess-unavailable.cpp (contents, props changed) vendor/clang/dist/test/SemaOpenCL/arithmetic-conversions.cl Deleted: vendor/clang/dist/lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp vendor/clang/dist/test/Analysis/iterator-past-end.cpp Modified: vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Frontend/ASTUnit.h vendor/clang/dist/include/clang/Lex/Preprocessor.h vendor/clang/dist/include/clang/Lex/PreprocessorLexer.h vendor/clang/dist/include/clang/Lex/PreprocessorOptions.h vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h vendor/clang/dist/include/clang/StaticAnalyzer/Checkers/Checkers.td vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp vendor/clang/dist/lib/Frontend/ASTUnit.cpp vendor/clang/dist/lib/Frontend/SerializedDiagnosticPrinter.cpp vendor/clang/dist/lib/Headers/altivec.h vendor/clang/dist/lib/Lex/Lexer.cpp vendor/clang/dist/lib/Lex/PPDirectives.cpp vendor/clang/dist/lib/Lex/PPLexerChange.cpp vendor/clang/dist/lib/Lex/Pragma.cpp vendor/clang/dist/lib/Lex/Preprocessor.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.cpp vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CMakeLists.txt vendor/clang/dist/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ProgramState.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RegionStore.cpp vendor/clang/dist/test/Analysis/Inputs/system-header-simulator-cxx.h vendor/clang/dist/test/Analysis/diagnostics/explicit-suppression.cpp vendor/clang/dist/test/Analysis/pthreadlock.c vendor/clang/dist/test/Analysis/taint-generic.c vendor/clang/dist/test/CodeGen/arm_neon_intrinsics.c vendor/clang/dist/test/CodeGen/union-align.c vendor/clang/dist/test/CodeGenOpenCL/bool_cast.cl vendor/clang/dist/test/Lexer/preamble.c vendor/clang/dist/test/Modules/Inputs/preprocess/module.modulemap vendor/clang/dist/test/OpenMP/target_data_messages.c vendor/clang/dist/test/OpenMP/target_enter_data_map_messages.c vendor/clang/dist/test/OpenMP/target_enter_data_nowait_messages.cpp vendor/clang/dist/test/OpenMP/target_exit_data_map_messages.c vendor/clang/dist/test/OpenMP/target_exit_data_nowait_messages.cpp vendor/clang/dist/test/OpenMP/target_map_messages.cpp vendor/clang/dist/test/OpenMP/target_teams_map_messages.cpp vendor/clang/dist/test/SemaOpenCL/clang-builtin-version.cl vendor/clang/dist/test/SemaOpenCL/cond.cl vendor/clang/dist/test/SemaOpenCL/to_addr_builtin.cl vendor/clang/dist/tools/c-index-test/c-index-test.c vendor/clang/dist/tools/libclang/CIndex.cpp vendor/clang/dist/tools/libclang/libclang.exports Modified: vendor/clang/dist/include/clang-c/Index.h ============================================================================== --- vendor/clang/dist/include/clang-c/Index.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang-c/Index.h Tue May 30 17:37:44 2017 (r319233) @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 40 +#define CINDEX_VERSION_MINOR 41 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -1417,6 +1417,15 @@ enum CXSaveError { CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, const char *FileName, unsigned options); + +/** + * \brief Suspend a translation unit in order to free memory associated with it. + * + * A suspended translation unit uses significantly less memory but on the other + * side does not support any other calls than \c clang_reparseTranslationUnit + * to resume it or \c clang_disposeTranslationUnit to dispose it completely. + */ +CINDEX_LINKAGE unsigned clang_suspendTranslationUnit(CXTranslationUnit); /** * \brief Destroy the specified CXTranslationUnit object. Modified: vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/Basic/DiagnosticLexKinds.td Tue May 30 17:37:44 2017 (r319233) @@ -525,6 +525,8 @@ def err_pp_module_begin_without_module_end : Error< def err_pp_module_end_without_module_begin : Error< "no matching '#pragma clang module begin' for this " "'#pragma clang module end'">; +def note_pp_module_begin_here : Note< + "entering module '%0' due to this pragma">; def err_defined_macro_name : Error<"'defined' cannot be used as a macro name">; def err_paste_at_start : Error< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Tue May 30 17:37:44 2017 (r319233) @@ -8312,8 +8312,13 @@ def err_opencl_bitfields : Error< "bit-fields are not supported in OpenCL">; def err_opencl_vla : Error< "variable length arrays are not supported in OpenCL">; +def err_opencl_scalar_type_rank_greater_than_vector_type : Error< + "scalar operand type has greater rank than the type of the vector " + "element. (%0 and %1)">; def err_bad_kernel_param_type : Error< "%0 cannot be used as the type of a kernel parameter">; +def err_opencl_implicit_function_decl : Error< + "implicit declaration of function %0 is invalid in OpenCL">; def err_record_with_pointers_kernel_param : Error< "%select{struct|union}0 kernel parameters may not contain pointers">; def note_within_field_of_type : Note< @@ -8744,8 +8749,8 @@ def err_omp_not_mappable_type : Error< "type %0 is not mappable to target">; def err_omp_invalid_map_type_for_directive : Error< "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">; -def err_omp_no_map_for_directive : Error< - "expected at least one map clause for '#pragma omp %0'">; +def err_omp_no_clause_for_directive : Error< + "expected at least one %0 clause for '#pragma omp %1'">; def note_omp_polymorphic_in_target : Note< "mappable type cannot be polymorphic">; def note_omp_static_member_in_target : Note< Modified: vendor/clang/dist/include/clang/Frontend/ASTUnit.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/ASTUnit.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/Frontend/ASTUnit.h Tue May 30 17:37:44 2017 (r319233) @@ -878,6 +878,11 @@ class ASTUnit : public ModuleLoader { (public) ArrayRef<RemappedFile> RemappedFiles = None, IntrusiveRefCntPtr<vfs::FileSystem> VFS = nullptr); + /// \brief Free data that will be re-generated on the next parse. + /// + /// Preamble-related data is not affected. + void ResetForParse(); + /// \brief Perform code completion at the given file, line, and /// column within this translation unit. /// Modified: vendor/clang/dist/include/clang/Lex/Preprocessor.h ============================================================================== --- vendor/clang/dist/include/clang/Lex/Preprocessor.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/Lex/Preprocessor.h Tue May 30 17:37:44 2017 (r319233) @@ -283,6 +283,44 @@ class Preprocessor { /// This is used when loading a precompiled preamble. std::pair<int, bool> SkipMainFilePreamble; + class PreambleConditionalStackStore { + enum State { + Off = 0, + Recording = 1, + Replaying = 2, + }; + + public: + PreambleConditionalStackStore() : ConditionalStackState(Off) {} + + void startRecording() { ConditionalStackState = Recording; } + void startReplaying() { ConditionalStackState = Replaying; } + bool isRecording() const { return ConditionalStackState == Recording; } + bool isReplaying() const { return ConditionalStackState == Replaying; } + + ArrayRef<PPConditionalInfo> getStack() const { + return ConditionalStack; + } + + void doneReplaying() { + ConditionalStack.clear(); + ConditionalStackState = Off; + } + + void setStack(ArrayRef<PPConditionalInfo> s) { + if (!isRecording() && !isReplaying()) + return; + ConditionalStack.clear(); + ConditionalStack.append(s.begin(), s.end()); + } + + bool hasRecordedPreamble() const { return !ConditionalStack.empty(); } + + private: + SmallVector<PPConditionalInfo, 4> ConditionalStack; + State ConditionalStackState; + } PreambleConditionalStack; + /// \brief The current top of the stack that we're lexing from if /// not expanding a macro and we are lexing directly from source code. /// @@ -1695,6 +1733,11 @@ class Preprocessor { /// \brief Return true if we're in the top-level file, not in a \#include. bool isInPrimaryFile() const; + /// \brief Return true if we're in the main file (specifically, if we are 0 + /// (zero) levels deep \#include. This is used by the lexer to determine if + /// it needs to generate errors about unterminated \#if directives. + bool isInMainFile() const; + /// \brief Handle cases where the \#include name is expanded /// from a macro as multiple tokens, which need to be glued together. /// @@ -1931,6 +1974,27 @@ class Preprocessor { const FileEntry *getModuleHeaderToIncludeForDiagnostics(SourceLocation IncLoc, Module *M, SourceLocation MLoc); + + bool isRecordingPreamble() const { + return PreambleConditionalStack.isRecording(); + } + + bool hasRecordedPreamble() const { + return PreambleConditionalStack.hasRecordedPreamble(); + } + + ArrayRef<PPConditionalInfo> getPreambleConditionalStack() const { + return PreambleConditionalStack.getStack(); + } + + void setRecordedPreambleConditionalStack(ArrayRef<PPConditionalInfo> s) { + PreambleConditionalStack.setStack(s); + } + + void setReplayablePreambleConditionalStack(ArrayRef<PPConditionalInfo> s) { + PreambleConditionalStack.startReplaying(); + PreambleConditionalStack.setStack(s); + } private: // Macro handling. Modified: vendor/clang/dist/include/clang/Lex/PreprocessorLexer.h ============================================================================== --- vendor/clang/dist/include/clang/Lex/PreprocessorLexer.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/Lex/PreprocessorLexer.h Tue May 30 17:37:44 2017 (r319233) @@ -17,6 +17,7 @@ #include "clang/Lex/MultipleIncludeOpt.h" #include "clang/Lex/Token.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" namespace clang { @@ -175,6 +176,11 @@ class PreprocessorLexer { (public) } conditional_iterator conditional_end() const { return ConditionalStack.end(); + } + + void setConditionalLevels(ArrayRef<PPConditionalInfo> CL) { + ConditionalStack.clear(); + ConditionalStack.append(CL.begin(), CL.end()); } }; Modified: vendor/clang/dist/include/clang/Lex/PreprocessorOptions.h ============================================================================== --- vendor/clang/dist/include/clang/Lex/PreprocessorOptions.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/Lex/PreprocessorOptions.h Tue May 30 17:37:44 2017 (r319233) @@ -80,7 +80,14 @@ class PreprocessorOptions { (public) /// The boolean indicates whether the preamble ends at the start of a new /// line. std::pair<unsigned, bool> PrecompiledPreambleBytes; - + + /// \brief True indicates that a preamble is being generated. + /// + /// When the lexer is done, one of the things that need to be preserved is the + /// conditional #if stack, so the ASTWriter/ASTReader can save/restore it when + /// processing the rest of the file. + bool GeneratePreamble; + /// The implicit PTH input included at the start of the translation unit, or /// empty. std::string ImplicitPTHInclude; @@ -144,6 +151,7 @@ class PreprocessorOptions { (public) AllowPCHWithCompilerErrors(false), DumpDeserializedPCHDecls(false), PrecompiledPreambleBytes(0, true), + GeneratePreamble(false), RemappedFilesKeepOriginalName(true), RetainRemappedFileBuffers(false), ObjCXXARCStandardLibrary(ARCXX_nolib) { } Modified: vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h ============================================================================== --- vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h Tue May 30 17:37:44 2017 (r319233) @@ -607,6 +607,9 @@ namespace clang { /// \brief Record code for \#pragma pack options. PACK_PRAGMA_OPTIONS = 61, + + /// \brief The stack of open #ifs/#ifdefs recorded in a preamble. + PP_CONDITIONAL_STACK = 62, }; /// \brief Record types used within a source manager block. Modified: vendor/clang/dist/include/clang/StaticAnalyzer/Checkers/Checkers.td ============================================================================== --- vendor/clang/dist/include/clang/StaticAnalyzer/Checkers/Checkers.td Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/StaticAnalyzer/Checkers/Checkers.td Tue May 30 17:37:44 2017 (r319233) @@ -279,14 +279,14 @@ def VirtualCallChecker : Checker<"VirtualCall">, let ParentPackage = CplusplusAlpha in { +def IteratorRangeChecker : Checker<"IteratorRange">, + HelpText<"Check for iterators used outside their valid ranges">, + DescFile<"IteratorChecker.cpp">; + def MisusedMovedObjectChecker: Checker<"MisusedMovedObject">, HelpText<"Method calls on a moved-from object and copying a moved-from " "object will be reported">, DescFile<"MisusedMovedObjectChecker.cpp">; - -def IteratorPastEndChecker : Checker<"IteratorPastEnd">, - HelpText<"Check iterators used past end">, - DescFile<"IteratorPastEndChecker.cpp">; } // end: "alpha.cplusplus" Modified: vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h ============================================================================== --- vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h Tue May 30 17:37:44 2017 (r319233) @@ -43,6 +43,7 @@ typedef std::unique_ptr<ConstraintManager>(*Constraint ProgramStateManager &, SubEngine *); typedef std::unique_ptr<StoreManager>(*StoreManagerCreator)( ProgramStateManager &); +typedef llvm::ImmutableMap<const SubRegion*, TaintTagType> TaintedSubRegions; //===----------------------------------------------------------------------===// // ProgramStateTrait - Traits used by the Generic Data Map of a ProgramState. @@ -343,6 +344,9 @@ class ProgramState : public llvm::FoldingSetNode { (pu ProgramStateRef addTaint(const Stmt *S, const LocationContext *LCtx, TaintTagType Kind = TaintTagGeneric) const; + /// Create a new state in which the value is marked as tainted. + ProgramStateRef addTaint(SVal V, TaintTagType Kind = TaintTagGeneric) const; + /// Create a new state in which the symbol is marked as tainted. ProgramStateRef addTaint(SymbolRef S, TaintTagType Kind = TaintTagGeneric) const; @@ -351,6 +355,14 @@ class ProgramState : public llvm::FoldingSetNode { (pu ProgramStateRef addTaint(const MemRegion *R, TaintTagType Kind = TaintTagGeneric) const; + /// Create a new state in a which a sub-region of a given symbol is tainted. + /// This might be necessary when referring to regions that can not have an + /// individual symbol, e.g. if they are represented by the default binding of + /// a LazyCompoundVal. + ProgramStateRef addPartialTaint(SymbolRef ParentSym, + const SubRegion *SubRegion, + TaintTagType Kind = TaintTagGeneric) const; + /// Check if the statement is tainted in the current state. bool isTainted(const Stmt *S, const LocationContext *LCtx, TaintTagType Kind = TaintTagGeneric) const; @@ -453,6 +465,7 @@ class ProgramStateManager { (private) std::unique_ptr<ConstraintManager> ConstraintMgr; ProgramState::GenericDataMap::Factory GDMFactory; + TaintedSubRegions::Factory TSRFactory; typedef llvm::DenseMap<void*,std::pair<void*,void (*)(void*)> > GDMContextsTy; GDMContextsTy GDMContexts; Modified: vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h ============================================================================== --- vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h Tue May 30 17:37:44 2017 (r319233) @@ -35,6 +35,16 @@ template<> struct ProgramStateTrait<TaintMap> static void *GDMIndex() { static int index = 0; return &index; } }; +/// The GDM component mapping derived symbols' parent symbols to their +/// underlying regions. This is used to efficiently check whether a symbol is +/// tainted when it represents a sub-region of a tainted symbol. +struct DerivedSymTaint {}; +typedef llvm::ImmutableMap<SymbolRef, TaintedSubRegions> DerivedSymTaintImpl; +template<> struct ProgramStateTrait<DerivedSymTaint> + : public ProgramStatePartialTrait<DerivedSymTaintImpl> { + static void *GDMIndex() { static int index; return &index; } +}; + class TaintManager { TaintManager() {} Modified: vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/CodeGen/CGCoroutine.cpp Tue May 30 17:37:44 2017 (r319233) @@ -578,8 +578,7 @@ void CodeGenFunction::EmitCoroutineBody(const Coroutin EmitBlock(FinalBB); CurCoro.Data->CurrentAwaitKind = AwaitKind::Final; EmitStmt(S.getFinalSuspendStmt()); - } - else { + } else { // We don't need FinalBB. Emit it to make sure the block is deleted. EmitBlock(FinalBB, /*IsFinished=*/true); } Modified: vendor/clang/dist/lib/Frontend/ASTUnit.cpp ============================================================================== --- vendor/clang/dist/lib/Frontend/ASTUnit.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Frontend/ASTUnit.cpp Tue May 30 17:37:44 2017 (r319233) @@ -1036,8 +1036,6 @@ static void checkAndSanitizeDiags(SmallVectorImpl<Stor bool ASTUnit::Parse(std::shared_ptr<PCHContainerOperations> PCHContainerOps, std::unique_ptr<llvm::MemoryBuffer> OverrideMainBuffer, IntrusiveRefCntPtr<vfs::FileSystem> VFS) { - SavedMainFileBuffer.reset(); - if (!Invocation) return true; @@ -1090,17 +1088,11 @@ bool ASTUnit::Parse(std::shared_ptr<PCHContainerOperat Clang->createFileManager(); FileMgr = &Clang->getFileManager(); } - SourceMgr = new SourceManager(getDiagnostics(), *FileMgr, - UserFilesAreVolatile); - TheSema.reset(); - Ctx = nullptr; - PP = nullptr; - Reader = nullptr; - // Clear out old caches and data. - TopLevelDecls.clear(); - clearFileLevelDecls(); + ResetForParse(); + SourceMgr = new SourceManager(getDiagnostics(), *FileMgr, + UserFilesAreVolatile); if (!OverrideMainBuffer) { checkAndRemoveNonDriverDiags(StoredDiagnostics); TopLevelDeclsInPreamble.clear(); @@ -1999,6 +1991,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine( PreprocessorOptions &PPOpts = CI->getPreprocessorOpts(); PPOpts.RemappedFilesKeepOriginalName = RemappedFilesKeepOriginalName; PPOpts.AllowPCHWithCompilerErrors = AllowPCHWithCompilerErrors; + PPOpts.GeneratePreamble = PrecompilePreambleAfterNParses != 0; // Override the resources path. CI->getHeaderSearchOpts().ResourceDir = ResourceFilesPath; @@ -2113,6 +2106,19 @@ bool ASTUnit::Reparse(std::shared_ptr<PCHContainerOper CCTUInfo.reset(); return Result; +} + +void ASTUnit::ResetForParse() { + SavedMainFileBuffer.reset(); + + SourceMgr.reset(); + TheSema.reset(); + Ctx.reset(); + PP.reset(); + Reader.reset(); + + TopLevelDecls.clear(); + clearFileLevelDecls(); } //----------------------------------------------------------------------------// Modified: vendor/clang/dist/lib/Frontend/SerializedDiagnosticPrinter.cpp ============================================================================== --- vendor/clang/dist/lib/Frontend/SerializedDiagnosticPrinter.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Frontend/SerializedDiagnosticPrinter.cpp Tue May 30 17:37:44 2017 (r319233) @@ -506,7 +506,7 @@ void SDiagsWriter::EmitBlockInfoBlock() { Abbrev->Add(BitCodeAbbrevOp(RECORD_FILENAME)); Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped file ID. Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Size. - Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Modifcation time. + Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Modification time. Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Text size. Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // File name text. Abbrevs.set(RECORD_FILENAME, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Modified: vendor/clang/dist/lib/Headers/altivec.h ============================================================================== --- vendor/clang/dist/lib/Headers/altivec.h Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Headers/altivec.h Tue May 30 17:37:44 2017 (r319233) @@ -2887,87 +2887,79 @@ static __inline__ vector double __ATTRS_o_ai vec_cpsgn /* vec_ctf */ -static __inline__ vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) { - return __builtin_altivec_vcfsx(__a, __b); -} - -static __inline__ vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a, - int __b) { - return __builtin_altivec_vcfux((vector int)__a, __b); -} - #ifdef __VSX__ -static __inline__ vector double __ATTRS_o_ai -vec_ctf(vector unsigned long long __a, int __b) { - vector double __ret = __builtin_convertvector(__a, vector double); - __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52); - return __ret; -} - -static __inline__ vector double __ATTRS_o_ai -vec_ctf(vector signed long long __a, int __b) { - vector double __ret = __builtin_convertvector(__a, vector double); - __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52); - return __ret; -} +#define vec_ctf(__a, __b) \ + _Generic((__a), vector int \ + : (vector float)__builtin_altivec_vcfsx((__a), (__b)), \ + vector unsigned int \ + : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)), \ + vector unsigned long long \ + : (__builtin_convertvector((vector unsigned long long)(__a), \ + vector double) * \ + (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ + << 52)), \ + vector signed long long \ + : (__builtin_convertvector((vector signed long long)(__a), \ + vector double) * \ + (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ + << 52))) +#else +#define vec_ctf(__a, __b) \ + _Generic((__a), vector int \ + : (vector float)__builtin_altivec_vcfsx((__a), (__b)), \ + vector unsigned int \ + : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b))) #endif /* vec_vcfsx */ -static __inline__ vector float __attribute__((__always_inline__)) -vec_vcfsx(vector int __a, int __b) { - return __builtin_altivec_vcfsx(__a, __b); -} +#define vec_vcfux __builtin_altivec_vcfux /* vec_vcfux */ -static __inline__ vector float __attribute__((__always_inline__)) -vec_vcfux(vector unsigned int __a, int __b) { - return __builtin_altivec_vcfux((vector int)__a, __b); -} +#define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) /* vec_cts */ -static __inline__ vector int __ATTRS_o_ai vec_cts(vector float __a, int __b) { - return __builtin_altivec_vctsxs(__a, __b); -} - #ifdef __VSX__ -static __inline__ vector signed long long __ATTRS_o_ai -vec_cts(vector double __a, int __b) { - __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52); - return __builtin_convertvector(__a, vector signed long long); -} +#define vec_cts(__a, __b) \ + _Generic((__a), vector float \ + : __builtin_altivec_vctsxs((__a), (__b)), vector double \ + : __extension__({ \ + vector double __ret = \ + (__a) * \ + (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ + << 52); \ + __builtin_convertvector(__ret, vector signed long long); \ + })) +#else +#define vec_cts __builtin_altivec_vctsxs #endif /* vec_vctsxs */ -static __inline__ vector int __attribute__((__always_inline__)) -vec_vctsxs(vector float __a, int __b) { - return __builtin_altivec_vctsxs(__a, __b); -} +#define vec_vctsxs __builtin_altivec_vctsxs /* vec_ctu */ -static __inline__ vector unsigned int __ATTRS_o_ai vec_ctu(vector float __a, - int __b) { - return __builtin_altivec_vctuxs(__a, __b); -} - #ifdef __VSX__ -static __inline__ vector unsigned long long __ATTRS_o_ai -vec_ctu(vector double __a, int __b) { - __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52); - return __builtin_convertvector(__a, vector unsigned long long); -} +#define vec_ctu(__a, __b) \ + _Generic((__a), vector float \ + : __builtin_altivec_vctuxs((__a), (__b)), vector double \ + : __extension__({ \ + vector double __ret = \ + (__a) * \ + (vector double)(vector unsigned long long)((0x3ffULL + __b) \ + << 52); \ + __builtin_convertvector(__ret, vector unsigned long long); \ + })) +#else +#define vec_ctu __builtin_altivec_vctuxs #endif /* vec_vctuxs */ -static __inline__ vector unsigned int __attribute__((__always_inline__)) -vec_vctuxs(vector float __a, int __b) { - return __builtin_altivec_vctuxs(__a, __b); -} +#define vec_vctuxs __builtin_altivec_vctuxs /* vec_signed */ Modified: vendor/clang/dist/lib/Lex/Lexer.cpp ============================================================================== --- vendor/clang/dist/lib/Lex/Lexer.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Lex/Lexer.cpp Tue May 30 17:37:44 2017 (r319233) @@ -550,8 +550,6 @@ namespace { enum PreambleDirectiveKind { PDK_Skipped, - PDK_StartIf, - PDK_EndIf, PDK_Unknown }; @@ -574,8 +572,6 @@ std::pair<unsigned, bool> Lexer::ComputePreamble(Strin bool InPreprocessorDirective = false; Token TheTok; - Token IfStartTok; - unsigned IfCount = 0; SourceLocation ActiveCommentLoc; unsigned MaxLineOffset = 0; @@ -658,33 +654,18 @@ std::pair<unsigned, bool> Lexer::ComputePreamble(Strin .Case("sccs", PDK_Skipped) .Case("assert", PDK_Skipped) .Case("unassert", PDK_Skipped) - .Case("if", PDK_StartIf) - .Case("ifdef", PDK_StartIf) - .Case("ifndef", PDK_StartIf) + .Case("if", PDK_Skipped) + .Case("ifdef", PDK_Skipped) + .Case("ifndef", PDK_Skipped) .Case("elif", PDK_Skipped) .Case("else", PDK_Skipped) - .Case("endif", PDK_EndIf) + .Case("endif", PDK_Skipped) .Default(PDK_Unknown); switch (PDK) { case PDK_Skipped: continue; - case PDK_StartIf: - if (IfCount == 0) - IfStartTok = HashTok; - - ++IfCount; - continue; - - case PDK_EndIf: - // Mismatched #endif. The preamble ends here. - if (IfCount == 0) - break; - - --IfCount; - continue; - case PDK_Unknown: // We don't know what this directive is; stop at the '#'. break; @@ -705,16 +686,13 @@ std::pair<unsigned, bool> Lexer::ComputePreamble(Strin } while (true); SourceLocation End; - if (IfCount) - End = IfStartTok.getLocation(); - else if (ActiveCommentLoc.isValid()) + if (ActiveCommentLoc.isValid()) End = ActiveCommentLoc; // don't truncate a decl comment. else End = TheTok.getLocation(); return std::make_pair(End.getRawEncoding() - StartLoc.getRawEncoding(), - IfCount? IfStartTok.isAtStartOfLine() - : TheTok.isAtStartOfLine()); + TheTok.isAtStartOfLine()); } /// AdvanceToTokenCharacter - Given a location that specifies the start of a @@ -2570,6 +2548,11 @@ bool Lexer::LexEndOfFile(Token &Result, const char *Cu return true; } + if (PP->isRecordingPreamble() && !PP->isInMainFile()) { + PP->setRecordedPreambleConditionalStack(ConditionalStack); + ConditionalStack.clear(); + } + // Issue diagnostics for unterminated #if and missing newline. // If we are in a #if directive, emit an error. Modified: vendor/clang/dist/lib/Lex/PPDirectives.cpp ============================================================================== --- vendor/clang/dist/lib/Lex/PPDirectives.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Lex/PPDirectives.cpp Tue May 30 17:37:44 2017 (r319233) @@ -1906,6 +1906,25 @@ void Preprocessor::HandleIncludeDirective(SourceLocati } } + // The #included file will be considered to be a system header if either it is + // in a system include directory, or if the #includer is a system include + // header. + SrcMgr::CharacteristicKind FileCharacter = + SourceMgr.getFileCharacteristic(FilenameTok.getLocation()); + if (File) + FileCharacter = std::max(HeaderInfo.getFileDirFlavor(File), FileCharacter); + + // Ask HeaderInfo if we should enter this #include file. If not, #including + // this file will have no effect. + bool SkipHeader = false; + if (ShouldEnter && File && + !HeaderInfo.ShouldEnterIncludeFile(*this, File, isImport, + getLangOpts().Modules, + SuggestedModule.getModule())) { + ShouldEnter = false; + SkipHeader = true; + } + if (Callbacks) { // Notify the callback object that we've seen an inclusion directive. Callbacks->InclusionDirective( @@ -1913,18 +1932,13 @@ void Preprocessor::HandleIncludeDirective(SourceLocati LangOpts.MSVCCompat ? NormalizedPath.c_str() : Filename, isAngled, FilenameRange, File, SearchPath, RelativePath, ShouldEnter ? nullptr : SuggestedModule.getModule()); + if (SkipHeader && !SuggestedModule.getModule()) + Callbacks->FileSkipped(*File, FilenameTok, FileCharacter); } if (!File) return; - // The #included file will be considered to be a system header if either it is - // in a system include directory, or if the #includer is a system include - // header. - SrcMgr::CharacteristicKind FileCharacter = - std::max(HeaderInfo.getFileDirFlavor(File), - SourceMgr.getFileCharacteristic(FilenameTok.getLocation())); - // FIXME: If we have a suggested module, and we've already visited this file, // don't bother entering it again. We know it has no further effect. @@ -1962,19 +1976,6 @@ void Preprocessor::HandleIncludeDirective(SourceLocati Diag(FilenameTok, DiagId) << Path << FixItHint::CreateReplacement(Range, Path); } - } - - // Ask HeaderInfo if we should enter this #include file. If not, #including - // this file will have no effect. - bool SkipHeader = false; - if (ShouldEnter && - !HeaderInfo.ShouldEnterIncludeFile(*this, File, isImport, - getLangOpts().Modules, - SuggestedModule.getModule())) { - ShouldEnter = false; - SkipHeader = true; - if (Callbacks) - Callbacks->FileSkipped(*File, FilenameTok, FileCharacter); } // If we don't need to enter the file, stop now. Modified: vendor/clang/dist/lib/Lex/PPLexerChange.cpp ============================================================================== --- vendor/clang/dist/lib/Lex/PPLexerChange.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Lex/PPLexerChange.cpp Tue May 30 17:37:44 2017 (r319233) @@ -46,6 +46,12 @@ bool Preprocessor::isInPrimaryFile() const { }); } +bool Preprocessor::isInMainFile() const { + if (IsFileLexer()) + return IncludeMacroStack.size() == 0; + return true; +} + /// getCurrentLexer - Return the current file lexer being lexed from. Note /// that this ignores any potentially active macro expansions and _Pragma /// expansions going on at the time. Modified: vendor/clang/dist/lib/Lex/Pragma.cpp ============================================================================== --- vendor/clang/dist/lib/Lex/Pragma.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Lex/Pragma.cpp Tue May 30 17:37:44 2017 (r319233) @@ -1407,6 +1407,24 @@ struct PragmaModuleBeginHandler : public PragmaHandler M = NewM; } + // If the module isn't available, it doesn't make sense to enter it. + if (!M->isAvailable()) { + Module::Requirement Requirement; + Module::UnresolvedHeaderDirective MissingHeader; + (void)M->isAvailable(PP.getLangOpts(), PP.getTargetInfo(), + Requirement, MissingHeader); + if (MissingHeader.FileNameLoc.isValid()) { + PP.Diag(MissingHeader.FileNameLoc, diag::err_module_header_missing) + << MissingHeader.IsUmbrella << MissingHeader.FileName; + } else { + PP.Diag(M->DefinitionLoc, diag::err_module_unavailable) + << M->getFullModuleName() << Requirement.second << Requirement.first; + } + PP.Diag(BeginLoc, diag::note_pp_module_begin_here) + << M->getTopLevelModuleName(); + return; + } + // Enter the scope of the submodule. PP.EnterSubmodule(M, BeginLoc, /*ForPragma*/true); PP.EnterAnnotationToken(SourceRange(BeginLoc, ModuleName.back().second), Modified: vendor/clang/dist/lib/Lex/Preprocessor.cpp ============================================================================== --- vendor/clang/dist/lib/Lex/Preprocessor.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Lex/Preprocessor.cpp Tue May 30 17:37:44 2017 (r319233) @@ -150,6 +150,9 @@ Preprocessor::Preprocessor(std::shared_ptr<Preprocesso Ident_GetExceptionInfo = Ident_GetExceptionCode = nullptr; Ident_AbnormalTermination = nullptr; } + + if (this->PPOpts->GeneratePreamble) + PreambleConditionalStack.startRecording(); } Preprocessor::~Preprocessor() { @@ -532,6 +535,12 @@ void Preprocessor::EnterMainSourceFile() { // Start parsing the predefines. EnterSourceFile(FID, nullptr, SourceLocation()); + + // Restore the conditional stack from the preamble, if there is one. + if (PreambleConditionalStack.isReplaying()) { + CurPPLexer->setConditionalLevels(PreambleConditionalStack.getStack()); + PreambleConditionalStack.doneReplaying(); + } } void Preprocessor::EndSourceFile() { Modified: vendor/clang/dist/lib/Sema/SemaDecl.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaDecl.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Sema/SemaDecl.cpp Tue May 30 17:37:44 2017 (r319233) @@ -12509,6 +12509,9 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocati unsigned diag_id; if (II.getName().startswith("__builtin_")) diag_id = diag::warn_builtin_unknown; + // OpenCL v2.0 s6.9.u - Implicit function declaration is not supported. + else if (getLangOpts().OpenCL) + diag_id = diag::err_opencl_implicit_function_decl; else if (getLangOpts().C99) diag_id = diag::ext_implicit_function_decl; else Modified: vendor/clang/dist/lib/Sema/SemaExpr.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaExpr.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Sema/SemaExpr.cpp Tue May 30 17:37:44 2017 (r319233) @@ -8074,28 +8074,38 @@ QualType Sema::InvalidLogicalVectorOperands(SourceLoca /// rank; for C, Obj-C, and C++ we allow any real scalar conversion except /// for float->int. /// +/// OpenCL V2.0 6.2.6.p2: +/// An error shall occur if any scalar operand type has greater rank +/// than the type of the vector element. +/// /// \param scalar - if non-null, actually perform the conversions /// \return true if the operation fails (but without diagnosing the failure) static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar, QualType scalarTy, QualType vectorEltTy, - QualType vectorTy) { + QualType vectorTy, + unsigned &DiagID) { // The conversion to apply to the scalar before splatting it, // if necessary. CastKind scalarCast = CK_Invalid; if (vectorEltTy->isIntegralType(S.Context)) { + if (S.getLangOpts().OpenCL && (scalarTy->isRealFloatingType() || + (scalarTy->isIntegerType() && + S.Context.getIntegerTypeOrder(vectorEltTy, scalarTy) < 0))) { + DiagID = diag::err_opencl_scalar_type_rank_greater_than_vector_type; + return true; + } if (!scalarTy->isIntegralType(S.Context)) return true; - if (S.getLangOpts().OpenCL && - S.Context.getIntegerTypeOrder(vectorEltTy, scalarTy) < 0) - return true; scalarCast = CK_IntegralCast; } else if (vectorEltTy->isRealFloatingType()) { if (scalarTy->isRealFloatingType()) { if (S.getLangOpts().OpenCL && - S.Context.getFloatingTypeOrder(vectorEltTy, scalarTy) < 0) + S.Context.getFloatingTypeOrder(vectorEltTy, scalarTy) < 0) { + DiagID = diag::err_opencl_scalar_type_rank_greater_than_vector_type; return true; + } scalarCast = CK_FloatingCast; } else if (scalarTy->isIntegralType(S.Context)) @@ -8341,10 +8351,12 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, Ex // If there's a vector type and a scalar, try to convert the scalar to // the vector element type and splat. + unsigned DiagID = diag::err_typecheck_vector_not_convertable; if (!RHSVecType) { if (isa<ExtVectorType>(LHSVecType)) { if (!tryVectorConvertAndSplat(*this, &RHS, RHSType, - LHSVecType->getElementType(), LHSType)) + LHSVecType->getElementType(), LHSType, + DiagID)) return LHSType; } else { if (!tryGCCVectorConvertAndSplat(*this, &RHS, &LHS)) @@ -8355,7 +8367,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, Ex if (isa<ExtVectorType>(RHSVecType)) { if (!tryVectorConvertAndSplat(*this, (IsCompAssign ? nullptr : &LHS), LHSType, RHSVecType->getElementType(), - RHSType)) + RHSType, DiagID)) return RHSType; } else { if (LHS.get()->getValueKind() == VK_LValue || @@ -8431,7 +8443,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, Ex } // Otherwise, use the generic diagnostic. - Diag(Loc, diag::err_typecheck_vector_not_convertable) + Diag(Loc, DiagID) << LHSType << RHSType << LHS.get()->getSourceRange() << RHS.get()->getSourceRange(); return QualType(); Modified: vendor/clang/dist/lib/Sema/SemaOpenMP.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaOpenMP.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Sema/SemaOpenMP.cpp Tue May 30 17:37:44 2017 (r319233) @@ -5929,16 +5929,17 @@ StmtResult Sema::ActOnOpenMPTargetParallelForDirective B, DSAStack->isCancelRegion()); } -/// \brief Check for existence of a map clause in the list of clauses. -static bool HasMapClause(ArrayRef<OMPClause *> Clauses) { - for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end(); - I != E; ++I) { - if (*I != nullptr && (*I)->getClauseKind() == OMPC_map) { - return true; - } - } +/// Check for existence of a map clause in the list of clauses. +static bool hasClauses(ArrayRef<OMPClause *> Clauses, + const OpenMPClauseKind K) { + return llvm::any_of( + Clauses, [K](const OMPClause *C) { return C->getClauseKind() == K; }); +} - return false; +template <typename... Params> +static bool hasClauses(ArrayRef<OMPClause *> Clauses, const OpenMPClauseKind K, + const Params... ClauseTypes) { + return hasClauses(Clauses, K) || hasClauses(Clauses, ClauseTypes...); } StmtResult Sema::ActOnOpenMPTargetDataDirective(ArrayRef<OMPClause *> Clauses, @@ -5952,8 +5953,9 @@ StmtResult Sema::ActOnOpenMPTargetDataDirective(ArrayR // OpenMP [2.10.1, Restrictions, p. 97] // At least one map clause must appear on the directive. - if (!HasMapClause(Clauses)) { - Diag(StartLoc, diag::err_omp_no_map_for_directive) + if (!hasClauses(Clauses, OMPC_map, OMPC_use_device_ptr)) { + Diag(StartLoc, diag::err_omp_no_clause_for_directive) + << "'map' or 'use_device_ptr'" << getOpenMPDirectiveName(OMPD_target_data); return StmtError(); } @@ -5970,9 +5972,9 @@ Sema::ActOnOpenMPTargetEnterDataDirective(ArrayRef<OMP SourceLocation EndLoc) { // OpenMP [2.10.2, Restrictions, p. 99] // At least one map clause must appear on the directive. - if (!HasMapClause(Clauses)) { - Diag(StartLoc, diag::err_omp_no_map_for_directive) - << getOpenMPDirectiveName(OMPD_target_enter_data); + if (!hasClauses(Clauses, OMPC_map)) { + Diag(StartLoc, diag::err_omp_no_clause_for_directive) + << "'map'" << getOpenMPDirectiveName(OMPD_target_enter_data); return StmtError(); } @@ -5986,9 +5988,9 @@ Sema::ActOnOpenMPTargetExitDataDirective(ArrayRef<OMPC SourceLocation EndLoc) { // OpenMP [2.10.3, Restrictions, p. 102] // At least one map clause must appear on the directive. - if (!HasMapClause(Clauses)) { - Diag(StartLoc, diag::err_omp_no_map_for_directive) - << getOpenMPDirectiveName(OMPD_target_exit_data); + if (!hasClauses(Clauses, OMPC_map)) { + Diag(StartLoc, diag::err_omp_no_clause_for_directive) + << "'map'" << getOpenMPDirectiveName(OMPD_target_exit_data); return StmtError(); } @@ -5998,12 +6000,7 @@ Sema::ActOnOpenMPTargetExitDataDirective(ArrayRef<OMPC StmtResult Sema::ActOnOpenMPTargetUpdateDirective(ArrayRef<OMPClause *> Clauses, SourceLocation StartLoc, SourceLocation EndLoc) { - bool seenMotionClause = false; - for (auto *C : Clauses) { - if (C->getClauseKind() == OMPC_to || C->getClauseKind() == OMPC_from) - seenMotionClause = true; - } - if (!seenMotionClause) { + if (!hasClauses(Clauses, OMPC_to, OMPC_from)) { Diag(StartLoc, diag::err_omp_at_least_one_motion_clause_required); return StmtError(); } Modified: vendor/clang/dist/lib/Serialization/ASTReader.cpp ============================================================================== --- vendor/clang/dist/lib/Serialization/ASTReader.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Serialization/ASTReader.cpp Tue May 30 17:37:44 2017 (r319233) @@ -2925,6 +2925,21 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned Client } break; + case PP_CONDITIONAL_STACK: + if (!Record.empty()) { + SmallVector<PPConditionalInfo, 4> ConditionalStack; + for (unsigned Idx = 0, N = Record.size() - 1; Idx < N; /* in loop */) { + auto Loc = ReadSourceLocation(F, Record, Idx); + bool WasSkipping = Record[Idx++]; + bool FoundNonSkip = Record[Idx++]; + bool FoundElse = Record[Idx++]; + ConditionalStack.push_back( + {Loc, WasSkipping, FoundNonSkip, FoundElse}); + } + PP.setReplayablePreambleConditionalStack(ConditionalStack); + } + break; + case PP_COUNTER_VALUE: if (!Record.empty() && Listener) Listener->ReadCounter(F, Record[0]); Modified: vendor/clang/dist/lib/Serialization/ASTWriter.cpp ============================================================================== --- vendor/clang/dist/lib/Serialization/ASTWriter.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/Serialization/ASTWriter.cpp Tue May 30 17:37:44 2017 (r319233) @@ -1093,6 +1093,7 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES); RECORD(DELETE_EXPRS_TO_ANALYZE); RECORD(CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH); + RECORD(PP_CONDITIONAL_STACK); // SourceManager Block. BLOCK(SOURCE_MANAGER_BLOCK); @@ -2300,6 +2301,18 @@ void ASTWriter::WritePreprocessor(const Preprocessor & if (PP.getCounterValue() != 0) { RecordData::value_type Record[] = {PP.getCounterValue()}; Stream.EmitRecord(PP_COUNTER_VALUE, Record); + } + + if (PP.isRecordingPreamble() && PP.hasRecordedPreamble()) { + assert(!IsModule); + for (const auto &Cond : PP.getPreambleConditionalStack()) { + AddSourceLocation(Cond.IfLoc, Record); + Record.push_back(Cond.WasSkipping); + Record.push_back(Cond.FoundNonSkip); + Record.push_back(Cond.FoundElse); + } + Stream.EmitRecord(PP_CONDITIONAL_STACK, Record); + Record.clear(); } // Enter the preprocessor block. Modified: vendor/clang/dist/lib/StaticAnalyzer/Checkers/CMakeLists.txt ============================================================================== --- vendor/clang/dist/lib/StaticAnalyzer/Checkers/CMakeLists.txt Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/StaticAnalyzer/Checkers/CMakeLists.txt Tue May 30 17:37:44 2017 (r319233) @@ -39,7 +39,7 @@ add_clang_library(clangStaticAnalyzerCheckers GenericTaintChecker.cpp GTestChecker.cpp IdenticalExprChecker.cpp - IteratorPastEndChecker.cpp + IteratorChecker.cpp IvarInvalidationChecker.cpp LLVMConventionsChecker.cpp LocalizationChecker.cpp Modified: vendor/clang/dist/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp ============================================================================== --- vendor/clang/dist/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp Tue May 30 17:37:40 2017 (r319232) +++ vendor/clang/dist/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp Tue May 30 17:37:44 2017 (r319233) @@ -65,22 +65,9 @@ class GenericTaintChecker : public Checker< check::Pos /// and thus, is tainted. static bool isStdin(const Expr *E, CheckerContext &C); - /// This is called from getPointedToSymbol() to resolve symbol references for - /// the region underlying a LazyCompoundVal. This is the default binding - /// for the LCV, which could be a conjured symbol from a function call that *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705301737.v4UHbik6045762>