[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection
hfinkel added a comment. In https://reviews.llvm.org/D25435#609320, @danielcdh wrote: > change the flag name to -fprofile-debug I don't really like this name because it sounds like it might be enabling some kind of debugging of the profiling. How about -fdebug-info-for-profiling. Another options is to make it a mode for -g such as -gprofiling. https://reviews.llvm.org/D25435 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino updated this revision to Diff 81000. firolino marked 9 inline comments as done. firolino added a comment. Applied readability-* checks. https://reviews.llvm.org/D27621 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/OneNamePerDeclarationCheck.cpp clang-tidy/readability/OneNamePerDeclarationCheck.h clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/readability-one-name-per-declaration.rst test/clang-tidy/readability-one-name-per-declaration-complex.cpp test/clang-tidy/readability-one-name-per-declaration-modern.cpp test/clang-tidy/readability-one-name-per-declaration-simple.cpp Index: test/clang-tidy/readability-one-name-per-declaration-simple.cpp === --- /dev/null +++ test/clang-tidy/readability-one-name-per-declaration-simple.cpp @@ -0,0 +1,132 @@ +// RUN: %check_clang_tidy %s readability-one-name-per-declaration %t + +int cantTouchA, cantTouchB; + +void simple() +{ +int dontTouchC; + +long empty; +long long1 = 11, *long2 = &empty, * long3 = ∅ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long1 = 11; +// CHECK-FIXES: {{^}}long *long2 = ∅ +// CHECK-FIXES: {{^}}long * long3 = ∅ + +long ** lint1, lint2 = 0, * lint3, **linn; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long ** lint1; +// CHECK-FIXES: {{^}}long lint2 = 0; +// CHECK-FIXES: {{^}}long * lint3; +// CHECK-FIXES: {{^}}long **linn; + + long int* lint4, *lint5, lint6; + // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] + // CHECK-FIXES: {{^ }}long int* lint4; + // CHECK-FIXES: {{^ }}long int *lint5; + // CHECK-FIXES: {{^ }}long int lint6; + +unsigned int uint1 = 0, uint2 = 44u, uint3, uint4=4; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}unsigned int uint1 = 0; +// CHECK-FIXES: {{^}}unsigned int uint2 = 44u; +// CHECK-FIXES: {{^}}unsigned int uint3; +// CHECK-FIXES: {{^}}unsigned int uint4=4; + +double darray1[] = {}, darray2[] = {1, 2}, dv1 = 3, dv2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}double darray1[] = {}; +// CHECK-FIXES: {{^}}double darray2[] = {1, 2}; +// CHECK-FIXES: {{^}}double dv1 = 3; +// CHECK-FIXES: {{^}}double dv2; + +int notransform[] = { + 1, + 2 + }; + +const int cx = 1, cy = 2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const int cx = 1; +// CHECK-FIXES: {{^}}const int cy = 2; + +volatile int vx, vy; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}volatile int vx; +// CHECK-FIXES: {{^}}volatile int vy; + +signed char sc1 = 'h', sc2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}signed char sc1 = 'h'; +// CHECK-FIXES: {{^}}signed char sc2; + +long long ll1, ll2, ***ft; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long ll1; +// CHECK-FIXES: {{^}}long long ll2; +// CHECK-FIXES: {{^}}long long ***ft; + +const char *cstr1 = "str1", *cstr2="str2"; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const char *cstr1 = "str1"; +// CHECK-FIXES: {{^}}const char *cstr2="str2"; + +const char *literal1 = "clang" "test" \ + "one", + *literal2 = "empty", literal3[] = "three"; +// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: declaration statement can be s
[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC
howard.hinnant added a comment. One more comment: `steady_clock::now()` is not allowed to throw an exception because it shall satisfy the requirements of `TrivialClock` ([time.clock]/p1). And [time.clock.req]/p4/b4 says that a `TrivialClock::now()` does not throw exceptions. https://reviews.llvm.org/D27429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino added a comment. @Eugene.Zelenko No modernize-* check was reported. I applied //most// of the readability-* checks. For example, I did not put braces around: if (DeclStmt == nullptr) return; if (DeclStmt->isSingleDecl() || DeclStmt->getLocStart().isMacroID()) return; Hope that is ok? https://reviews.llvm.org/D27621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino updated this revision to Diff 81001. firolino added a comment. Added test case with struct keyword: struct StructOne cs1, cs2( 42 ); https://reviews.llvm.org/D27621 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/OneNamePerDeclarationCheck.cpp clang-tidy/readability/OneNamePerDeclarationCheck.h clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/readability-one-name-per-declaration.rst test/clang-tidy/readability-one-name-per-declaration-complex.cpp test/clang-tidy/readability-one-name-per-declaration-modern.cpp test/clang-tidy/readability-one-name-per-declaration-simple.cpp Index: test/clang-tidy/readability-one-name-per-declaration-simple.cpp === --- /dev/null +++ test/clang-tidy/readability-one-name-per-declaration-simple.cpp @@ -0,0 +1,132 @@ +// RUN: %check_clang_tidy %s readability-one-name-per-declaration %t + +int cantTouchA, cantTouchB; + +void simple() +{ +int dontTouchC; + +long empty; +long long1 = 11, *long2 = &empty, * long3 = ∅ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long1 = 11; +// CHECK-FIXES: {{^}}long *long2 = ∅ +// CHECK-FIXES: {{^}}long * long3 = ∅ + +long ** lint1, lint2 = 0, * lint3, **linn; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long ** lint1; +// CHECK-FIXES: {{^}}long lint2 = 0; +// CHECK-FIXES: {{^}}long * lint3; +// CHECK-FIXES: {{^}}long **linn; + + long int* lint4, *lint5, lint6; + // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] + // CHECK-FIXES: {{^ }}long int* lint4; + // CHECK-FIXES: {{^ }}long int *lint5; + // CHECK-FIXES: {{^ }}long int lint6; + +unsigned int uint1 = 0, uint2 = 44u, uint3, uint4=4; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}unsigned int uint1 = 0; +// CHECK-FIXES: {{^}}unsigned int uint2 = 44u; +// CHECK-FIXES: {{^}}unsigned int uint3; +// CHECK-FIXES: {{^}}unsigned int uint4=4; + +double darray1[] = {}, darray2[] = {1, 2}, dv1 = 3, dv2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}double darray1[] = {}; +// CHECK-FIXES: {{^}}double darray2[] = {1, 2}; +// CHECK-FIXES: {{^}}double dv1 = 3; +// CHECK-FIXES: {{^}}double dv2; + +int notransform[] = { + 1, + 2 + }; + +const int cx = 1, cy = 2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const int cx = 1; +// CHECK-FIXES: {{^}}const int cy = 2; + +volatile int vx, vy; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}volatile int vx; +// CHECK-FIXES: {{^}}volatile int vy; + +signed char sc1 = 'h', sc2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}signed char sc1 = 'h'; +// CHECK-FIXES: {{^}}signed char sc2; + +long long ll1, ll2, ***ft; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long ll1; +// CHECK-FIXES: {{^}}long long ll2; +// CHECK-FIXES: {{^}}long long ***ft; + +const char *cstr1 = "str1", *cstr2="str2"; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const char *cstr1 = "str1"; +// CHECK-FIXES: {{^}}const char *cstr2="str2"; + +const char *literal1 = "clang" "test" \ + "one", + *literal2 = "empty", literal3[] = "three"; +// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: declaration statement can be s
[PATCH] D27557: Update the default of the Mozilla coding style
sylvestre.ledru updated this revision to Diff 81004. sylvestre.ledru added a comment. Keep SpaceAfterTemplateKeyword to true https://reviews.llvm.org/D27557 Files: lib/Format/Format.cpp Index: lib/Format/Format.cpp === --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -652,10 +652,12 @@ MozillaStyle.AllowAllParametersOfDeclarationOnNextLine = false; MozillaStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; MozillaStyle.AlwaysBreakAfterReturnType = - FormatStyle::RTBS_TopLevelDefinitions; + FormatStyle::RTBS_TopLevel;; MozillaStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_TopLevel; MozillaStyle.AlwaysBreakTemplateDeclarations = true; + MozillaStyle.BinPackParameters = false; + MozillaStyle.BinPackArguments = false; MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; MozillaStyle.BreakConstructorInitializersBeforeComma = true; MozillaStyle.ConstructorInitializerIndentWidth = 2; Index: lib/Format/Format.cpp === --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -652,10 +652,12 @@ MozillaStyle.AllowAllParametersOfDeclarationOnNextLine = false; MozillaStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; MozillaStyle.AlwaysBreakAfterReturnType = - FormatStyle::RTBS_TopLevelDefinitions; + FormatStyle::RTBS_TopLevel;; MozillaStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_TopLevel; MozillaStyle.AlwaysBreakTemplateDeclarations = true; + MozillaStyle.BinPackParameters = false; + MozillaStyle.BinPackArguments = false; MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; MozillaStyle.BreakConstructorInitializersBeforeComma = true; MozillaStyle.ConstructorInitializerIndentWidth = 2; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27557: Update the default of the Mozilla coding style
sylvestre.ledru updated this revision to Diff 81005. sylvestre.ledru added a comment. typo https://reviews.llvm.org/D27557 Files: lib/Format/Format.cpp Index: lib/Format/Format.cpp === --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -652,10 +652,12 @@ MozillaStyle.AllowAllParametersOfDeclarationOnNextLine = false; MozillaStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; MozillaStyle.AlwaysBreakAfterReturnType = - FormatStyle::RTBS_TopLevelDefinitions; + FormatStyle::RTBS_TopLevel; MozillaStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_TopLevel; MozillaStyle.AlwaysBreakTemplateDeclarations = true; + MozillaStyle.BinPackParameters = false; + MozillaStyle.BinPackArguments = false; MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; MozillaStyle.BreakConstructorInitializersBeforeComma = true; MozillaStyle.ConstructorInitializerIndentWidth = 2; Index: lib/Format/Format.cpp === --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -652,10 +652,12 @@ MozillaStyle.AllowAllParametersOfDeclarationOnNextLine = false; MozillaStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; MozillaStyle.AlwaysBreakAfterReturnType = - FormatStyle::RTBS_TopLevelDefinitions; + FormatStyle::RTBS_TopLevel; MozillaStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_TopLevel; MozillaStyle.AlwaysBreakTemplateDeclarations = true; + MozillaStyle.BinPackParameters = false; + MozillaStyle.BinPackArguments = false; MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; MozillaStyle.BreakConstructorInitializersBeforeComma = true; MozillaStyle.ConstructorInitializerIndentWidth = 2; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26768: [analyzer] Improve VirtualCallChecker diagnostics and move to optin package.
malcolm.parsons added a comment. In https://reviews.llvm.org/D26768#618651, @dcoughlin wrote: > The definite false positives were cases where the programmer seemed aware of > the semantics of virtual calls during construction/destruction and had each > subclass explicitly call its own version of the virtual method in question. How is this avoiding the check for a qualifier on the call? if (CME->getQualifier()) callIsNonVirtual = true; > The likely false positives were cases where there was no subclass of the > constructed class that overrode the method in question. I'd like to be told about these so that the class can be marked final. Repository: rL LLVM https://reviews.llvm.org/D26768 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27210: [clang-tidy] misc-string-compare. Adding a new check to clang-tidy
malcolm.parsons added inline comments. Comment at: clang-tidy/misc/StringCompareCheck.cpp:25 + callee(cxxMethodDecl(hasName("compare"), + ofClass(classTemplateSpecializationDecl( + hasName("::std::basic_string"), malcolm.parsons wrote: > This needs to check that it's one of the single parameter overloads of > compare. Add `parameterCountIs(1)`. Comment at: clang-tidy/misc/StringCompareCheck.cpp:52 + // FIXME: Add fixit to fix the code. This seems a little tricky for + // cases one and two. Cases three and four seems easy to fix. +} Just fix the easy cases? https://reviews.llvm.org/D27210 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26530: Fix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.
chandlerc updated this revision to Diff 81008. chandlerc added a comment. Rebase and ping? It'd be awesome to land this minor patch, its been out for a month now. https://reviews.llvm.org/D26530 Files: include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/DiagnosticSemaKinds.td test/Parser/objc-property-syntax.m test/Sema/constant-conversion.c test/SemaCXX/conversion.cpp test/SemaCXX/member-init.cpp test/SemaOpenCL/unsupported.cl Index: test/SemaOpenCL/unsupported.cl === --- test/SemaOpenCL/unsupported.cl +++ test/SemaOpenCL/unsupported.cl @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -verify %s struct { - int a : 1; // expected-error {{bitfields are not supported in OpenCL}} + int a : 1; // expected-error {{bit-fields are not supported in OpenCL}} }; void no_vla(int n) { Index: test/SemaCXX/member-init.cpp === --- test/SemaCXX/member-init.cpp +++ test/SemaCXX/member-init.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++11 -Wall %s struct Bitfield { - int n : 3 = 7; // expected-error {{bitfield member cannot have an in-class initializer}} + int n : 3 = 7; // expected-error {{bit-field member cannot have an in-class initializer}} }; int a; Index: test/SemaCXX/conversion.cpp === --- test/SemaCXX/conversion.cpp +++ test/SemaCXX/conversion.cpp @@ -50,7 +50,7 @@ namespace test2 { struct A { unsigned int x : 2; -A() : x(10) {} // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}} +A() : x(10) {} // expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to 2}} }; } Index: test/Sema/constant-conversion.c === --- test/Sema/constant-conversion.c +++ test/Sema/constant-conversion.c @@ -11,7 +11,7 @@ void test_7809123(void) { struct { int i5 : 5; } a; - a.i5 = 36; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 36 to 4}} + a.i5 = 36; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 36 to 4}} } void test() { @@ -31,28 +31,28 @@ int bar : 2; }; - struct A a = { 0, 10 };// expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to -2}} - struct A b[] = { 0, 10, 0, 0 };// expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to -2}} - struct A c[] = {{10, 0}}; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}} - struct A d = (struct A) { 10, 0 }; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}} - struct A e = { .foo = 10 };// expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}} + struct A a = { 0, 10 };// expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to -2}} + struct A b[] = { 0, 10, 0, 0 };// expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to -2}} + struct A c[] = {{10, 0}}; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to 2}} + struct A d = (struct A) { 10, 0 }; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to 2}} + struct A e = { .foo = 10 };// expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to 2}} } void test4() { struct A { char c : 2; } a; - a.c = 0x101; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 257 to 1}} + a.c = 0x101; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 257 to 1}} } void test5() { struct A { _Bool b : 1; } a; // Don't warn about this implicit conversion to bool, or at least - // don't warn about it just because it's a bitfield. + // don't warn about it just because it's a bit-field. a.b = 100; } @@ -71,15 +71,15 @@ f.twoBits1 = ~0; // no-warning f.twoBits1 = ~1; // no-warning - f.twoBits2 = ~2; // expected-warning {{implicit truncation from 'int' to bitfield changes value from -3 to 1}} + f.twoBits2 = ~2; // expected-warning {{implicit truncation from 'int' to bit-field changes value from -3 to 1}} f.twoBits1 &= ~1; // no-warning f.twoBits2 &= ~2; // no-warning } void test8() { enum E { A, B, C }; struct { enum E x : 1; } f; - f.x = C; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 2 to 0}} + f.x = C; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 2 to 0}} } void test9() { @@ -128,6 +128,6 @@ s.a = ~0U; s.a = ~(1<,
[PATCH] D27655: Fix modernize-deprecated-headers clang-tidy warnings
michael.sharpe created this revision. michael.sharpe added a reviewer: rsmith. michael.sharpe added a subscriber: cfe-commits. Herald added subscribers: JDevlieghere, klimek. https://reviews.llvm.org/D27655 Files: lib/CodeGen/CGOpenCLRuntime.cpp lib/Driver/Types.cpp lib/Frontend/CodeGenOptions.cpp lib/Frontend/CompilerInstance.cpp lib/Lex/HeaderSearch.cpp lib/Lex/ModuleMap.cpp lib/Sema/DelayedDiagnostic.cpp lib/Tooling/Core/QualTypeNames.cpp Index: lib/Tooling/Core/QualTypeNames.cpp === --- lib/Tooling/Core/QualTypeNames.cpp +++ lib/Tooling/Core/QualTypeNames.cpp @@ -15,7 +15,7 @@ #include "clang/AST/GlobalDecl.h" #include "clang/AST/Mangle.h" -#include +#include #include namespace clang { Index: lib/Sema/DelayedDiagnostic.cpp === --- lib/Sema/DelayedDiagnostic.cpp +++ lib/Sema/DelayedDiagnostic.cpp @@ -15,7 +15,7 @@ // //===--===// #include "clang/Sema/DelayedDiagnostic.h" -#include +#include using namespace clang; using namespace sema; Index: lib/Lex/ModuleMap.cpp === --- lib/Lex/ModuleMap.cpp +++ lib/Lex/ModuleMap.cpp @@ -30,9 +30,9 @@ #include "llvm/Support/Host.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" -#include +#include #if defined(LLVM_ON_UNIX) -#include +#include #endif using namespace clang; Index: lib/Lex/HeaderSearch.cpp === --- lib/Lex/HeaderSearch.cpp +++ lib/Lex/HeaderSearch.cpp @@ -29,7 +29,7 @@ #include #include #if defined(LLVM_ON_UNIX) -#include +#include #endif using namespace clang; Index: lib/Frontend/CompilerInstance.cpp === --- lib/Frontend/CompilerInstance.cpp +++ lib/Frontend/CompilerInstance.cpp @@ -48,7 +48,7 @@ #include "llvm/Support/raw_ostream.h" #include #include -#include +#include #include using namespace clang; Index: lib/Frontend/CodeGenOptions.cpp === --- lib/Frontend/CodeGenOptions.cpp +++ lib/Frontend/CodeGenOptions.cpp @@ -8,7 +8,7 @@ //===--===// #include "clang/Frontend/CodeGenOptions.h" -#include +#include namespace clang { Index: lib/Driver/Types.cpp === --- lib/Driver/Types.cpp +++ lib/Driver/Types.cpp @@ -11,7 +11,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringSwitch.h" #include -#include +#include using namespace clang::driver; using namespace clang::driver::types; Index: lib/CodeGen/CGOpenCLRuntime.cpp === --- lib/CodeGen/CGOpenCLRuntime.cpp +++ lib/CodeGen/CGOpenCLRuntime.cpp @@ -18,7 +18,7 @@ #include "TargetInfo.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/GlobalValue.h" -#include +#include using namespace clang; using namespace CodeGen; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24218: [libc++] Fix support for multibyte thousands_sep and decimal_point in moneypunct_byname and numpunct_byname.
EricWF updated this revision to Diff 81010. EricWF added a comment. Address inline comments. https://reviews.llvm.org/D24218 Files: src/locale.cpp test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp Index: test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp === --- test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp +++ test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp @@ -16,12 +16,11 @@ // char_type thousands_sep() const; -// TODO: investigation needed -// XFAIL: linux-gnu #include #include +#include "test_macros.h" #include "platform_support.h" // locale name macros int main() @@ -54,15 +53,22 @@ } { std::locale l(LOCALE_fr_FR_UTF_8); +#if defined(TEST_HAS_GLIBC) +const char sep = ' '; +const wchar_t wsep = L' '; +#else +const char sep = ','; +const wchar_t wsep = L','; +#endif { typedef char C; const std::numpunct& np = std::use_facet >(l); -assert(np.thousands_sep() == ','); +assert(np.thousands_sep() == sep); } { typedef wchar_t C; const std::numpunct& np = std::use_facet >(l); -assert(np.thousands_sep() == L','); +assert(np.thousands_sep() == wsep); } } } Index: test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp === --- test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp +++ test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp @@ -16,12 +16,10 @@ // string grouping() const; -// TODO: investigation needed -// XFAIL: linux-gnu - #include #include +#include "test_macros.h" #include "platform_support.h" // locale name macros int main() @@ -54,15 +52,20 @@ } { std::locale l(LOCALE_fr_FR_UTF_8); +#if defined(TEST_HAS_GLIBC) +const char* const group = "\3"; +#else +const char* const group = "\x7f"; +#endif { typedef char C; const std::numpunct& np = std::use_facet >(l); -assert(np.grouping() == "\x7F"); +assert(np.grouping() == group); } { typedef wchar_t C; const std::numpunct& np = std::use_facet >(l); -assert(np.grouping() == "\x7F"); +assert(np.grouping() == group); } } } Index: test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp === --- test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp +++ test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp @@ -18,16 +18,11 @@ // charT thousands_sep() const; -// Failure related to GLIBC's use of U00A0 as mon_thousands_sep -// and U002E as mon_decimal_point. -// TODO: U00A0 should be investigated. -// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006 -// XFAIL: linux-gnu - #include #include #include +#include "test_macros.h" #include "platform_support.h" // locale name macros class Fnf @@ -114,22 +109,34 @@ Fwt f(LOCALE_fr_FR_UTF_8, 1); assert(f.thousands_sep() == L' '); } - +// The below tests work around GLIBC's use of U00A0 as mon_thousands_sep +// and U002E as mon_decimal_point. +// TODO: Fix thousands_sep for 'char'. +// related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006 +#ifndef TEST_HAS_GLIBC +const char sep = ' '; +const wchar_t wsep = L' '; +#else +// FIXME libc++ specifically works around \u00A0 by translating it into +// a regular space. +const char sep = ' '; +const wchar_t wsep = L'\u00A0'; +#endif { Fnf f(LOCALE_ru_RU_UTF_8, 1); -assert(f.thousands_sep() == ' '); +assert(f.thousands_sep() == sep); } { Fnt f(LOCALE_ru_RU_UTF_8, 1); -assert(f.thousands_sep() == ' '); +assert(f.thousands_sep() == sep); } { Fwf f(LOCALE_ru_RU_UTF_8, 1); -assert(f.thousands_sep() == L' '); +assert(f.thousands_sep() == wsep); } { Fwt f(LOCALE_ru_RU_UTF_8, 1); -assert(f.t
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
malcolm.parsons added inline comments. Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:48 + // Single declarations and macros will be ignored + if (DeclStmt->isSingleDecl() || DeclStmt->getLocStart().isMacroID()) +return; Can you reject single decls in the matcher? e.g. `unless(declCountIs(1))`. Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:71 + // - and so on... + for (auto It = DeclStmt->getDeclGroup().begin(); + It != DeclStmt->getDeclGroup().end(); ++It) { `DeclStmt->getDeclGroup()` is repeated several times. Store it in a variable. Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:76 + +if (const clang::DeclaratorDecl *DecDecl = +llvm::dyn_cast(*It)) { `auto *` Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:79 + VariableLocation.setEnd(DecDecl->getLocEnd()); +} else if (const clang::TypedefDecl *TypeDecl = + llvm::dyn_cast(*It)) { `auto *` Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:109 +// http://lists.llvm.org/pipermail/cfe-dev/2016-November/051425.html +if (const clang::VarDecl *VarDecl = +llvm::dyn_cast(*It)) { `auto *` Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:167 +Type = FirstVar->getType(); + } else if (const auto FirstVar = + llvm::dyn_cast(*FirstVarIt)) { `auto *` Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:214 + + if (const MemberPointerType *T = Type->getAs()) { +auto Pos = UserWrittenType.find("::"); `auto *` Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:246 + +static std::string getCurrentLineIndent(SourceLocation Loc, +const SourceManager &SM) { Should checks care about formatting, or leave to clang-format? Comment at: docs/clang-tidy/checks/readability-one-name-per-declaration.rst:46 + +typdef int ta; +typdef int tb; `typedef` https://reviews.llvm.org/D27621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27199: [libcxx] Make std::ignore constexpr
EricWF added a comment. @AntonBikineev Do you need somebody to commit this for you? https://reviews.llvm.org/D27199 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC
EricWF added a comment. Howard Thank you for your excellent analysis. Although I still don't think that `CLOCK_UPTIME_RAW` meets the requirements of `steady_clock` but I would rather relax the standard here than provide a poor implementation. In https://reviews.llvm.org/D27429#618998, @howard.hinnant wrote: > I feel strongly enough about this that I would like to see a static_assert > that the CLOCK_MONOTONIC is never accidentally chosen by the preprocessor > when targeting macOS, or iOS. I agree. This patch LGTM after ensuring that CLOCK_MONOTONIC is never selected on Apple platforms. https://reviews.llvm.org/D27429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26626: [libcxx] [test] Fix an improper assumption about Null Forward Iterators.
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. LGTM. Go ahead and remove the tests. I filed a libc++ bug reminding me to diagnose those comparisons in debug mode (https://llvm.org/bugs/show_bug.cgi?id=31343). https://reviews.llvm.org/D26626 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27555: [libcxx] [test] Fix MSVC warning C6001 "Using uninitialized memory".
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. I'm happy to work around this one issue but in general I dislike initializing memory to avoid compile-time warnings. Doing so prevents the sanitizers from catching actual uninitialized memory bugs. For this reason I think the warning is an actual compiler bug because it hinders sanitizer usage and possibly hides bugs. https://reviews.llvm.org/D27555 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27270: [libcxx] [test] Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 4/4.
EricWF requested changes to this revision. EricWF added a comment. This revision now requires changes to proceed. Actually I've changed my mind on this patch. While attempting to clean up `-Wconversion` errors in libc++ I found many of them were caused by these custom allocators providing a custom 32 bit size type. Since users are free to do this AFAIK it seems like we should keep these tests for it. @STL_MSFT Does that make sense? https://reviews.llvm.org/D27270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27575: [libcxxabi] Introduce an externally threaded libc++abi variant (take-2)
EricWF added a comment. This LGTM. I'll approve after the inline comments are addressed. Comment at: CMakeLists.txt:121 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF) +option(LIBCXXABI_HAS_EXTERNAL_THREAD_API + "Build libc++abi with an externalized threading API. Maybe use a dependent option that sets it to the value of `LIBCXX_ENABLE_THREADS` when it is defined? Comment at: src/fallback_malloc.cpp:37 class mutexor { public: Can't we replace this class with `std::mutex` directly? Comment at: test/test_exception_storage.pass.cpp:42 size_t thread_globals [ NUMTHREADS ] = { 0 }; -__libcxxabi_thread_t threads[ NUMTHREADS ]; +std::__libcpp_thread_t threads[ NUMTHREADS ]; #endif What happened to the initializer? https://reviews.llvm.org/D27575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27270: [libcxx] [test] Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 4/4.
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. This change looks OK to me. As mentioned above I think the reason the test allocators used int/unsigned is so they could detect if the container actually propagated their typedefs. However there are other ways to test this. Comment at: test/std/utilities/allocator.adaptor/types.pass.cpp:78 static_assert((std::is_same< std::scoped_allocator_adaptor, A1>::size_type, This part of the change loses test coverage. Specifically it no longer tests that `scoped_allocator_adaptor` propagates the OuterAlloc's typedefs. I would scribble out a minimal custom allocator at the top of this file, and rewrite these static asserts using that. https://reviews.llvm.org/D27270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27576: [libcxx] libc++ changes necessary for the externally threaded libcxxabi variant
EricWF added a comment. This bit LGTM. Comment at: include/__threading_support:193 +// Execute once +int __libcpp_execute_once(__libcpp_exec_once_flag *flag, + void (*init_routine)(void)) { These should have `inline`. In fact all of the functions in this header must be declared inline but have not been. Comment at: test/libcxx/test/config.py:605 +if self.get_lit_bool('cxx_ext_threads', default=False): +self.cxx.link_flags += ['-lcxx_external_threads'] self.target_info.add_cxx_link_flags(self.cxx.link_flags) I would rather use `libc++external_threads` since it uses the same prefix as `-lc++` and `-lc++experimental` https://reviews.llvm.org/D27576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26623: [libcxx] [test] Swapping non-equal non-POCS allocators is UB.
EricWF added a comment. I hope you don't mind but I committed by own version of this change as r289358. I was concerned about testing that the container didn't actually perform a swap, so I modified test_allocator to take an "id" parameter that does not participate in equality. I then changed the tests to check that the "id" was unchanged after the swap. Once confirming that r289358 fixes your issues could you please close this review? https://reviews.llvm.org/D26623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26814: [libcxx] [test] Change ifstream constructor tests to handle read-only files.
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. LGTM. Thanks for working on this. https://reviews.llvm.org/D26814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27387: [libc++] Add a key function for bad_function_call
EricWF requested changes to this revision. EricWF added a comment. This revision now requires changes to proceed. OK. I would like to see this change introduced under a `_LIBCPP_ABI` flag. I'll take a look at this again after that. https://reviews.llvm.org/D27387 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26896: [libcxx] Make constexpr char_traits and char_traits
EricWF requested changes to this revision. EricWF added a comment. This revision now requires changes to proceed. Marking as "Changes requested". I'll take a look at this again once the if-def hell around `find` and `compare` are cleaned up. https://reviews.llvm.org/D26896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27658: [libcxx] Fix all occurrences of -Wsign-compare in the headers
EricWF created this revision. EricWF added a reviewer: mclow.lists. EricWF added subscribers: cfe-commits, STL_MSFT. The title says it all. Thanks to STL for cleaning up all occurrences in the tests so we can find these. https://reviews.llvm.org/D27658 Files: include/__bit_reference include/deque include/istream include/random include/regex include/vector test/libcxx/test/config.py Index: test/libcxx/test/config.py === --- test/libcxx/test/config.py +++ test/libcxx/test/config.py @@ -660,7 +660,7 @@ # team using the test suite; They enable the warnings below and # expect the test suite to be clean. # FIXME: Re-enable this after fixing remaining occurrences. -self.cxx.addWarningFlagIfSupported('-Wno-sign-compare') +self.cxx.addWarningFlagIfSupported('-Wsign-compare') # FIXME: Enable the two warnings below. self.cxx.addWarningFlagIfSupported('-Wno-unused-variable') self.cxx.addWarningFlagIfSupported('-Wno-unused-parameter') Index: include/vector === --- include/vector +++ include/vector @@ -2914,7 +2914,9 @@ vector::assign(_ForwardIterator __first, _ForwardIterator __last) { clear(); -difference_type __n = _VSTD::distance(__first, __last); +const difference_type __ns = _VSTD::distance(__first, __last); +_LIBCPP_ASSERT(__ns >= 0, "invalid range specified"); +const size_type __n = static_cast(__ns); if (__n) { if (__n > capacity()) Index: include/regex === --- include/regex +++ include/regex @@ -6420,7 +6420,8 @@ _Position __prev = __position_; if (__result_ == &__suffix_) __result_ = nullptr; -else if (_N_ + 1 < __subs_.size()) +// _N_ should always be positive +else if (static_cast(_N_) + 1 < __subs_.size()) { ++_N_; __establish_result(); Index: include/random === --- include/random +++ include/random @@ -2918,7 +2918,7 @@ typename discard_block_engine<_Engine, __p, __r>::result_type discard_block_engine<_Engine, __p, __r>::operator()() { -if (__n_ >= __r) +if (__n_ >= 0 && static_cast(__n_) >= __r) { __e_.discard(__p - __r); __n_ = 0; Index: include/istream === --- include/istream +++ include/istream @@ -1651,7 +1651,7 @@ ios_base::iostate __err = ios_base::goodbit; _CharT __zero = __ct.widen('0'); _CharT __one = __ct.widen('1'); -while (__c < _Size) +while (static_cast(__c) < _Size) { typename _Traits::int_type __i = __is.rdbuf()->sgetc(); if (_Traits::eq_int_type(__i, _Traits::eof())) Index: include/deque === --- include/deque +++ include/deque @@ -2735,7 +2735,7 @@ difference_type __pos = __f - __b; iterator __p = __b + __pos; allocator_type& __a = __base::__alloc(); -if (__pos <= (__base::size() - 1) / 2) +if (static_cast(__pos) <= (__base::size() - 1) / 2) { // erase from front _VSTD::move_backward(__b, __p, _VSTD::next(__p)); __alloc_traits::destroy(__a, _VSTD::addressof(*__b)); Index: include/__bit_reference === --- include/__bit_reference +++ include/__bit_reference @@ -163,7 +163,7 @@ { typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; -static const unsigned __bits_per_word = _It::__bits_per_word; +static const int __bits_per_word = _It::__bits_per_word; // do first partial word if (__first.__ctz_ != 0) { @@ -199,7 +199,7 @@ { typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; -static const unsigned __bits_per_word = _It::__bits_per_word; +static const int __bits_per_word = _It::__bits_per_word; // do first partial word if (__first.__ctz_ != 0) { @@ -251,7 +251,7 @@ typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; typedef typename _It::difference_type difference_type; -static const unsigned __bits_per_word = _It::__bits_per_word; +static const int __bits_per_word = _It::__bits_per_word; difference_type __r = 0; // do first partial word if (__first.__ctz_ != 0) @@ -282,7 +282,7 @@ typedef __bit_iterator<_Cp, _IsConst> _It; typedef typename _It::__storage_type __storage_type; typedef typename _It::difference_type difference_type; -static const unsigned __bits_per_word = _It::__bits_per_word; +stat
[PATCH] D26830: [libcxx] Add string_view literals
EricWF added a comment. Please ping this once the Clang changes have been accepted. I'm just waiting on those to give this the final OK. https://reviews.llvm.org/D26830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27655: Fix modernize-deprecated-headers clang-tidy warnings
Eugene.Zelenko added a comment. Did you enable analysis of headers in Clang-tidy? Comment at: lib/Frontend/CompilerInstance.cpp:51 #include -#include +#include #include Will be good idea to run Clang-format or sort headers manually. Comment at: lib/Lex/HeaderSearch.cpp:34 #endif using namespace clang; Please add empty line before using. Comment at: lib/Lex/ModuleMap.cpp:33 #include "llvm/Support/raw_ostream.h" -#include +#include #if defined(LLVM_ON_UNIX) Please fix order of headers. Comment at: lib/Lex/ModuleMap.cpp:35 #if defined(LLVM_ON_UNIX) -#include +#include #endif Could limits be used instead? Comment at: lib/Sema/DelayedDiagnostic.cpp:19 +#include using namespace clang; using namespace sema; Please add empty line before using. Comment at: lib/Tooling/Core/QualTypeNames.cpp:17 #include "clang/AST/Mangle.h" +#include Please remove empty line. https://reviews.llvm.org/D27655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino updated this revision to Diff 81022. firolino marked 7 inline comments as done. firolino added a comment. Applied suggestions from malcolm. https://reviews.llvm.org/D27621 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/OneNamePerDeclarationCheck.cpp clang-tidy/readability/OneNamePerDeclarationCheck.h clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/readability-one-name-per-declaration.rst test/clang-tidy/readability-one-name-per-declaration-complex.cpp test/clang-tidy/readability-one-name-per-declaration-modern.cpp test/clang-tidy/readability-one-name-per-declaration-simple.cpp Index: test/clang-tidy/readability-one-name-per-declaration-simple.cpp === --- /dev/null +++ test/clang-tidy/readability-one-name-per-declaration-simple.cpp @@ -0,0 +1,132 @@ +// RUN: %check_clang_tidy %s readability-one-name-per-declaration %t + +int cantTouchA, cantTouchB; + +void simple() +{ +int dontTouchC; + +long empty; +long long1 = 11, *long2 = &empty, * long3 = ∅ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long1 = 11; +// CHECK-FIXES: {{^}}long *long2 = ∅ +// CHECK-FIXES: {{^}}long * long3 = ∅ + +long ** lint1, lint2 = 0, * lint3, **linn; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long ** lint1; +// CHECK-FIXES: {{^}}long lint2 = 0; +// CHECK-FIXES: {{^}}long * lint3; +// CHECK-FIXES: {{^}}long **linn; + + long int* lint4, *lint5, lint6; + // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] + // CHECK-FIXES: {{^ }}long int* lint4; + // CHECK-FIXES: {{^ }}long int *lint5; + // CHECK-FIXES: {{^ }}long int lint6; + +unsigned int uint1 = 0, uint2 = 44u, uint3, uint4=4; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}unsigned int uint1 = 0; +// CHECK-FIXES: {{^}}unsigned int uint2 = 44u; +// CHECK-FIXES: {{^}}unsigned int uint3; +// CHECK-FIXES: {{^}}unsigned int uint4=4; + +double darray1[] = {}, darray2[] = {1, 2}, dv1 = 3, dv2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}double darray1[] = {}; +// CHECK-FIXES: {{^}}double darray2[] = {1, 2}; +// CHECK-FIXES: {{^}}double dv1 = 3; +// CHECK-FIXES: {{^}}double dv2; + +int notransform[] = { + 1, + 2 + }; + +const int cx = 1, cy = 2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const int cx = 1; +// CHECK-FIXES: {{^}}const int cy = 2; + +volatile int vx, vy; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}volatile int vx; +// CHECK-FIXES: {{^}}volatile int vy; + +signed char sc1 = 'h', sc2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}signed char sc1 = 'h'; +// CHECK-FIXES: {{^}}signed char sc2; + +long long ll1, ll2, ***ft; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long ll1; +// CHECK-FIXES: {{^}}long long ll2; +// CHECK-FIXES: {{^}}long long ***ft; + +const char *cstr1 = "str1", *cstr2="str2"; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const char *cstr1 = "str1"; +// CHECK-FIXES: {{^}}const char *cstr2="str2"; + +const char *literal1 = "clang" "test" \ + "one", + *literal2 = "empty", literal3[] = "three"; +// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: declaration statement can
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino updated this revision to Diff 81023. firolino added a comment. typdef -> typedef https://reviews.llvm.org/D27621 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/OneNamePerDeclarationCheck.cpp clang-tidy/readability/OneNamePerDeclarationCheck.h clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/readability-one-name-per-declaration.rst test/clang-tidy/readability-one-name-per-declaration-complex.cpp test/clang-tidy/readability-one-name-per-declaration-modern.cpp test/clang-tidy/readability-one-name-per-declaration-simple.cpp Index: test/clang-tidy/readability-one-name-per-declaration-simple.cpp === --- /dev/null +++ test/clang-tidy/readability-one-name-per-declaration-simple.cpp @@ -0,0 +1,132 @@ +// RUN: %check_clang_tidy %s readability-one-name-per-declaration %t + +int cantTouchA, cantTouchB; + +void simple() +{ +int dontTouchC; + +long empty; +long long1 = 11, *long2 = &empty, * long3 = ∅ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long1 = 11; +// CHECK-FIXES: {{^}}long *long2 = ∅ +// CHECK-FIXES: {{^}}long * long3 = ∅ + +long ** lint1, lint2 = 0, * lint3, **linn; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long ** lint1; +// CHECK-FIXES: {{^}}long lint2 = 0; +// CHECK-FIXES: {{^}}long * lint3; +// CHECK-FIXES: {{^}}long **linn; + + long int* lint4, *lint5, lint6; + // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] + // CHECK-FIXES: {{^ }}long int* lint4; + // CHECK-FIXES: {{^ }}long int *lint5; + // CHECK-FIXES: {{^ }}long int lint6; + +unsigned int uint1 = 0, uint2 = 44u, uint3, uint4=4; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}unsigned int uint1 = 0; +// CHECK-FIXES: {{^}}unsigned int uint2 = 44u; +// CHECK-FIXES: {{^}}unsigned int uint3; +// CHECK-FIXES: {{^}}unsigned int uint4=4; + +double darray1[] = {}, darray2[] = {1, 2}, dv1 = 3, dv2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}double darray1[] = {}; +// CHECK-FIXES: {{^}}double darray2[] = {1, 2}; +// CHECK-FIXES: {{^}}double dv1 = 3; +// CHECK-FIXES: {{^}}double dv2; + +int notransform[] = { + 1, + 2 + }; + +const int cx = 1, cy = 2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const int cx = 1; +// CHECK-FIXES: {{^}}const int cy = 2; + +volatile int vx, vy; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}volatile int vx; +// CHECK-FIXES: {{^}}volatile int vy; + +signed char sc1 = 'h', sc2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}signed char sc1 = 'h'; +// CHECK-FIXES: {{^}}signed char sc2; + +long long ll1, ll2, ***ft; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long ll1; +// CHECK-FIXES: {{^}}long long ll2; +// CHECK-FIXES: {{^}}long long ***ft; + +const char *cstr1 = "str1", *cstr2="str2"; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const char *cstr1 = "str1"; +// CHECK-FIXES: {{^}}const char *cstr2="str2"; + +const char *literal1 = "clang" "test" \ + "one", + *literal2 = "empty", literal3[] = "three"; +// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: declaration statement can be split up into single line declarations [readability-one-
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino updated this revision to Diff 81029. firolino marked an inline comment as done. firolino added a comment. Little typo fix. https://reviews.llvm.org/D27621 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/OneNamePerDeclarationCheck.cpp clang-tidy/readability/OneNamePerDeclarationCheck.h clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/readability-one-name-per-declaration.rst test/clang-tidy/readability-one-name-per-declaration-complex.cpp test/clang-tidy/readability-one-name-per-declaration-modern.cpp test/clang-tidy/readability-one-name-per-declaration-simple.cpp Index: test/clang-tidy/readability-one-name-per-declaration-simple.cpp === --- /dev/null +++ test/clang-tidy/readability-one-name-per-declaration-simple.cpp @@ -0,0 +1,132 @@ +// RUN: %check_clang_tidy %s readability-one-name-per-declaration %t + +int cantTouchA, cantTouchB; + +void simple() +{ +int dontTouchC; + +long empty; +long long1 = 11, *long2 = &empty, * long3 = ∅ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long1 = 11; +// CHECK-FIXES: {{^}}long *long2 = ∅ +// CHECK-FIXES: {{^}}long * long3 = ∅ + +long ** lint1, lint2 = 0, * lint3, **linn; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long ** lint1; +// CHECK-FIXES: {{^}}long lint2 = 0; +// CHECK-FIXES: {{^}}long * lint3; +// CHECK-FIXES: {{^}}long **linn; + + long int* lint4, *lint5, lint6; + // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] + // CHECK-FIXES: {{^ }}long int* lint4; + // CHECK-FIXES: {{^ }}long int *lint5; + // CHECK-FIXES: {{^ }}long int lint6; + +unsigned int uint1 = 0, uint2 = 44u, uint3, uint4=4; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}unsigned int uint1 = 0; +// CHECK-FIXES: {{^}}unsigned int uint2 = 44u; +// CHECK-FIXES: {{^}}unsigned int uint3; +// CHECK-FIXES: {{^}}unsigned int uint4=4; + +double darray1[] = {}, darray2[] = {1, 2}, dv1 = 3, dv2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}double darray1[] = {}; +// CHECK-FIXES: {{^}}double darray2[] = {1, 2}; +// CHECK-FIXES: {{^}}double dv1 = 3; +// CHECK-FIXES: {{^}}double dv2; + +int notransform[] = { + 1, + 2 + }; + +const int cx = 1, cy = 2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const int cx = 1; +// CHECK-FIXES: {{^}}const int cy = 2; + +volatile int vx, vy; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}volatile int vx; +// CHECK-FIXES: {{^}}volatile int vy; + +signed char sc1 = 'h', sc2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}signed char sc1 = 'h'; +// CHECK-FIXES: {{^}}signed char sc2; + +long long ll1, ll2, ***ft; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long ll1; +// CHECK-FIXES: {{^}}long long ll2; +// CHECK-FIXES: {{^}}long long ***ft; + +const char *cstr1 = "str1", *cstr2="str2"; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const char *cstr1 = "str1"; +// CHECK-FIXES: {{^}}const char *cstr2="str2"; + +const char *literal1 = "clang" "test" \ + "one", + *literal2 = "empty", literal3[] = "three"; +// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: declaration statement can be split up into
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino added inline comments. Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:246 + +static std::string getCurrentLineIndent(SourceLocation Loc, +const SourceManager &SM) { malcolm.parsons wrote: > Should checks care about formatting, or leave to clang-format? At least, they should not change the formatting and try to preserve it. The user shouldn't be forced to run clang-format multiple times. Moreover, not everyone is using clang-format etc. Having: ``` const int myvalue( 42 ), value ( 4 ); { int a, b, c; } ``` and getting: ``` const int myvalue(42); const int value(4); { int a; int b; int c; } ``` seems very unsatisfying to me. This would force a non-formatting-tool user to start using one. https://reviews.llvm.org/D27621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC
howard.hinnant added a comment. Thanks Eric. Fwiw `CLOCK_MONOTONIC` won't meet the requirements of the standard either. The standard appears to require `steady_clock` to be a perfect clock and there is no such thing. The wording used to only require monotonic, but the committee got a little too enthusiastic. :-) https://reviews.llvm.org/D27429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
firolino updated this revision to Diff 81039. firolino added a comment. A few namespace cleanups - Removed explicit llvm::'s, since the used names are already introduced into the clang namespace by llvm.h https://reviews.llvm.org/D27621 Files: clang-tidy/readability/CMakeLists.txt clang-tidy/readability/OneNamePerDeclarationCheck.cpp clang-tidy/readability/OneNamePerDeclarationCheck.h clang-tidy/readability/ReadabilityTidyModule.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/readability-one-name-per-declaration.rst test/clang-tidy/readability-one-name-per-declaration-complex.cpp test/clang-tidy/readability-one-name-per-declaration-modern.cpp test/clang-tidy/readability-one-name-per-declaration-simple.cpp Index: test/clang-tidy/readability-one-name-per-declaration-simple.cpp === --- /dev/null +++ test/clang-tidy/readability-one-name-per-declaration-simple.cpp @@ -0,0 +1,132 @@ +// RUN: %check_clang_tidy %s readability-one-name-per-declaration %t + +int cantTouchA, cantTouchB; + +void simple() +{ +int dontTouchC; + +long empty; +long long1 = 11, *long2 = &empty, * long3 = ∅ +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long1 = 11; +// CHECK-FIXES: {{^}}long *long2 = ∅ +// CHECK-FIXES: {{^}}long * long3 = ∅ + +long ** lint1, lint2 = 0, * lint3, **linn; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long ** lint1; +// CHECK-FIXES: {{^}}long lint2 = 0; +// CHECK-FIXES: {{^}}long * lint3; +// CHECK-FIXES: {{^}}long **linn; + + long int* lint4, *lint5, lint6; + // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] + // CHECK-FIXES: {{^ }}long int* lint4; + // CHECK-FIXES: {{^ }}long int *lint5; + // CHECK-FIXES: {{^ }}long int lint6; + +unsigned int uint1 = 0, uint2 = 44u, uint3, uint4=4; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}unsigned int uint1 = 0; +// CHECK-FIXES: {{^}}unsigned int uint2 = 44u; +// CHECK-FIXES: {{^}}unsigned int uint3; +// CHECK-FIXES: {{^}}unsigned int uint4=4; + +double darray1[] = {}, darray2[] = {1, 2}, dv1 = 3, dv2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}double darray1[] = {}; +// CHECK-FIXES: {{^}}double darray2[] = {1, 2}; +// CHECK-FIXES: {{^}}double dv1 = 3; +// CHECK-FIXES: {{^}}double dv2; + +int notransform[] = { + 1, + 2 + }; + +const int cx = 1, cy = 2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const int cx = 1; +// CHECK-FIXES: {{^}}const int cy = 2; + +volatile int vx, vy; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}volatile int vx; +// CHECK-FIXES: {{^}}volatile int vy; + +signed char sc1 = 'h', sc2; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}signed char sc1 = 'h'; +// CHECK-FIXES: {{^}}signed char sc2; + +long long ll1, ll2, ***ft; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}long long ll1; +// CHECK-FIXES: {{^}}long long ll2; +// CHECK-FIXES: {{^}}long long ***ft; + +const char *cstr1 = "str1", *cstr2="str2"; +// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration] +// CHECK-FIXES: {{^}}const char *cstr1 = "str1"; +// CHECK-FIXES: {{^}}const char *cstr2="str2"; + +const char *literal1 = "clang" "test" \ + "one", + *literal2 = "empty", literal3[] = "three"; +// CHECK-MES
[PATCH] D27529: Correct Vectorcall Register passing and HVA Behavior
erichkeane added a comment. FWIW, the LLVM side of this patch seems to have been committed: https://reviews.llvm.org/D27148 https://reviews.llvm.org/D27529 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r289413 - Add two new AST nodes to represent initialization of an array in terms of
Author: rsmith Date: Sun Dec 11 20:53:20 2016 New Revision: 289413 URL: http://llvm.org/viewvc/llvm-project?rev=289413&view=rev Log: Add two new AST nodes to represent initialization of an array in terms of initialization of each array element: * ArrayInitLoopExpr is a prvalue of array type with two subexpressions: a common expression (an OpaqueValueExpr) that represents the up-front computation of the source of the initialization, and a subexpression representing a per-element initializer * ArrayInitIndexExpr is a prvalue of type size_t representing the current position in the loop This will be used to replace the creation of explicit index variables in lambda capture of arrays and copy/move construction of classes with array elements, and also C++17 structured bindings of arrays by value (which inexplicably allow copying an array by value, unlike all of C++'s other array declarations). No uses of these nodes are introduced by this change, however. Modified: cfe/trunk/include/clang/AST/Expr.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/Basic/StmtNodes.td cfe/trunk/include/clang/Sema/Initialization.h cfe/trunk/include/clang/Serialization/ASTBitCodes.h cfe/trunk/lib/AST/ASTDumper.cpp cfe/trunk/lib/AST/Expr.cpp cfe/trunk/lib/AST/ExprClassification.cpp cfe/trunk/lib/AST/ExprConstant.cpp cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/CodeGen/CGExprAgg.cpp cfe/trunk/lib/CodeGen/CGExprScalar.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Sema/SemaExceptionSpec.cpp cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/tools/libclang/CXCursor.cpp Modified: cfe/trunk/include/clang/AST/Expr.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=289413&r1=289412&r2=289413&view=diff == --- cfe/trunk/include/clang/AST/Expr.h (original) +++ cfe/trunk/include/clang/AST/Expr.h Sun Dec 11 20:53:20 2016 @@ -4333,6 +4333,98 @@ public: } }; +/// \brief Represents a loop initializing the elements of an array. +/// +/// The need to initialize the elements of an array occurs in a number of +/// contexts: +/// +/// * in the implicit copy/move constructor for a class with an array member +/// * when a lambda-expression captures an array by value +/// * when a decomposition declaration decomposes an array +/// +/// There are two subexpressions: a common expression (the source array) +/// that is evaluated once up-front, and a per-element initializer that +/// runs once for each array element. +/// +/// Within the per-element initializer, the common expression may be referenced +/// via an OpaqueValueExpr, and the current index may be obtained via an +/// ArrayInitIndexExpr. +class ArrayInitLoopExpr : public Expr { + Stmt *SubExprs[2]; + + explicit ArrayInitLoopExpr(EmptyShell Empty) + : Expr(ArrayInitLoopExprClass, Empty), SubExprs{} {} + +public: + explicit ArrayInitLoopExpr(QualType T, Expr *CommonInit, Expr *ElementInit) + : Expr(ArrayInitLoopExprClass, T, VK_RValue, OK_Ordinary, false, + CommonInit->isValueDependent() || ElementInit->isValueDependent(), + T->isInstantiationDependentType(), + CommonInit->containsUnexpandedParameterPack() || + ElementInit->containsUnexpandedParameterPack()), +SubExprs{CommonInit, ElementInit} {} + + /// Get the common subexpression shared by all initializations (the source + /// array). + OpaqueValueExpr *getCommonExpr() const { +return cast(SubExprs[0]); + } + + /// Get the initializer to use for each array element. + Expr *getSubExpr() const { return cast(SubExprs[1]); } + + llvm::APInt getArraySize() const { +return cast(getType()->castAsArrayTypeUnsafe()) +->getSize(); + } + + static bool classof(const Stmt *S) { +return S->getStmtClass() == ArrayInitLoopExprClass; + } + + SourceLocation getLocStart() const LLVM_READONLY { +return getCommonExpr()->getLocStart(); + } + SourceLocation getLocEnd() const LLVM_READONLY { +return getCommonExpr()->getLocEnd(); + } + + child_range children() { +return child_range(SubExprs, SubExprs + 2); + } + + friend class ASTReader; + friend class ASTStmtReader; + friend class ASTStmtWriter; +}; + +/// \brief Represents the index of the current element of an array being +/// initialized by an ArrayInitLoopExpr. This can only appear within the +/// subexpression of an ArrayInitLoopExpr. +class ArrayInitIndexExpr : public Expr { + explicit ArrayInitIndexExpr(EmptyShell Empty) + : Expr(ArrayInitIndexExprClass, Empty) {} + +public: + explicit ArrayInit
[libcxx] r289418 - [libcxx][CMake] Move the warning to HandleOutOfTreeLLVM
Author: phosek Date: Sun Dec 11 23:05:46 2016 New Revision: 289418 URL: http://llvm.org/viewvc/llvm-project?rev=289418&view=rev Log: [libcxx][CMake] Move the warning to HandleOutOfTreeLLVM This currently gives a warning when building libcxx under runtimes. Differential Revision: https://reviews.llvm.org/D27643 Modified: libcxx/trunk/CMakeLists.txt libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=289418&r1=289417&r2=289418&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Sun Dec 11 23:05:46 2016 @@ -32,13 +32,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR include(HandleOutOfTreeLLVM) endif() -if (LIBCXX_STANDALONE_BUILD AND NOT LLVM_FOUND) - message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: " - "llvm-config not found and LLVM_PATH not defined.\n" - "Reconfigure with -DLLVM_CONFIG_PATH=path/to/llvm-config " - "or -DLLVM_PATH=path/to/llvm-source-root.") -endif() - # Require out of source build. include(MacroEnsureOutOfSourceBuild) MACRO_ENSURE_OUT_OF_SOURCE_BUILD( Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=289418&r1=289417&r2=289418&view=diff == --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Sun Dec 11 23:05:46 2016 @@ -41,6 +41,10 @@ macro(find_llvm_parts) set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") else() set(LLVM_FOUND OFF) +message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: " +"llvm-config not found and LLVM_PATH not defined.\n" +"Reconfigure with -DLLVM_CONFIG_PATH=path/to/llvm-config " +"or -DLLVM_PATH=path/to/llvm-source-root.") return() endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection
danielcdh added a comment. In https://reviews.llvm.org/D25435#619169, @hfinkel wrote: > In https://reviews.llvm.org/D25435#609320, @danielcdh wrote: > > > change the flag name to -fprofile-debug > > > I don't really like this name because it sounds like it might be enabling > some kind of debugging of the profiling. How about > -fdebug-info-for-profiling. Another options is to make it a mode for -g such > as -gprofiling. Thanks for the comment. I'm OK with -fdebug-info-for-profiling. If no one objects, I'll update the patch tomorrow morning. About -gprofiling, as discussed in http://lists.llvm.org/pipermail/llvm-dev/2016-November/107454.html, this should be a -f option instead of -g option. https://reviews.llvm.org/D25435 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27669: [clang-move] Use appendArgumentsAdjuster for adding extra arguments
alexshap created this revision. alexshap added reviewers: hokein, klimek. alexshap added a subscriber: cfe-commits. alexshap set the repository for this revision to rL LLVM. 1. Remove some boilerplate plate code for appending -fparse-all-comments to the list of arguments. 2. Run clang-format -i against ClangMoveMain.cpp Test plan: make check-all + test locally Repository: rL LLVM https://reviews.llvm.org/D27669 Files: clang-move/tool/ClangMoveMain.cpp Index: clang-move/tool/ClangMoveMain.cpp === --- clang-move/tool/ClangMoveMain.cpp +++ clang-move/tool/ClangMoveMain.cpp @@ -61,19 +61,19 @@ NewCC("new_cc", cl::desc("The relative/absolute file path of new cc."), cl::cat(ClangMoveCategory)); -cl::opt OldDependOnNew( -"old_depend_on_new", -cl::desc( -"Whether old header will depend on new header. If true, clang-move will " -"add #include of new header to old header."), -cl::init(false), cl::cat(ClangMoveCategory)); - -cl::opt NewDependOnOld( -"new_depend_on_old", -cl::desc( -"Whether new header will depend on old header. If true, clang-move will " -"add #include of old header to new header."), -cl::init(false), cl::cat(ClangMoveCategory)); +cl::opt +OldDependOnNew("old_depend_on_new", + cl::desc("Whether old header will depend on new header. If " +"true, clang-move will " +"add #include of new header to old header."), + cl::init(false), cl::cat(ClangMoveCategory)); + +cl::opt +NewDependOnOld("new_depend_on_old", + cl::desc("Whether new header will depend on old header. If " +"true, clang-move will " +"add #include of old header to new header."), + cl::init(false), cl::cat(ClangMoveCategory)); cl::opt Style("style", @@ -95,18 +95,7 @@ int main(int argc, const char **argv) { llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); - // Add "-fparse-all-comments" compile option to make clang parse all comments, - // otherwise, ordinary comments like "//" and "/*" won't get parsed (This is - // a bit of hacky). - std::vector ExtraArgs(argv, argv + argc); - ExtraArgs.insert(ExtraArgs.begin() + 1, "-extra-arg=-fparse-all-comments"); - std::unique_ptr RawExtraArgs( - new const char *[ExtraArgs.size()]); - for (size_t i = 0; i < ExtraArgs.size(); ++i) -RawExtraArgs[i] = ExtraArgs[i].c_str(); - int Argc = argc + 1; - tooling::CommonOptionsParser OptionsParser(Argc, RawExtraArgs.get(), - ClangMoveCategory); + tooling::CommonOptionsParser OptionsParser(argc, argv, ClangMoveCategory); if (OldDependOnNew && NewDependOnOld) { llvm::errs() << "Provide either --old_depend_on_new or " @@ -117,6 +106,9 @@ tooling::RefactoringTool Tool(OptionsParser.getCompilations(), OptionsParser.getSourcePathList()); + // Add "-fparse-all-comments" compile option to make clang parse all comments + Tool.appendArgumentsAdjuster(tooling::getInsertArgumentAdjuster( + "-fparse-all-comments", ArgumentInsertPosition::BEGIN)); move::MoveDefinitionSpec Spec; Spec.Names = {Names.begin(), Names.end()}; Spec.OldHeader = OldHeader; Index: clang-move/tool/ClangMoveMain.cpp === --- clang-move/tool/ClangMoveMain.cpp +++ clang-move/tool/ClangMoveMain.cpp @@ -61,19 +61,19 @@ NewCC("new_cc", cl::desc("The relative/absolute file path of new cc."), cl::cat(ClangMoveCategory)); -cl::opt OldDependOnNew( -"old_depend_on_new", -cl::desc( -"Whether old header will depend on new header. If true, clang-move will " -"add #include of new header to old header."), -cl::init(false), cl::cat(ClangMoveCategory)); - -cl::opt NewDependOnOld( -"new_depend_on_old", -cl::desc( -"Whether new header will depend on old header. If true, clang-move will " -"add #include of old header to new header."), -cl::init(false), cl::cat(ClangMoveCategory)); +cl::opt +OldDependOnNew("old_depend_on_new", + cl::desc("Whether old header will depend on new header. If " +"true, clang-move will " +"add #include of new header to old header."), + cl::init(false), cl::cat(ClangMoveCategory)); + +cl::opt +NewDependOnOld("new_depend_on_old", + cl::desc("Whether new header will depend on old header. If " +"true, clang-move will " +"add #include of old header to new header."), + cl::init(false), cl::cat(ClangMoveCategory)); cl::opt Style("style", @@ -95,18 +95,7 @@ int main(int argc, const char **argv)
[PATCH] D25263: [Driver] Allow setting the default linker during build
Hahnfeld accepted this revision. Hahnfeld added a comment. This revision is now accepted and ready to land. LGTM with one nit Comment at: lib/Driver/ToolChain.cpp:362 + return UseLinker; + } else if (UseLinker == "ld") { +// If we're passed the argument ld, then use whatever the default system phosek wrote: > I'm wandering whether we shouldn't use `"platform"` instead of `"ld"` here to > match what we do for `-rtlib=` and `-stdlib=`? I'd say this is fine for compatibility Comment at: lib/Driver/ToolChain.cpp:366 +return GetProgramPath(getDefaultLinker()); + } else if (!UseLinker.empty()) { +llvm::SmallString<8> LinkerName("ld."); I think this will give an error for `-fuse-ld=` with no argument. Please revert the condition above to `UseLinker.empty() || UseLinker == "ld"` to match the current behaviour Repository: rL LLVM https://reviews.llvm.org/D25263 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits