[PATCH] D24703: [clang-format] BreakBeforeBinaryOperations and AlignAfterOpenBracket conflict, bug 30304
daphnediane created this revision. daphnediane added a reviewer: djasper. daphnediane added a subscriber: cfe-commits. Herald added a subscriber: klimek. Fix for the formatting options combination of BreakBeforeBinaryOperators: All, AlignAfterOpenBracket: AlwaysBreak not handling long templates correctly. This patch allows a break after an opening left parenthesis, TemplateOpener, or bracket when both options are enabled. https://reviews.llvm.org/D24703 Files: lib/Format/TokenAnnotator.cpp Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -2513,9 +2513,11 @@ return true; if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && !Left.isOneOf(tok::arrowstar, tok::lessless) && - Style.BreakBeforeBinaryOperators != FormatStyle::BOS_All && - (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None || - Left.getPrecedence() == prec::Assignment)) + ((Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak && +Left.isOneOf(tok::l_paren, TT_TemplateOpener, tok::l_square)) || + (Style.BreakBeforeBinaryOperators != FormatStyle::BOS_All && +(Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None || + Left.getPrecedence() == prec::Assignment return true; return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, tok::kw_class, tok::kw_struct, tok::comment) || Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -2513,9 +2513,11 @@ return true; if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && !Left.isOneOf(tok::arrowstar, tok::lessless) && - Style.BreakBeforeBinaryOperators != FormatStyle::BOS_All && - (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None || - Left.getPrecedence() == prec::Assignment)) + ((Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak && +Left.isOneOf(tok::l_paren, TT_TemplateOpener, tok::l_square)) || + (Style.BreakBeforeBinaryOperators != FormatStyle::BOS_All && +(Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None || + Left.getPrecedence() == prec::Assignment return true; return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, tok::kw_class, tok::kw_struct, tok::comment) || ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24704: PR30401: Fix substitutions for functions with abi_tag
DmitryPolukhin created this revision. DmitryPolukhin added a reviewer: rsmith. DmitryPolukhin added subscribers: cfe-commits, andreybokhanko. Recursive mangling should use all existing substitutions and newly created substitutions should be copied outer mangler. This patch should fix PR30401 and related cases but unfortunately it is ABI breaking change for Clang backward compatibility (I hope it is rare case in practice). Perhaps this patch will have to be back ported to 3.9. https://reviews.llvm.org/D24704 Files: lib/AST/ItaniumMangle.cpp test/CodeGenCXX/mangle-abi-tag.cpp Index: test/CodeGenCXX/mangle-abi-tag.cpp === --- test/CodeGenCXX/mangle-abi-tag.cpp +++ test/CodeGenCXX/mangle-abi-tag.cpp @@ -203,3 +203,19 @@ } // A18::operator A[abi:A][abi:B]() but GCC adds the same tags twice! // CHECK-DAG: define linkonce_odr {{.+}} @_ZN3A18cv1AB1AB1BEv( + +namespace N19 { + class A {}; + class __attribute__((abi_tag("B"))) B {}; + class D {}; + class F {}; + + template + class C {}; + + B foo(A, D); +} +void f19_test(N19::C, N19::F, N19::D) { +} +// f19_test(N19::C, N19::F, N19::D) +// CHECK-DAG: define void @_Z8f19_testN3N191CINS_1AEXadL_ZNS_3fooB1BES1_NS_1DENS_1FES2_( Index: lib/AST/ItaniumMangle.cpp === --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -405,12 +405,14 @@ CXXNameMangler(CXXNameMangler &Outer, raw_ostream &Out_) : Context(Outer.Context), Out(Out_), NullOut(false), Structor(Outer.Structor), StructorType(Outer.StructorType), -SeqID(Outer.SeqID), AbiTagsRoot(AbiTags) {} +SeqID(Outer.SeqID), AbiTagsRoot(AbiTags), +Substitutions(Outer.Substitutions) {} CXXNameMangler(CXXNameMangler &Outer, llvm::raw_null_ostream &Out_) : Context(Outer.Context), Out(Out_), NullOut(true), Structor(Outer.Structor), StructorType(Outer.StructorType), -SeqID(Outer.SeqID), AbiTagsRoot(AbiTags) {} +SeqID(Outer.SeqID), AbiTagsRoot(AbiTags), +Substitutions(Outer.Substitutions) {} #if MANGLE_CHECKER ~CXXNameMangler() { @@ -458,6 +460,7 @@ void addSubstitution(QualType T); void addSubstitution(TemplateName Template); void addSubstitution(uintptr_t Ptr); + void extendSubstitutions(const CXXNameMangler& Other); void mangleUnresolvedPrefix(NestedNameSpecifier *qualifier, bool recursive = false); @@ -685,6 +688,10 @@ // Output name with implicit tags and function encoding from temporary buffer. mangleNameWithAbiTags(FD, &AdditionalAbiTags); Out << FunctionEncodingStream.str().substr(EncodingPositionStart); + + // Function encoding could create new substitutions so we have to add + // temp mangled substitutions to main mangler. + extendSubstitutions(FunctionEncodingMangler); } void CXXNameMangler::mangleFunctionEncodingBareType(const FunctionDecl *FD) { @@ -4426,6 +4433,14 @@ Substitutions[Ptr] = SeqID++; } +void CXXNameMangler::extendSubstitutions(const CXXNameMangler& Other) { + assert(Other.SeqID >= SeqID && "Must be superset of substitutions!"); + if (Other.SeqID > SeqID) { +Substitutions = Other.Substitutions; +SeqID = Other.SeqID; + } +} + CXXNameMangler::AbiTagList CXXNameMangler::makeFunctionReturnTypeTags(const FunctionDecl *FD) { // When derived abi tags are disabled there is no need to make any list. Index: test/CodeGenCXX/mangle-abi-tag.cpp === --- test/CodeGenCXX/mangle-abi-tag.cpp +++ test/CodeGenCXX/mangle-abi-tag.cpp @@ -203,3 +203,19 @@ } // A18::operator A[abi:A][abi:B]() but GCC adds the same tags twice! // CHECK-DAG: define linkonce_odr {{.+}} @_ZN3A18cv1AB1AB1BEv( + +namespace N19 { + class A {}; + class __attribute__((abi_tag("B"))) B {}; + class D {}; + class F {}; + + template + class C {}; + + B foo(A, D); +} +void f19_test(N19::C, N19::F, N19::D) { +} +// f19_test(N19::C, N19::F, N19::D) +// CHECK-DAG: define void @_Z8f19_testN3N191CINS_1AEXadL_ZNS_3fooB1BES1_NS_1DENS_1FES2_( Index: lib/AST/ItaniumMangle.cpp === --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -405,12 +405,14 @@ CXXNameMangler(CXXNameMangler &Outer, raw_ostream &Out_) : Context(Outer.Context), Out(Out_), NullOut(false), Structor(Outer.Structor), StructorType(Outer.StructorType), -SeqID(Outer.SeqID), AbiTagsRoot(AbiTags) {} +SeqID(Outer.SeqID), AbiTagsRoot(AbiTags), +Substitutions(Outer.Substitutions) {} CXXNameMangler(CXXNameMangler &Outer, llvm::raw_null_ostream &Out_) : Context(Outer.Context), Out(Out_), NullOut(true), Structor(Outer.Structor), StructorType(Outer.StructorType), -SeqID(Outer.SeqID), AbiTagsRoot(AbiTags) {} +SeqID(Outer.SeqID), AbiTagsRoot(AbiTags),
Re: [PATCH] D21506: [analyzer] Block in critical section
zdtorok added a comment. As it's my first contribution I think I have no commit access. So far I could not test it on larger codebase. I've tried to do so on clang but my computer was too slow for that. I will try it again. What you mean by alpha-phase? What should be the next steps now? Repository: rL LLVM https://reviews.llvm.org/D21506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r281854 - CodeGen: mark ObjC cstring literals as constant
Author: compnerd Date: Sun Sep 18 11:12:04 2016 New Revision: 281854 URL: http://llvm.org/viewvc/llvm-project?rev=281854&view=rev Log: CodeGen: mark ObjC cstring literals as constant These strings are constants, mark them as such. This doesn't matter too much in practice on MachO since the constants are placed into a special section and not referred to directly. Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp cfe/trunk/test/CodeGenObjC/boxing.m cfe/trunk/test/CodeGenObjC/complex-property.m cfe/trunk/test/CodeGenObjC/encode-cstyle-method.m cfe/trunk/test/CodeGenObjC/encode-test-6.m cfe/trunk/test/CodeGenObjC/encode-test.m cfe/trunk/test/CodeGenObjC/fragile-arc.m cfe/trunk/test/CodeGenObjC/ivar-layout-64.m cfe/trunk/test/CodeGenObjC/metadata-symbols-32.m cfe/trunk/test/CodeGenObjC/metadata-symbols-64.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-ios.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-mac.m cfe/trunk/test/CodeGenObjC/objc-asm-attribute-test.m cfe/trunk/test/CodeGenObjC/property-list-in-extension.m cfe/trunk/test/CodeGenObjC/reorder-synthesized-ivars.m cfe/trunk/test/CodeGenObjCXX/encode.mm cfe/trunk/test/CodeGenObjCXX/lambda-expressions.mm Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=281854&r1=281853&r2=281854&view=diff == --- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original) +++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sun Sep 18 11:12:04 2016 @@ -3691,7 +3691,8 @@ CGObjCCommonMac::CreateCStringLiteral(St llvm::Constant *Value = llvm::ConstantDataArray::getString(VMContext, Name); llvm::GlobalVariable *GV = - new llvm::GlobalVariable(CGM.getModule(), Value->getType(), false, + new llvm::GlobalVariable(CGM.getModule(), Value->getType(), + /*isConstant=*/true, llvm::GlobalValue::PrivateLinkage, Value, Label); GV->setSection(Section); GV->setAlignment(CharUnits::One().getQuantity()); Modified: cfe/trunk/test/CodeGenObjC/boxing.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/boxing.m?rev=281854&r1=281853&r2=281854&view=diff == --- cfe/trunk/test/CodeGenObjC/boxing.m (original) +++ cfe/trunk/test/CodeGenObjC/boxing.m Sun Sep 18 11:12:04 2016 @@ -53,17 +53,17 @@ typedef signed char BOOL; + (id)stringWithUTF8String:(const char *)nullTerminatedCString; @end -// CHECK: [[WithIntMeth:@.*]] = private global [15 x i8] c"numberWithInt:\00" +// CHECK: [[WithIntMeth:@.*]] = private constant [15 x i8] c"numberWithInt:\00" // CHECK: [[WithIntSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[WithIntMeth]] -// CHECK: [[WithCharMeth:@.*]] = private global [16 x i8] c"numberWithChar:\00" +// CHECK: [[WithCharMeth:@.*]] = private constant [16 x i8] c"numberWithChar:\00" // CHECK: [[WithCharSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithCharMeth]] -// CHECK: [[WithBoolMeth:@.*]] = private global [16 x i8] c"numberWithBool:\00" +// CHECK: [[WithBoolMeth:@.*]] = private constant [16 x i8] c"numberWithBool:\00" // CHECK: [[WithBoolSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithBoolMeth]] -// CHECK: [[WithIntegerMeth:@.*]] = private global [19 x i8] c"numberWithInteger:\00" +// CHECK: [[WithIntegerMeth:@.*]] = private constant [19 x i8] c"numberWithInteger:\00" // CHECK: [[WithIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([19 x i8], [19 x i8]* [[WithIntegerMeth]] -// CHECK: [[WithUnsignedIntegerMeth:@.*]] = private global [27 x i8] c"numberWithUnsignedInteger:\00" +// CHECK: [[WithUnsignedIntegerMeth:@.*]] = private constant [27 x i8] c"numberWithUnsignedInteger:\00" // CHECK: [[WithUnsignedIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([27 x i8], [27 x i8]* [[WithUnsignedIntegerMeth]] -// CHECK: [[stringWithUTF8StringMeth:@.*]] = private global [22 x i8] c"stringWithUTF8String:\00" +// CHECK: [[stringWithUTF8StringMeth:@.*]] = private constant [22 x i8] c"stringWithUTF8String:\00" // CHECK: [[stringWithUTF8StringSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([22 x i8], [22 x i8]* [[stringWithUTF8StringMeth]] int main() { Modified: cfe/trunk/test/CodeGenObjC/complex-property.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/complex-property.m?rev=281854&r1=281853&r2=281854&view=diff == --- cfe/tr
r281855 - CodeGen: mark ObjC cstring literals as unnamed_addr
Author: compnerd Date: Sun Sep 18 11:12:14 2016 New Revision: 281855 URL: http://llvm.org/viewvc/llvm-project?rev=281855&view=rev Log: CodeGen: mark ObjC cstring literals as unnamed_addr These are all emitted into a section with a cstring_literal attribute. The attribute permits the linker to coalesce the string contents. The address of the strings are not important. Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp cfe/trunk/test/CodeGenObjC/boxing.m cfe/trunk/test/CodeGenObjC/complex-property.m cfe/trunk/test/CodeGenObjC/encode-cstyle-method.m cfe/trunk/test/CodeGenObjC/encode-test-6.m cfe/trunk/test/CodeGenObjC/encode-test.m cfe/trunk/test/CodeGenObjC/fragile-arc.m cfe/trunk/test/CodeGenObjC/ivar-layout-64.m cfe/trunk/test/CodeGenObjC/metadata-symbols-32.m cfe/trunk/test/CodeGenObjC/metadata-symbols-64.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-ios.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m cfe/trunk/test/CodeGenObjC/nsvalue-objc-boxable-mac.m cfe/trunk/test/CodeGenObjC/objc-asm-attribute-test.m cfe/trunk/test/CodeGenObjC/property-list-in-extension.m cfe/trunk/test/CodeGenObjC/reorder-synthesized-ivars.m cfe/trunk/test/CodeGenObjCXX/encode.mm cfe/trunk/test/CodeGenObjCXX/lambda-expressions.mm Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=281855&r1=281854&r2=281855&view=diff == --- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original) +++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sun Sep 18 11:12:14 2016 @@ -3694,7 +3694,9 @@ CGObjCCommonMac::CreateCStringLiteral(St new llvm::GlobalVariable(CGM.getModule(), Value->getType(), /*isConstant=*/true, llvm::GlobalValue::PrivateLinkage, Value, Label); - GV->setSection(Section); + if (CGM.getTriple().isOSBinFormatMachO()) +GV->setSection(Section); + GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global); GV->setAlignment(CharUnits::One().getQuantity()); CGM.addCompilerUsedGlobal(GV); Modified: cfe/trunk/test/CodeGenObjC/boxing.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/boxing.m?rev=281855&r1=281854&r2=281855&view=diff == --- cfe/trunk/test/CodeGenObjC/boxing.m (original) +++ cfe/trunk/test/CodeGenObjC/boxing.m Sun Sep 18 11:12:14 2016 @@ -53,17 +53,17 @@ typedef signed char BOOL; + (id)stringWithUTF8String:(const char *)nullTerminatedCString; @end -// CHECK: [[WithIntMeth:@.*]] = private constant [15 x i8] c"numberWithInt:\00" +// CHECK: [[WithIntMeth:@.*]] = private unnamed_addr constant [15 x i8] c"numberWithInt:\00" // CHECK: [[WithIntSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[WithIntMeth]] -// CHECK: [[WithCharMeth:@.*]] = private constant [16 x i8] c"numberWithChar:\00" +// CHECK: [[WithCharMeth:@.*]] = private unnamed_addr constant [16 x i8] c"numberWithChar:\00" // CHECK: [[WithCharSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithCharMeth]] -// CHECK: [[WithBoolMeth:@.*]] = private constant [16 x i8] c"numberWithBool:\00" +// CHECK: [[WithBoolMeth:@.*]] = private unnamed_addr constant [16 x i8] c"numberWithBool:\00" // CHECK: [[WithBoolSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithBoolMeth]] -// CHECK: [[WithIntegerMeth:@.*]] = private constant [19 x i8] c"numberWithInteger:\00" +// CHECK: [[WithIntegerMeth:@.*]] = private unnamed_addr constant [19 x i8] c"numberWithInteger:\00" // CHECK: [[WithIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([19 x i8], [19 x i8]* [[WithIntegerMeth]] -// CHECK: [[WithUnsignedIntegerMeth:@.*]] = private constant [27 x i8] c"numberWithUnsignedInteger:\00" +// CHECK: [[WithUnsignedIntegerMeth:@.*]] = private unnamed_addr constant [27 x i8] c"numberWithUnsignedInteger:\00" // CHECK: [[WithUnsignedIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([27 x i8], [27 x i8]* [[WithUnsignedIntegerMeth]] -// CHECK: [[stringWithUTF8StringMeth:@.*]] = private constant [22 x i8] c"stringWithUTF8String:\00" +// CHECK: [[stringWithUTF8StringMeth:@.*]] = private unnamed_addr constant [22 x i8] c"stringWithUTF8String:\00" // CHECK: [[stringWithUTF8StringSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([22 x i8], [22 x i8]* [[stringWithUTF8StringMeth]] int main() { Modified: cfe/trunk/test/CodeGenObjC/complex-property.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/complex-property.m?rev=281855&r1=281854&r2=281855&view=diff ==
[PATCH] D24708: clang-format: [JS] Fix line breaks before comments when sorting imports.
mprobst created this revision. mprobst added a reviewer: djasper. mprobst added a subscriber: cfe-commits. Herald added a subscriber: klimek. Previously, clang-format would always insert an additional line break after the import block if the main body started with a comment, due to loosing track of the first non-import line. https://reviews.llvm.org/D24708 Files: lib/Format/SortJavaScriptImports.cpp unittests/Format/SortImportsTestJS.cpp Index: unittests/Format/SortImportsTestJS.cpp === --- unittests/Format/SortImportsTestJS.cpp +++ unittests/Format/SortImportsTestJS.cpp @@ -121,6 +121,16 @@ "import {sym} from 'b'; // from //foo:bar\n" "// A very important import follows.\n" "import {sym} from 'a'; /* more comments */\n"); + verifySort("import {sym} from 'a';\n" + "import {sym} from 'b';\n" + "\n" + "/** Comment on variable. */\n" + "const x = 1;\n", + "import {sym} from 'b';\n" + "import {sym} from 'a';\n" + "\n" + "/** Comment on variable. */\n" + "const x = 1;\n"); } TEST_F(SortImportsTestJS, SortStar) { Index: lib/Format/SortJavaScriptImports.cpp === --- lib/Format/SortJavaScriptImports.cpp +++ lib/Format/SortJavaScriptImports.cpp @@ -293,14 +293,19 @@ // of the import that immediately follows them by using the previously // set Start. Start = Line->First->Tok.getLocation(); - if (!Current) -continue; // Only comments on this line. + if (!Current) { +// Only comments on this line. Could be the first non-import line. +FirstNonImportLine = Line; +continue; + } JsModuleReference Reference; Reference.Range.setBegin(Start); if (!parseModuleReference(Keywords, Reference)) { -FirstNonImportLine = Line; +if (!FirstNonImportLine) + FirstNonImportLine = Line; // if no comment before. break; } + FirstNonImportLine = nullptr; AnyImportAffected = AnyImportAffected || Line->Affected; Reference.Range.setEnd(LineEnd->Tok.getEndLoc()); DEBUG({ Index: unittests/Format/SortImportsTestJS.cpp === --- unittests/Format/SortImportsTestJS.cpp +++ unittests/Format/SortImportsTestJS.cpp @@ -121,6 +121,16 @@ "import {sym} from 'b'; // from //foo:bar\n" "// A very important import follows.\n" "import {sym} from 'a'; /* more comments */\n"); + verifySort("import {sym} from 'a';\n" + "import {sym} from 'b';\n" + "\n" + "/** Comment on variable. */\n" + "const x = 1;\n", + "import {sym} from 'b';\n" + "import {sym} from 'a';\n" + "\n" + "/** Comment on variable. */\n" + "const x = 1;\n"); } TEST_F(SortImportsTestJS, SortStar) { Index: lib/Format/SortJavaScriptImports.cpp === --- lib/Format/SortJavaScriptImports.cpp +++ lib/Format/SortJavaScriptImports.cpp @@ -293,14 +293,19 @@ // of the import that immediately follows them by using the previously // set Start. Start = Line->First->Tok.getLocation(); - if (!Current) -continue; // Only comments on this line. + if (!Current) { +// Only comments on this line. Could be the first non-import line. +FirstNonImportLine = Line; +continue; + } JsModuleReference Reference; Reference.Range.setBegin(Start); if (!parseModuleReference(Keywords, Reference)) { -FirstNonImportLine = Line; +if (!FirstNonImportLine) + FirstNonImportLine = Line; // if no comment before. break; } + FirstNonImportLine = nullptr; AnyImportAffected = AnyImportAffected || Line->Affected; Reference.Range.setEnd(LineEnd->Tok.getEndLoc()); DEBUG({ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r281856 - clang-format: [JS] ASI insertion after boolean literals.
Author: mprobst Date: Sun Sep 18 12:21:52 2016 New Revision: 281856 URL: http://llvm.org/viewvc/llvm-project?rev=281856&view=rev Log: clang-format: [JS] ASI insertion after boolean literals. Summary: Before when a semicolon was missing after a boolean literal: a = true return 1; clang-format would parse this as one line and format as: a = true return 1; It turns out that C++ does not consider `true` and `false` to be literals, we have to check for that explicitly. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24574 Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=281856&r1=281855&r2=281856&view=diff == --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original) +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Sun Sep 18 12:21:52 2016 @@ -681,7 +681,9 @@ static bool mustBeJSIdent(const Addition static bool mustBeJSIdentOrValue(const AdditionalKeywords &Keywords, const FormatToken *FormatTok) { - return FormatTok->Tok.isLiteral() || mustBeJSIdent(Keywords, FormatTok); + return FormatTok->Tok.isLiteral() || + FormatTok->isOneOf(tok::kw_true, tok::kw_false) || + mustBeJSIdent(Keywords, FormatTok); } // isJSDeclOrStmt returns true if |FormatTok| starts a declaration or statement Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=281856&r1=281855&r2=281856&view=diff == --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original) +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Sun Sep 18 12:21:52 2016 @@ -774,6 +774,18 @@ TEST_F(FormatTestJS, AutomaticSemicolonI "String"); verifyFormat("function f(@Foo bar) {}", "function f(@Foo\n" " bar) {}"); + verifyFormat("a = true\n" + "return 1", + "a = true\n" + " return 1"); + verifyFormat("a = 's'\n" + "return 1", + "a = 's'\n" + " return 1"); + verifyFormat("a = null\n" + "return 1", + "a = null\n" + " return 1"); } TEST_F(FormatTestJS, ClosureStyleCasts) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24574: clang-format: [JS] ASI insertion after boolean literals.
This revision was automatically updated to reflect the committed changes. Closed by commit rL281856: clang-format: [JS] ASI insertion after boolean literals. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D24574?vs=71385&id=71755#toc Repository: rL LLVM https://reviews.llvm.org/D24574 Files: cfe/trunk/lib/Format/UnwrappedLineParser.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp === --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp @@ -681,7 +681,9 @@ static bool mustBeJSIdentOrValue(const AdditionalKeywords &Keywords, const FormatToken *FormatTok) { - return FormatTok->Tok.isLiteral() || mustBeJSIdent(Keywords, FormatTok); + return FormatTok->Tok.isLiteral() || + FormatTok->isOneOf(tok::kw_true, tok::kw_false) || + mustBeJSIdent(Keywords, FormatTok); } // isJSDeclOrStmt returns true if |FormatTok| starts a declaration or statement Index: cfe/trunk/unittests/Format/FormatTestJS.cpp === --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -774,6 +774,18 @@ "String"); verifyFormat("function f(@Foo bar) {}", "function f(@Foo\n" " bar) {}"); + verifyFormat("a = true\n" + "return 1", + "a = true\n" + " return 1"); + verifyFormat("a = 's'\n" + "return 1", + "a = 's'\n" + " return 1"); + verifyFormat("a = null\n" + "return 1", + "a = null\n" + " return 1"); } TEST_F(FormatTestJS, ClosureStyleCasts) { Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp === --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp @@ -681,7 +681,9 @@ static bool mustBeJSIdentOrValue(const AdditionalKeywords &Keywords, const FormatToken *FormatTok) { - return FormatTok->Tok.isLiteral() || mustBeJSIdent(Keywords, FormatTok); + return FormatTok->Tok.isLiteral() || + FormatTok->isOneOf(tok::kw_true, tok::kw_false) || + mustBeJSIdent(Keywords, FormatTok); } // isJSDeclOrStmt returns true if |FormatTok| starts a declaration or statement Index: cfe/trunk/unittests/Format/FormatTestJS.cpp === --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -774,6 +774,18 @@ "String"); verifyFormat("function f(@Foo bar) {}", "function f(@Foo\n" " bar) {}"); + verifyFormat("a = true\n" + "return 1", + "a = true\n" + " return 1"); + verifyFormat("a = 's'\n" + "return 1", + "a = 's'\n" + " return 1"); + verifyFormat("a = null\n" + "return 1", + "a = null\n" + " return 1"); } TEST_F(FormatTestJS, ClosureStyleCasts) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r281857 - clang-format: [JS] Do not wrap taze annotation comments.
Author: mprobst Date: Sun Sep 18 12:33:51 2016 New Revision: 281857 URL: http://llvm.org/viewvc/llvm-project?rev=281857&view=rev Log: clang-format: [JS] Do not wrap taze annotation comments. Summary: `// taze: ... from ...` comments are used help tools where a specific global symbol comes from. Before: // taze: many, different, symbols from // 'some_long_location_here' After: // taze: many, different, symbols from 'some_long_location_here' Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24477 Modified: cfe/trunk/lib/Format/Format.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Modified: cfe/trunk/lib/Format/Format.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=281857&r1=281856&r2=281857&view=diff == --- cfe/trunk/lib/Format/Format.cpp (original) +++ cfe/trunk/lib/Format/Format.cpp Sun Sep 18 12:33:51 2016 @@ -613,7 +613,7 @@ FormatStyle getGoogleStyle(FormatStyle:: GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; GoogleStyle.AlwaysBreakBeforeMultilineStrings = false; GoogleStyle.BreakBeforeTernaryOperators = false; -GoogleStyle.CommentPragmas = "@(export|requirecss|return|see|visibility) "; +GoogleStyle.CommentPragmas = "(taze:|@(export|requirecss|return|see|visibility)) "; GoogleStyle.MaxEmptyLinesToKeep = 3; GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; GoogleStyle.SpacesInContainerLiterals = false; Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=281857&r1=281856&r2=281857&view=diff == --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original) +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Sun Sep 18 12:33:51 2016 @@ -1444,5 +1444,11 @@ TEST_F(FormatTestJS, Conditional) { "}"); } +TEST_F(FormatTestJS, ImportComments) { + verifyFormat("import {x} from 'x'; // from some location", + getGoogleJSStyleWithColumns(25)); + verifyFormat("// taze: x from 'location'", getGoogleJSStyleWithColumns(10)); +} + } // end namespace tooling } // end namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24477: clang-format: [JS] Do not wrap taze: IWYU comments
This revision was automatically updated to reflect the committed changes. Closed by commit rL281857: clang-format: [JS] Do not wrap taze annotation comments. (authored by mprobst). Changed prior to commit: https://reviews.llvm.org/D24477?vs=71189&id=71756#toc Repository: rL LLVM https://reviews.llvm.org/D24477 Files: cfe/trunk/lib/Format/Format.cpp cfe/trunk/unittests/Format/FormatTestJS.cpp Index: cfe/trunk/lib/Format/Format.cpp === --- cfe/trunk/lib/Format/Format.cpp +++ cfe/trunk/lib/Format/Format.cpp @@ -613,7 +613,7 @@ GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; GoogleStyle.AlwaysBreakBeforeMultilineStrings = false; GoogleStyle.BreakBeforeTernaryOperators = false; -GoogleStyle.CommentPragmas = "@(export|requirecss|return|see|visibility) "; +GoogleStyle.CommentPragmas = "(taze:|@(export|requirecss|return|see|visibility)) "; GoogleStyle.MaxEmptyLinesToKeep = 3; GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; GoogleStyle.SpacesInContainerLiterals = false; Index: cfe/trunk/unittests/Format/FormatTestJS.cpp === --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -1444,5 +1444,11 @@ "}"); } +TEST_F(FormatTestJS, ImportComments) { + verifyFormat("import {x} from 'x'; // from some location", + getGoogleJSStyleWithColumns(25)); + verifyFormat("// taze: x from 'location'", getGoogleJSStyleWithColumns(10)); +} + } // end namespace tooling } // end namespace clang Index: cfe/trunk/lib/Format/Format.cpp === --- cfe/trunk/lib/Format/Format.cpp +++ cfe/trunk/lib/Format/Format.cpp @@ -613,7 +613,7 @@ GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; GoogleStyle.AlwaysBreakBeforeMultilineStrings = false; GoogleStyle.BreakBeforeTernaryOperators = false; -GoogleStyle.CommentPragmas = "@(export|requirecss|return|see|visibility) "; +GoogleStyle.CommentPragmas = "(taze:|@(export|requirecss|return|see|visibility)) "; GoogleStyle.MaxEmptyLinesToKeep = 3; GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; GoogleStyle.SpacesInContainerLiterals = false; Index: cfe/trunk/unittests/Format/FormatTestJS.cpp === --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -1444,5 +1444,11 @@ "}"); } +TEST_F(FormatTestJS, ImportComments) { + verifyFormat("import {x} from 'x'; // from some location", + getGoogleJSStyleWithColumns(25)); + verifyFormat("// taze: x from 'location'", getGoogleJSStyleWithColumns(10)); +} + } // end namespace tooling } // end namespace clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24704: PR30401: Fix substitutions for functions with abi_tag
rsmith added inline comments. Comment at: lib/AST/ItaniumMangle.cpp:668 @@ -664,3 +667,3 @@ llvm::raw_svector_ostream FunctionEncodingStream(FunctionEncodingBuf); CXXNameMangler FunctionEncodingMangler(*this, FunctionEncodingStream); // Output name of the function. Maybe it'd be simpler to just override the output stream here rather than creating a new mangler? https://reviews.llvm.org/D24704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24709: [analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv
dcoughlin created this revision. dcoughlin added reviewers: zaks.anna, NoQ. dcoughlin added a subscriber: cfe-commits. Treat lines in projectMap.csv that start with '#' as comments. This enables a workflow where projects can be temporarily disabled with a comment describing when they should be turned back on. https://reviews.llvm.org/D24709 Files: utils/analyzer/SATestBuild.py Index: utils/analyzer/SATestBuild.py === --- utils/analyzer/SATestBuild.py +++ utils/analyzer/SATestBuild.py @@ -660,11 +660,17 @@ print "Completed tests for project %s (time: %.2f)." % \ (ID, (time.time()-TBegin)) +def isCommentCSVLine(Entries): + # Treat CSV lines starting with a '#' as a comment. + return len(Entries) > 0 and Entries[0].startswith("#") + def testAll(IsReferenceBuild = False, UpdateSVN = False, Strictness = 0): PMapFile = open(getProjectMapPath(), "rb") try: # Validate the input. for I in csv.reader(PMapFile): +if (isCommentCSVLine(I)): +continue if (len(I) != 2) : print "Error: Rows in the ProjectMapFile should have 3 entries." raise Exception() @@ -682,6 +688,8 @@ # Test the projects. PMapFile.seek(0) for I in csv.reader(PMapFile): +if isCommentCSVLine(I): + continue; testProject(I[0], int(I[1]), IsReferenceBuild, None, Strictness) # Add reference results to SVN. Index: utils/analyzer/SATestBuild.py === --- utils/analyzer/SATestBuild.py +++ utils/analyzer/SATestBuild.py @@ -660,11 +660,17 @@ print "Completed tests for project %s (time: %.2f)." % \ (ID, (time.time()-TBegin)) +def isCommentCSVLine(Entries): + # Treat CSV lines starting with a '#' as a comment. + return len(Entries) > 0 and Entries[0].startswith("#") + def testAll(IsReferenceBuild = False, UpdateSVN = False, Strictness = 0): PMapFile = open(getProjectMapPath(), "rb") try: # Validate the input. for I in csv.reader(PMapFile): +if (isCommentCSVLine(I)): +continue if (len(I) != 2) : print "Error: Rows in the ProjectMapFile should have 3 entries." raise Exception() @@ -682,6 +688,8 @@ # Test the projects. PMapFile.seek(0) for I in csv.reader(PMapFile): +if isCommentCSVLine(I): + continue; testProject(I[0], int(I[1]), IsReferenceBuild, None, Strictness) # Add reference results to SVN. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24704: PR30401: Fix substitutions for functions with abi_tag
rsmith added inline comments. Comment at: lib/AST/ItaniumMangle.cpp:668 @@ -664,3 +667,3 @@ llvm::raw_svector_ostream FunctionEncodingStream(FunctionEncodingBuf); CXXNameMangler FunctionEncodingMangler(*this, FunctionEncodingStream); // Output name of the function. DmitryPolukhin wrote: > rsmith wrote: > > Maybe it'd be simpler to just override the output stream here rather than > > creating a new mangler? > I'm not sure that it is simpler because it will also require substitutions > save/restore for name mangling (mangleNameWithAbiTags) to produce the same > substitutions twice (without implicate abi_tags and later with implicit > abi_tags). IMHO, it is almost identical approaches but current one is a bit > cleaner because it copies explicitly everything required from temp to outer > mangler. I think we'd want to override the output stream to write to a temporary buffer at the point when we would otherwise write out the ABI tags, to avoid needing to save/restore any substitutions. But I agree, that seems more invasive than what you're doing here. I'll leave this up to you. Comment at: lib/AST/ItaniumMangle.cpp:4439 @@ +4438,3 @@ + if (Other.SeqID > SeqID) { +Substitutions = Other.Substitutions; +SeqID = Other.SeqID; Please avoid the cost of a full copy here by making this a destructive operation on `Other` -- use `swap` or move-assignment here. (We'll still be paying for one copy of the substitution set per function mangling, which is unfortunate / undesirable.) https://reviews.llvm.org/D24704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24704: PR30401: Fix substitutions for functions with abi_tag
DmitryPolukhin added inline comments. Comment at: lib/AST/ItaniumMangle.cpp:668 @@ -664,3 +667,3 @@ llvm::raw_svector_ostream FunctionEncodingStream(FunctionEncodingBuf); CXXNameMangler FunctionEncodingMangler(*this, FunctionEncodingStream); // Output name of the function. rsmith wrote: > Maybe it'd be simpler to just override the output stream here rather than > creating a new mangler? I'm not sure that it is simpler because it will also require substitutions save/restore for name mangling (mangleNameWithAbiTags) to produce the same substitutions twice (without implicate abi_tags and later with implicit abi_tags). IMHO, it is almost identical approaches but current one is a bit cleaner because it copies explicitly everything required from temp to outer mangler. https://reviews.llvm.org/D24704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24703: [clang-format] BreakBeforeBinaryOperations and AlignAfterOpenBracket conflict, bug 30304
daphnediane added a comment. In https://reviews.llvm.org/D24703#545706, @djasper wrote: > I think, this is the wrong fix. Instead, a > > || (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser)) > > > should be added to the last return statement of this function. > > Also, could you please add a test in unittests/Format/FormatTest.cpp. Trying that on my code after I finish rebasing and rebuilding, will also look into adding test to FormatTest. https://reviews.llvm.org/D24703 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23932: [XRay] ARM 32-bit no-Thumb support in Clang
This revision was automatically updated to reflect the committed changes. Closed by commit rL281879: [XRay] ARM 32-bit no-Thumb support in Clang (authored by dberris). Changed prior to commit: https://reviews.llvm.org/D23932?vs=71635&id=71765#toc Repository: rL LLVM https://reviews.llvm.org/D23932 Files: cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp Index: cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp === --- cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp +++ cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - -triple arm-unknown-linux-gnu | FileCheck %s + +// Make sure that the LLVM attribute for XRay-annotated functions do show up. +[[clang::xray_always_instrument]] void foo() { +// CHECK: define void @_Z3foov() #0 +}; + +[[clang::xray_never_instrument]] void bar() { +// CHECK: define void @_Z3barv() #1 +}; + +// CHECK: #0 = {{.*}}"function-instrument"="xray-always" +// CHECK: #1 = {{.*}}"function-instrument"="xray-never" Index: cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp === --- cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp +++ cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - -triple arm-unknown-linux-gnu | FileCheck %s + +// Make sure that the LLVM attribute for XRay-annotated functions do show up. +[[clang::xray_always_instrument]] void foo() { +// CHECK: define void @_Z3foov() #0 +}; + +[[clang::xray_never_instrument]] void bar() { +// CHECK: define void @_Z3barv() #1 +}; + +// CHECK: #0 = {{.*}}"function-instrument"="xray-always" +// CHECK: #1 = {{.*}}"function-instrument"="xray-never" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r281879 - [XRay] ARM 32-bit no-Thumb support in Clang
Author: dberris Date: Sun Sep 18 19:59:19 2016 New Revision: 281879 URL: http://llvm.org/viewvc/llvm-project?rev=281879&view=rev Log: [XRay] ARM 32-bit no-Thumb support in Clang Just a test for now, adapted from x86_64 tests of XRay. This is one of 3 commits to different repositories of XRay ARM port. The other 2 are: https://reviews.llvm.org/D23931 (LLVM) https://reviews.llvm.org/D23933 (compiler-rt) Differential Revision: https://reviews.llvm.org/D23932 Added: cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp Added: cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp?rev=281879&view=auto == --- cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp (added) +++ cfe/trunk/test/CodeGen/xray-attributes-supported-arm.cpp Sun Sep 18 19:59:19 2016 @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -fxray-instrument -std=c++11 -x c++ -emit-llvm -o - -triple arm-unknown-linux-gnu | FileCheck %s + +// Make sure that the LLVM attribute for XRay-annotated functions do show up. +[[clang::xray_always_instrument]] void foo() { +// CHECK: define void @_Z3foov() #0 +}; + +[[clang::xray_never_instrument]] void bar() { +// CHECK: define void @_Z3barv() #1 +}; + +// CHECK: #0 = {{.*}}"function-instrument"="xray-always" +// CHECK: #1 = {{.*}}"function-instrument"="xray-never" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24709: [analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv
This revision was automatically updated to reflect the committed changes. Closed by commit rL281880: [analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv (authored by dcoughlin). Changed prior to commit: https://reviews.llvm.org/D24709?vs=71757&id=71766#toc Repository: rL LLVM https://reviews.llvm.org/D24709 Files: cfe/trunk/utils/analyzer/SATestBuild.py Index: cfe/trunk/utils/analyzer/SATestBuild.py === --- cfe/trunk/utils/analyzer/SATestBuild.py +++ cfe/trunk/utils/analyzer/SATestBuild.py @@ -660,11 +660,17 @@ print "Completed tests for project %s (time: %.2f)." % \ (ID, (time.time()-TBegin)) +def isCommentCSVLine(Entries): + # Treat CSV lines starting with a '#' as a comment. + return len(Entries) > 0 and Entries[0].startswith("#") + def testAll(IsReferenceBuild = False, UpdateSVN = False, Strictness = 0): PMapFile = open(getProjectMapPath(), "rb") try: # Validate the input. for I in csv.reader(PMapFile): +if (isCommentCSVLine(I)): +continue if (len(I) != 2) : print "Error: Rows in the ProjectMapFile should have 3 entries." raise Exception() @@ -682,6 +688,8 @@ # Test the projects. PMapFile.seek(0) for I in csv.reader(PMapFile): +if isCommentCSVLine(I): + continue; testProject(I[0], int(I[1]), IsReferenceBuild, None, Strictness) # Add reference results to SVN. Index: cfe/trunk/utils/analyzer/SATestBuild.py === --- cfe/trunk/utils/analyzer/SATestBuild.py +++ cfe/trunk/utils/analyzer/SATestBuild.py @@ -660,11 +660,17 @@ print "Completed tests for project %s (time: %.2f)." % \ (ID, (time.time()-TBegin)) +def isCommentCSVLine(Entries): + # Treat CSV lines starting with a '#' as a comment. + return len(Entries) > 0 and Entries[0].startswith("#") + def testAll(IsReferenceBuild = False, UpdateSVN = False, Strictness = 0): PMapFile = open(getProjectMapPath(), "rb") try: # Validate the input. for I in csv.reader(PMapFile): +if (isCommentCSVLine(I)): +continue if (len(I) != 2) : print "Error: Rows in the ProjectMapFile should have 3 entries." raise Exception() @@ -682,6 +688,8 @@ # Test the projects. PMapFile.seek(0) for I in csv.reader(PMapFile): +if isCommentCSVLine(I): + continue; testProject(I[0], int(I[1]), IsReferenceBuild, None, Strictness) # Add reference results to SVN. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r281880 - [analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv
Author: dcoughlin Date: Sun Sep 18 20:36:40 2016 New Revision: 281880 URL: http://llvm.org/viewvc/llvm-project?rev=281880&view=rev Log: [analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv Treat lines in projectMap.csv that start with '#' as comments. This enables a workflow where projects can be temporarily disabled with a comment describing when they should be turned back on. Differential Revision: https://reviews.llvm.org/D24709 Modified: cfe/trunk/utils/analyzer/SATestBuild.py Modified: cfe/trunk/utils/analyzer/SATestBuild.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=281880&r1=281879&r2=281880&view=diff == --- cfe/trunk/utils/analyzer/SATestBuild.py (original) +++ cfe/trunk/utils/analyzer/SATestBuild.py Sun Sep 18 20:36:40 2016 @@ -660,11 +660,17 @@ def testProject(ID, ProjectBuildMode, Is print "Completed tests for project %s (time: %.2f)." % \ (ID, (time.time()-TBegin)) +def isCommentCSVLine(Entries): + # Treat CSV lines starting with a '#' as a comment. + return len(Entries) > 0 and Entries[0].startswith("#") + def testAll(IsReferenceBuild = False, UpdateSVN = False, Strictness = 0): PMapFile = open(getProjectMapPath(), "rb") try: # Validate the input. for I in csv.reader(PMapFile): +if (isCommentCSVLine(I)): +continue if (len(I) != 2) : print "Error: Rows in the ProjectMapFile should have 3 entries." raise Exception() @@ -682,6 +688,8 @@ def testAll(IsReferenceBuild = False, Up # Test the projects. PMapFile.seek(0) for I in csv.reader(PMapFile): +if isCommentCSVLine(I): + continue; testProject(I[0], int(I[1]), IsReferenceBuild, None, Strictness) # Add reference results to SVN. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r281881 - [docs] Touch up the code coverage doc
Author: vedantk Date: Sun Sep 18 20:42:38 2016 New Revision: 281881 URL: http://llvm.org/viewvc/llvm-project?rev=281881&view=rev Log: [docs] Touch up the code coverage doc Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=281881&r1=281880&r2=281881&view=diff == --- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original) +++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Sun Sep 18 20:42:38 2016 @@ -125,24 +125,24 @@ region counts (even in macro expansions) .. code-block:: none - 20|1|#define BAR(x) ((x) || (x)) +1| 20|#define BAR(x) ((x) || (x)) ^20 ^2 2|2|template void foo(T x) { - 22|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } +3| 22| for (unsigned I = 0; I < 10; ++I) { BAR(I); } ^22 ^20 ^20^20 -2|4|} +4|2|} -- | void foo(int): -| 1|2|template void foo(T x) { -| 11|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } +| 2|1|template void foo(T x) { +| 3| 11| for (unsigned I = 0; I < 10; ++I) { BAR(I); } | ^11 ^10 ^10^10 -| 1|4|} +| 4|1|} -- | void foo(int): -| 1|2|template void foo(T x) { -| 11|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } +| 2|1|template void foo(T x) { +| 3| 11| for (unsigned I = 0; I < 10; ++I) { BAR(I); } | ^11 ^10 ^10^10 -| 1|4|} +| 4|1|} -- It's possible to generate a file-level summary of coverage statistics (instead @@ -177,6 +177,26 @@ A few final notes: % llvm-profdata merge -sparse foo1.profraw foo2.profdata -o foo3.profdata +Interpreting reports + + +There are four statistics tracked in a coverage summary: + +* Function coverage is the percentage of functions which have been executed at + least once. A function is treated as having been executed if any of its + instantiations are executed. + +* Instantiation coverage is the percentage of function instantiations which + have been executed at least once. + +* Line coverage is the percentage of code lines which have been executed at + least once. + +* Region coverage is the percentage of code regions which have been executed at + least once. A code region may span multiple lines (e.g a large function with + no control flow). However, it's also possible for a single line to contain + multiple code regions (e.g some short-circuited logic). + Format compatibility guarantees === ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24690: Replace __ANDROID__ with __BIONIC__.
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. LGTM after addressing the MUSL libc comment. Comment at: include/__config:90 @@ +89,3 @@ +#if defined(__linux__) +#include +#if !defined(__GLIBC_PREREQ) Does MUSL libc have a `features.h`? This include was previously guarded by if `!defined(_LIBCPP_HAS_MUSL_LIBC)`. Repository: rL LLVM https://reviews.llvm.org/D24690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24690: Replace __ANDROID__ with __BIONIC__.
danalbert added inline comments. Comment at: include/__config:90 @@ +89,3 @@ +#if defined(__linux__) +#include +#if !defined(__GLIBC_PREREQ) EricWF wrote: > Does MUSL libc have a `features.h`? This include was previously guarded by > if `!defined(_LIBCPP_HAS_MUSL_LIBC)`. Yep: https://github.com/wermut/musl/blob/master/include/features.h Repository: rL LLVM https://reviews.llvm.org/D24690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24703: [clang-format] BreakBeforeBinaryOperations and AlignAfterOpenBracket conflict, bug 30304
djasper accepted this revision. djasper added a comment. This revision is now accepted and ready to land. Looks good. Thank you! https://reviews.llvm.org/D24703 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24708: clang-format: [JS] Fix line breaks before comments when sorting imports.
djasper accepted this revision. djasper added a comment. This revision is now accepted and ready to land. Looks Good. https://reviews.llvm.org/D24708 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D17815: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.
ikudrin added a comment. Hi, Ping. The patch is under review for a long time and the described problem is still here. As we've seen the issue in practice, I'm sure that others may also run into it, and I do believe it should be fixed, one way or another. @EricWF, can I improve the patch somehow to pass the review? Or maybe you prefer it to be fixed in some other way? https://reviews.llvm.org/D17815 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration
danielmarjamaki added a comment. > However, I think this check should be part of Clang diagnostics. GCC has > -Wredundant-decls for a long time. I am not against that. What is the criteria? When should it be in the compiler and when should it be in clang-tidy? Personally I think it's natural that the compiler has warnings about dangerous code. This check is about readability. Repository: rL LLVM https://reviews.llvm.org/D24656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D17815: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.
I'll look at these first thing next week. If you remember please ping me. (It's Cppcon this week) Sorry I haven't reviewed this already. Thank you for working on this. On Sep 18, 2016 11:55 PM, "Igor Kudrin" wrote: > ikudrin added a comment. > > Hi, > > Ping. > > The patch is under review for a long time and the described problem is > still here. As we've seen the issue in practice, I'm sure that others may > also run into it, and I do believe it should be fixed, one way or another. > > @EricWF, can I improve the patch somehow to pass the review? Or maybe you > prefer it to be fixed in some other way? > > > https://reviews.llvm.org/D17815 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits