[PATCH] D13000: [libclang] Expose AutoType
skalinichev created this revision. skalinichev added a subscriber: cfe-commits. This exposes the AutoType through LibClang interface http://reviews.llvm.org/D13000 Files: bindings/python/clang/cindex.py include/clang-c/Index.h test/Index/print-type.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -90,6 +90,7 @@ TKCASE(DependentSizedArray); TKCASE(Vector); TKCASE(MemberPointer); +TKCASE(Auto); default: return CXType_Unexposed; } @@ -483,6 +484,7 @@ TKIND(DependentSizedArray); TKIND(Vector); TKIND(MemberPointer); +TKIND(Auto); } #undef TKIND return cxstring::createRef(s); Index: test/Index/print-type.cpp === --- test/Index/print-type.cpp +++ test/Index/print-type.cpp @@ -127,20 +127,20 @@ // CHECK: StructDecl=Blob:45:8 (Definition) [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] // CHECK: FieldDecl=i:46:7 (Definition) [type=int] [typekind=Int] [isPOD=1] // CHECK: VarDecl=member_pointer:49:12 (Definition) [type=int Blob::*] [typekind=MemberPointer] [isPOD=1] -// CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Unexposed] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] -// CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Unexposed] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: CallExpr=tbar:35:3 [type=int] [typekind=Unexposed] [canonicaltype=int] [canonicaltypekind=Int] [args= [int] [Int]] [isPOD=1] // CHECK: UnexposedExpr=tbar:35:3 [type=int (*)(int)] [typekind=Pointer] [canonicaltype=int (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] [pointeetype=int (int)] [pointeekind=FunctionProto] // CHECK: DeclRefExpr=tbar:35:3 RefName=[54:17 - 54:21] RefName=[54:21 - 54:26] [type=int (int)] [typekind=FunctionProto] [canonicaltype=int (int)] [canonicaltypekind=FunctionProto] [isPOD=0] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] -// CHECK: VarDecl=autoBlob:55:6 (Definition) [type=Blob *] [typekind=Unexposed] [canonicaltype=Blob *] [canonicaltypekind=Pointer] [isPOD=1] +// CHECK: VarDecl=autoBlob:55:6 (Definition) [type=Blob *] [typekind=Auto] [canonicaltype=Blob *] [canonicaltypekind=Pointer] [isPOD=1] // CHECK: CXXNewExpr= [type=Blob *] [typekind=Pointer] [isPOD=1] [pointeetype=Blob] [pointeekind=Record] // CHECK: TypeRef=struct Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] // CHECK: CallExpr=Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] [nbFields=2] -// CHECK: FunctionDecl=autoFunction:56:6 (Definition) [type=int ()] [typekind=FunctionProto] [canonicaltype=int ()] [canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Unexposed] [isPOD=0] +// CHECK: FunctionDecl=autoFunction:56:6 (Definition) [type=int ()] [typekind=FunctionProto] [canonicaltype=int ()] [canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Auto] [isPOD=0] // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: ReturnStmt= [type=] [typekind=Invalid] [isPOD=0] // CHECK: UnexposedExpr= [type=int] [typekind=Int] [isPOD=1] -// CHECK: VarDecl=autoInt:57:16 (Definition) [type=int] [typekind=Unexposed] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] +// CHECK: VarDecl=autoInt:57:16 (Definition) [type=int] [typekind=Auto] [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1] Index: include/clang-c/Index.h === --- include/clang-c/Index.h +++ include/clang-c/Index.h @@ -2860,7 +2860,8 @@ CXType_IncompleteArray = 114, CXType_VariableArray = 115, CXType_DependentSizedArray = 116, - CXType_MemberPointer = 117 + CXType_MemberPointer = 117, + CXType_Auto = 118 }; /** Index: bindings/python/clang/cindex.py === --- bindings/python/clang/cindex.py +++ bindings/python/clang/cindex.py @@ -1675,6 +1675,7 @@ TypeKind.VARIABLEARRAY = TypeKind(115) TypeKind.DEPENDENTSIZEDARRAY = TypeKind(116) TypeKind.MEMBERPOINTER = TypeKind(117) +TypeKind.AUTO = TypeKind(118) class RefQualifierKind(BaseEnumeration): """Describes a specific ref-qualifier of a type.""" Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -90,6 +90,7 @@ TKCASE(DependentSizedArray); TKCASE(Vector); TKCASE(MemberPoi
[PATCH] D13001: [libclang] Handle AutoType in clang_getTypeDeclaration
skalinichev created this revision. skalinichev added a subscriber: cfe-commits. Now that auto type is fixed by D11976, it also makes sense to support it in clang_getTypeDeclaration. I couldn't find any existing tests for this method, so no tests added... http://reviews.llvm.org/D13001 Files: tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -411,7 +411,13 @@ D = cast(TP)->getTemplateName() .getAsTemplateDecl(); break; - + + case Type::Auto: +TP = cast(TP)->getDeducedType().getTypePtrOrNull(); +if (TP) + goto try_again; +break; + case Type::InjectedClassName: D = cast(TP)->getDecl(); break; Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -411,7 +411,13 @@ D = cast(TP)->getTemplateName() .getAsTemplateDecl(); break; - + + case Type::Auto: +TP = cast(TP)->getDeducedType().getTypePtrOrNull(); +if (TP) + goto try_again; +break; + case Type::InjectedClassName: D = cast(TP)->getDecl(); break; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12895: Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL.
mclow.lists accepted this revision. mclow.lists added a comment. This revision is now accepted and ready to land. This looks good to me. http://reviews.llvm.org/D12895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r248127 - Module debugging: Support submodules in the PCM/PCH debug info.
Author: adrian Date: Sun Sep 20 11:51:35 2015 New Revision: 248127 URL: http://llvm.org/viewvc/llvm-project?rev=248127&view=rev Log: Module debugging: Support submodules in the PCM/PCH debug info. Added: cfe/trunk/test/Modules/DebugInfoSubmodules.c cfe/trunk/test/Modules/Inputs/DebugSubmoduleA.h cfe/trunk/test/Modules/Inputs/DebugSubmoduleB.h Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp cfe/trunk/test/Modules/Inputs/module.map Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=248127&r1=248126&r2=248127&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sun Sep 20 11:51:35 2015 @@ -28,6 +28,7 @@ #include "clang/Basic/Version.h" #include "clang/Frontend/CodeGenOptions.h" #include "clang/Lex/HeaderSearchOptions.h" +#include "clang/Lex/ModuleMap.h" #include "clang/Lex/PreprocessorOptions.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" @@ -2159,17 +2160,34 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI } llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) { - if (!DebugTypeExtRefs || !D->isFromASTFile()) -return nullptr; + ExternalASTSource::ASTSourceDescriptor Info; + if (ClangModuleMap) { +// We are building a clang module or a precompiled header. +// +// TODO: When D is a CXXRecordDecl or a C++ Enum, the ODR applies +// and it wouldn't be necessary to specify the parent scope +// because the type is already unique by definition (it would look +// like the output of -fno-standalone-debug). On the other hand, +// the parent scope helps a consumer to quickly locate the object +// file where the type's definition is located, so it might be +// best to make this behavior a command line or debugger tuning +// option. +FullSourceLoc Loc(D->getLocation(), CGM.getContext().getSourceManager()); +if (Module *M = ClangModuleMap->inferModuleFromLocation(Loc)) { + auto Info = ExternalASTSource::ASTSourceDescriptor(*M); + return getOrCreateModuleRef(Info, /*SkeletonCU=*/false); +} + } - // Record a reference to an imported clang module or precompiled header. - llvm::DIModule *ModuleRef = nullptr; - auto *Reader = CGM.getContext().getExternalSource(); - auto Idx = D->getOwningModuleID(); - auto Info = Reader->getSourceDescriptor(Idx); - if (Info) -ModuleRef = getOrCreateModuleRef(*Info, true); - return ModuleRef; + if (DebugTypeExtRefs && D->isFromASTFile()) { +// Record a reference to an imported clang module or precompiled header. +auto *Reader = CGM.getContext().getExternalSource(); +auto Idx = D->getOwningModuleID(); +auto Info = Reader->getSourceDescriptor(Idx); +if (Info) + return getOrCreateModuleRef(*Info, /*SkeletonCU=*/true); + } + return nullptr; } llvm::DIType *CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile *Unit) { Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=248127&r1=248126&r2=248127&view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Sun Sep 20 11:51:35 2015 @@ -32,12 +32,13 @@ class MDNode; namespace clang { class CXXMethodDecl; -class VarDecl; -class ObjCInterfaceDecl; -class ObjCIvarDecl; class ClassTemplateSpecializationDecl; class GlobalDecl; +class ModuleMap; +class ObjCInterfaceDecl; +class ObjCIvarDecl; class UsingDecl; +class VarDecl; namespace CodeGen { class CodeGenModule; @@ -55,6 +56,7 @@ class CGDebugInfo { bool DebugTypeExtRefs; llvm::DIBuilder DBuilder; llvm::DICompileUnit *TheCU = nullptr; + ModuleMap *ClangModuleMap = nullptr; SourceLocation CurLoc; llvm::DIType *VTablePtrType = nullptr; llvm::DIType *ClassTy = nullptr; @@ -274,6 +276,11 @@ public: void finalize(); + /// When generating debug information for a clang module or + /// precompiled header, this module map will be used to determine + /// the module of origin of each Decl. + void setModuleMap(ModuleMap &MMap) { ClangModuleMap = &MMap; } + /// Update the current source location. If \arg loc is invalid it is /// ignored. void setLocation(SourceLocation Loc); Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=248127&r1=248126&r2=248127&view=diff == --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original) +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.
Re: [PATCH] D12839: Extend MoveConstructorInitCheck to also flag constructor arguments passed by value and can be moved assigned to fields.
flx updated this revision to Diff 35204. flx marked 10 inline comments as done. http://reviews.llvm.org/D12839 Files: clang-tidy/misc/MoveConstructorInitCheck.cpp clang-tidy/misc/MoveConstructorInitCheck.h clang-tidy/utils/CMakeLists.txt clang-tidy/utils/Matchers.h clang-tidy/utils/TypeTraits.cpp clang-tidy/utils/TypeTraits.h docs/clang-tidy/checks/misc-move-constructor-init.rst test/clang-tidy/misc-move-constructor-init.cpp Index: test/clang-tidy/misc-move-constructor-init.cpp === --- test/clang-tidy/misc-move-constructor-init.cpp +++ test/clang-tidy/misc-move-constructor-init.cpp @@ -76,3 +76,59 @@ B Mem; N(N &&RHS) : Mem(move(RHS.Mem)) {} }; + +struct Movable { + Movable(Movable &&) = default; + Movable(const Movable &) = default; + Movable &operator=(const Movable &) = default; + ~Movable() {} +}; + +struct TriviallyCopyable { + TriviallyCopyable() = default; + TriviallyCopyable(TriviallyCopyable &&) = default; + TriviallyCopyable(const TriviallyCopyable &) = default; +}; + +struct Positive { + Positive(Movable M) : M_(M) {} + // CHECK-MESSAGES: [[@LINE-1]]:28: warning: value argument can be moved to avoid copy [misc-move-constructor-init] + Movable M_; +}; + +struct NegativeMultipleInitializerReferences { + NegativeMultipleInitializerReferences(Movable M) : M_(M), n_(M) {} + Movable M_; + Movable n_; +}; + +struct NegativeReferencedInConstructorBody { + NegativeReferencedInConstructorBody(Movable M) : M_(M) { M_ = M; } + Movable M_; +}; + +struct NegativeParamTriviallyCopyable { + NegativeParamTriviallyCopyable(TriviallyCopyable T) : T_(T) {} + NegativeParamTriviallyCopyable(int I) : I_(I) {} + TriviallyCopyable T_; + int I_; +}; + +struct NegativeNotPassedByValue { + NegativeNotPassedByValue(const Movable &M) : M_(M) {} + NegativeNotPassedByValue(const Movable M) : M_(M) {} + NegativeNotPassedByValue(Movable &M) : M_(M) {} + NegativeNotPassedByValue(Movable *M) : M_(*M) {} + NegativeNotPassedByValue(const Movable *M) : M_(*M) {} + Movable M_; +}; + +struct Immovable { + Immovable(const Immovable &) = default; + Immovable(Immovable &&) = delete; +}; + +struct NegativeImmovableParameter { + NegativeImmovableParameter(Immovable I) : I_(I) {} + Immovable I_; +}; Index: docs/clang-tidy/checks/misc-move-constructor-init.rst === --- docs/clang-tidy/checks/misc-move-constructor-init.rst +++ docs/clang-tidy/checks/misc-move-constructor-init.rst @@ -5,3 +5,6 @@ The check flags user-defined move constructors that have a ctor-initializer initializing a member or base class through a copy constructor instead of a move constructor. + +It also flags constructor arguments that are passed by value, have a non-deleted +move-constructor and are assigned to a class field by copy construction. Index: clang-tidy/utils/TypeTraits.h === --- clang-tidy/utils/TypeTraits.h +++ clang-tidy/utils/TypeTraits.h @@ -0,0 +1,31 @@ +//===--- TypeTraits.h - clang-tidy---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_TYPETRAITS_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_TYPETRAITS_H + +#include "clang/AST/ASTContext.h" +#include "clang/AST/Type.h" + +namespace clang { +namespace tidy { +namespace type_traits { + +/// Returns true if \c Type is defined has no non-trivial copy-constructor or +/// destructor. +bool classHasTrivialCopyAndDestroy(QualType Type); + +// \brief Returns true If \c Type is expensive to copy. +bool isExpensiveToCopy(QualType Type, ASTContext &Context); + +} // type_traits +} // namespace tidy +} // namespace clang + +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_TYPETRAITS_H Index: clang-tidy/utils/TypeTraits.cpp === --- clang-tidy/utils/TypeTraits.cpp +++ clang-tidy/utils/TypeTraits.cpp @@ -0,0 +1,38 @@ +//===--- TypeTraits.cpp - clang-tidy---===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "TypeTraits.h" +#include "clang/AST/ASTContext.h" +#include "clang/AST/DeclCXX.h" + +namespace clang { +namespace tidy { +namespace type_traits { + +bool classHasTrivialCopyAndDestroy(QualType Type) { + auto *Record = Type->getAsCXXRecordDecl(); + return Record && Record->hasDefinition() && + !Record->hasNonTrivialCopyCons
Re: [PATCH] D12839: Extend MoveConstructorInitCheck to also flag constructor arguments passed by value and can be moved assigned to fields.
flx added inline comments. Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:38 @@ +37,3 @@ + Node.isTriviallyCopyableType(Finder->getASTContext()) || + classHasTrivialCopyAndDestroy(Node)) { +return false; aaron.ballman wrote: > Why do you need classHasTrivialCopyAndDestroy() when you're already checking > if it's a trivially copyable type? We also want to catch types that have non-trivial destructors which would be executed when the temporary copy goes out of scope. Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:44 @@ +43,3 @@ + +int parmVarDeclRefExprOccurences(const ParmVarDecl &MovableParam, + const CXXConstructorDecl &ConstructorDecl, aaron.ballman wrote: > Should return unsigned, please. Done. Is this an llvm convention? Comment at: clang-tidy/misc/MoveConstructorInitCheck.cpp:120 @@ +119,3 @@ + } + diag(InitArg->getLocStart(), "value parameter can be moved to avoid copy."); +} alexfh wrote: > alexfh wrote: > > aaron.ballman wrote: > > > Perhaps: "argument can be moved to avoid a copy" instead? > > nit: Please remove the trailing period. > Does anything stop us from suggesting fixes here (inserting "std::move()" > around the argument and #include , if it's no there yet)? How would I tread in the IncludeOrder style (i.e. Google vs LLVM)? Should this be a flag shared by all of ClangTidy or specific to this check? Comment at: test/clang-tidy/misc-move-constructor-init.cpp:85 @@ +84,3 @@ + Movable& operator =(const Movable&) = default; + ~Movable() {} +}; aaron.ballman wrote: > Why not = default? We need to make the type non-trivially copyable by our definition above. Comment at: test/clang-tidy/misc-move-constructor-init.cpp:113 @@ +112,3 @@ + +struct NegativeParamTriviallyCopyable { + NegativeParamTriviallyCopyable(TriviallyCopyable T) : T_(T) {} aaron.ballman wrote: > Should also have a test for scalars Added. http://reviews.llvm.org/D12839 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r248129 - Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL.
Author: nico Date: Sun Sep 20 13:10:46 2015 New Revision: 248129 URL: http://llvm.org/viewvc/llvm-project?rev=248129&view=rev Log: Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL. libstdc++ needs a few typedefs in malloc_alloc. MSVC's STL needs rebind(), construct(), destroy(). MSVC2013 also has no snprintf, but it exists in 2015. Modified: libcxxabi/trunk/src/cxa_demangle.cpp Modified: libcxxabi/trunk/src/cxa_demangle.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=248129&r1=248128&r2=248129&view=diff == --- libcxxabi/trunk/src/cxa_demangle.cpp (original) +++ libcxxabi/trunk/src/cxa_demangle.cpp Sun Sep 20 13:10:46 2015 @@ -18,6 +18,13 @@ #include #include +#ifdef _MSC_VER +// snprintf is implemented in VS 2015 +#if _MSC_VER < 1900 +#define snprintf _snprintf_s +#endif +#endif + namespace __cxxabiv1 { @@ -4818,6 +4825,12 @@ class malloc_alloc { public: typedef T value_type; +typedef T& reference; +typedef const T& const_reference; +typedef T* pointer; +typedef const T* const_pointer; +typedef std::size_t size_type; +typedef std::ptrdiff_t difference_type; malloc_alloc() = default; template malloc_alloc(const malloc_alloc&) noexcept {} @@ -4830,6 +4843,17 @@ public: { std::free(p); } + +template struct rebind { using other = malloc_alloc; }; +template +void construct(U* p, Args&&... args) +{ +::new ((void*)p) U(std::forward(args)...); +} +void destroy(T* p) +{ +p->~T(); +} }; template ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12895: Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL.
thakis closed this revision. thakis added a comment. r248129, thanks! http://reviews.llvm.org/D12895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12761: MPI-Checker patch for Clang Static Analyzer
Alexander_Droste marked 2 inline comments as done. Comment at: tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp:137 @@ +136,3 @@ + + // This is never reached... + llvm::outs() << "" I figured out what the problem about the request retrieval is: `REGISTER_MAP_WITH_PROGRAMSTATE(RequestMap, const clang::ento::clang::mpi::Request)` The documentation states: "The macro should not be used inside namespaces, or for traits that must be accessible from more than one translation unit." I think I need some advice here, how to make the same RequestMap accessible in multiple translation units. http://reviews.llvm.org/D12761 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r248137 - Don't pass StringRefs around by const reference. Pass by value instead per coding standards. NFC
Author: ctopper Date: Sun Sep 20 19:20:04 2015 New Revision: 248137 URL: http://llvm.org/viewvc/llvm-project?rev=248137&view=rev Log: Don't pass StringRefs around by const reference. Pass by value instead per coding standards. NFC Modified: cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=248137&r1=248136&r2=248137&view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Sun Sep 20 19:20:04 2015 @@ -1670,7 +1670,7 @@ static void AddGoldPlugin(const ToolChai /// parameter in reciprocal argument strings. Return false if there is an error /// parsing the refinement step. Otherwise, return true and set the Position /// of the refinement step in the input string. -static bool getRefinementStep(const StringRef &In, const Driver &D, +static bool getRefinementStep(StringRef In, const Driver &D, const Arg &A, size_t &Position) { const char RefinementStepToken = ':'; Position = In.find(RefinementStepToken); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r248138 - Pass SourceLocation by value instead of by const reference since its just a 32-bit integer. NFC
Author: ctopper Date: Sun Sep 20 20:23:32 2015 New Revision: 248138 URL: http://llvm.org/viewvc/llvm-project?rev=248138&view=rev Log: Pass SourceLocation by value instead of by const reference since its just a 32-bit integer. NFC Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=248138&r1=248137&r2=248138&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Sun Sep 20 20:23:32 2015 @@ -2388,7 +2388,7 @@ private: bool SetVarAndLB(VarDecl *NewVar, DeclRefExpr *NewVarRefExpr, Expr *NewLB); /// \brief Helper to set upper bound. bool SetUB(Expr *NewUB, bool LessOp, bool StrictOp, const SourceRange &SR, - const SourceLocation &SL); + SourceLocation SL); /// \brief Helper to set loop increment. bool SetStep(Expr *NewStep, bool Subtract); }; @@ -2440,7 +2440,7 @@ bool OpenMPIterationSpaceChecker::SetVar bool OpenMPIterationSpaceChecker::SetUB(Expr *NewUB, bool LessOp, bool StrictOp, const SourceRange &SR, -const SourceLocation &SL) { +SourceLocation SL) { // State consistency checking to ensure correct usage. assert(Var != nullptr && LB != nullptr && UB == nullptr && Step == nullptr && !TestIsLessOp && !TestIsStrictOp); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r248139 - Pass SourceLocation by value instead of by const reference since its just a 32-bit integer. NFC
Author: ctopper Date: Sun Sep 20 20:33:03 2015 New Revision: 248139 URL: http://llvm.org/viewvc/llvm-project?rev=248139&view=rev Log: Pass SourceLocation by value instead of by const reference since its just a 32-bit integer. NFC Modified: clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp clang-tools-extra/trunk/clang-modernize/Core/Transform.h clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp Modified: clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp?rev=248139&r1=248138&r2=248139&view=diff == --- clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp (original) +++ clang-tools-extra/trunk/clang-modernize/Core/Transform.cpp Sun Sep 20 20:33:03 2015 @@ -85,7 +85,7 @@ Transform::Transform(llvm::StringRef Nam Transform::~Transform() {} bool Transform::isFileModifiable(const SourceManager &SM, - const SourceLocation &Loc) const { + SourceLocation Loc) const { if (SM.isWrittenInMainFile(Loc)) return true; Modified: clang-tools-extra/trunk/clang-modernize/Core/Transform.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/Transform.h?rev=248139&r1=248138&r2=248139&view=diff == --- clang-tools-extra/trunk/clang-modernize/Core/Transform.h (original) +++ clang-tools-extra/trunk/clang-modernize/Core/Transform.h Sun Sep 20 20:33:03 2015 @@ -135,7 +135,7 @@ public: /// \brief Tests if the file containing \a Loc is allowed to be modified by /// the Modernizer. bool isFileModifiable(const clang::SourceManager &SM, -const clang::SourceLocation &Loc) const; +clang::SourceLocation Loc) const; /// \brief Whether a transformation with a risk level of \p RiskLevel is /// acceptable or not. Modified: clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp?rev=248139&r1=248138&r2=248139&view=diff == --- clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp Sun Sep 20 20:33:03 2015 @@ -203,7 +203,7 @@ std::string joinParameterNames( void formatDifferingParamsDiagnostic( InconsistentDeclarationParameterNameCheck *Check, -const SourceLocation &Location, StringRef OtherDeclarationDescription, +SourceLocation Location, StringRef OtherDeclarationDescription, const DifferingParamsContainer &DifferingParams) { auto ChooseOtherName = [](const DifferingParamInfo &ParamInfo) { return ParamInfo.OtherName; }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D10305: [Clang Static Analyzer] Bug identification
babati added a comment. Hi Sorry for the late answer. > Can you please rebase this patch based on http://reviews.llvm.org/D12673? Yes, I can. The patch will comes soon. > How do you expect this to work? i.e. would bug_id_1 always be generated along > with new improved bug_ids in the same plist file or would you expect the new > bug_ids to replace old ones. I think, the newly introduced bugids should be generated along with the older ones. > I am hoping that the analyzer will always keep generating old bug_ids so that > we can maintain backwards compatibility. I agree with this. http://reviews.llvm.org/D10305 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11182: [OPENMP 4.0] Initial support for 'omp declare reduction' construct.
ABataev added a comment. Ping http://reviews.llvm.org/D11182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D10599: [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.
ABataev added a comment. Ping http://reviews.llvm.org/D10599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r248142 - clang/test/Modules/DebugInfoSubmodules.c REQUIRES asserts due to -debug-only.
Author: chapuni Date: Mon Sep 21 01:57:36 2015 New Revision: 248142 URL: http://llvm.org/viewvc/llvm-project?rev=248142&view=rev Log: clang/test/Modules/DebugInfoSubmodules.c REQUIRES asserts due to -debug-only. Modified: cfe/trunk/test/Modules/DebugInfoSubmodules.c Modified: cfe/trunk/test/Modules/DebugInfoSubmodules.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/DebugInfoSubmodules.c?rev=248142&r1=248141&r2=248142&view=diff == --- cfe/trunk/test/Modules/DebugInfoSubmodules.c (original) +++ cfe/trunk/test/Modules/DebugInfoSubmodules.c Mon Sep 21 01:57:36 2015 @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -fmodules -fmodule-format=obj -g -dwarf-ext-refs \ // RUN: -fimplicit-module-maps -x c -fmodules-cache-path=%t -I %S/Inputs \ // RUN: %s -mllvm -debug-only=pchcontainer 2>&1 | FileCheck %s +// REQUIRES: asserts #include "DebugSubmoduleA.h" // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A", ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits