[clang-tools-extra] 2c9cf9f - [clang-tidy] New check: bugprone-suspicious-include

2020-03-12 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-12T09:59:28-06:00
New Revision: 2c9cf9f4ddd01ae9eb47522266a6343104f9d0b5

URL: 
https://github.com/llvm/llvm-project/commit/2c9cf9f4ddd01ae9eb47522266a6343104f9d0b5
DIFF: 
https://github.com/llvm/llvm-project/commit/2c9cf9f4ddd01ae9eb47522266a6343104f9d0b5.diff

LOG: [clang-tidy] New check: bugprone-suspicious-include

Detects and fixes suspicious code like: `#include "foo.cpp"`.

Inspired by: https://twitter.com/lefticus/status/1228458240364687360?s=20

https://reviews.llvm.org/D74669

Added: 
clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.h
clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/a
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/a.cpp
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/a.hpp
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/c.c
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/c.cc
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/c.cxx
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/i.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-include.cpp

Modified: 
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp 
b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
index 86936c678562..9dcb315a257a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
@@ -45,6 +45,7 @@
 #include "StringIntegerAssignmentCheck.h"
 #include "StringLiteralWithEmbeddedNulCheck.h"
 #include "SuspiciousEnumUsageCheck.h"
+#include "SuspiciousIncludeCheck.h"
 #include "SuspiciousMemsetUsageCheck.h"
 #include "SuspiciousMissingCommaCheck.h"
 #include "SuspiciousSemicolonCheck.h"
@@ -140,6 +141,8 @@ class BugproneModule : public ClangTidyModule {
 "bugprone-string-literal-with-embedded-nul");
 CheckFactories.registerCheck(
 "bugprone-suspicious-enum-usage");
+CheckFactories.registerCheck(
+"bugprone-suspicious-include");
 CheckFactories.registerCheck(
 "bugprone-suspicious-memset-usage");
 CheckFactories.registerCheck(

diff  --git a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
index c9078ed390d1..a24f3bc7eb0d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
@@ -37,6 +37,7 @@ add_clang_library(clangTidyBugproneModule
   StringIntegerAssignmentCheck.cpp
   StringLiteralWithEmbeddedNulCheck.cpp
   SuspiciousEnumUsageCheck.cpp
+  SuspiciousIncludeCheck.cpp
   SuspiciousMemsetUsageCheck.cpp
   SuspiciousMissingCommaCheck.cpp
   SuspiciousSemicolonCheck.cpp

diff  --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
new file mode 100644
index ..87ff284408dc
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
@@ -0,0 +1,108 @@
+//===--- SuspiciousIncludeCheck.cpp - clang-tidy 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "SuspiciousIncludeCheck.h"
+#include "clang/AST/ASTContext.h"
+
+namespace clang {
+namespace tidy {
+namespace bugprone {
+
+namespace {
+class SuspiciousIncludePPCallbacks : public PPCallbacks {
+public:
+  explicit SuspiciousIncludePPCallbacks(SuspiciousIncludeCheck ,
+const SourceManager ,
+Preprocessor *PP)
+  : Check(Check), PP(PP) {}
+
+  void InclusionDirective(SourceLocation HashLoc, const Token ,
+  StringRef FileName, bool IsAngled,
+  CharSourceRange FilenameRange, const FileEntry *File,
+  StringRef SearchPath, StringRef RelativePath,
+  const Module *Imported,
+  SrcMgr::CharacteristicKind FileType) override;
+
+private:
+  SuspiciousIncludeCheck 
+  Preprocessor *PP;
+};
+} // namespace
+
+SuspiciousIncludeCheck::SuspiciousIncludeCheck(StringRef Name,
+

[clang-tools-extra] 52bbdad - [clang-tidy][docs] Post-commit feedback on D74669

2020-03-09 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-09T16:51:41-06:00
New Revision: 52bbdad7d63fd060d102b3591b433d116a982255

URL: 
https://github.com/llvm/llvm-project/commit/52bbdad7d63fd060d102b3591b433d116a982255
DIFF: 
https://github.com/llvm/llvm-project/commit/52bbdad7d63fd060d102b3591b433d116a982255.diff

LOG: [clang-tidy][docs] Post-commit feedback on D74669

Added: 


Modified: 
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst

Removed: 




diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index aa9ff71ef7f8..3da1433934c4 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -82,6 +82,13 @@ New checks
 
   Checks for usages of identifiers reserved for use by the implementation.
 
+- New :doc:`bugprone-suspicious-include
+  ` check.
+
+  Finds cases where an include refers to what appears to be an implementation
+  file, which often leads to hard-to-track-down ODR violations, and diagnoses
+  them.
+
 - New :doc:`cert-oop57-cpp
   ` check.
 
@@ -98,12 +105,6 @@ New checks
 
   Finds recursive functions and diagnoses them.
 
-- New :doc:`bugprone-suspicious-include
-  ` check.
-
-  Finds includes that appear to be referring to implementation files (which
-  tends to cause ODR violations), and diagnoses them.
-
 New check aliases
 ^
 

diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst 
b/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst
index 95a90c4f1fb8..9d6c41da504e 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst
@@ -3,8 +3,8 @@
 bugprone-suspicious-include
 ===
 
-The checker detects various cases when an include refers to what appears to be
-an implementation file, which often leads to hard-to-track-down ODR violations.
+The check detects various cases when an include refers to what appears to be an
+implementation file, which often leads to hard-to-track-down ODR violations.
 
 Examples:
 
@@ -20,7 +20,7 @@ Options
 ---
 .. option:: HeaderFileExtensions
 
-   Default value: ";h;hh;hpp;hxx"
+   Default value: `";h;hh;hpp;hxx"`
A semicolon-separated list of filename extensions of header files (the
filename extensions should not contain a "." prefix). For extension-less
header files, use an empty string or leave an empty string between ";"
@@ -28,6 +28,6 @@ Options
 
 .. option:: ImplementationFileExtensions
 
-   Default value: "c;cc;cpp;cxx"
+   Default value: `"c;cc;cpp;cxx"`
Likewise, a semicolon-separated list of filename extensions of
implementation files.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 2e9d33b - Add missing list.rst entry

2020-03-09 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-09T16:27:35-06:00
New Revision: 2e9d33bccd587763fc284098b5cc60cfb9c25251

URL: 
https://github.com/llvm/llvm-project/commit/2e9d33bccd587763fc284098b5cc60cfb9c25251
DIFF: 
https://github.com/llvm/llvm-project/commit/2e9d33bccd587763fc284098b5cc60cfb9c25251.diff

LOG: Add missing list.rst entry

Added: 


Modified: 
clang-tools-extra/docs/clang-tidy/checks/list.rst

Removed: 




diff  --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst 
b/clang-tools-extra/docs/clang-tidy/checks/list.rst
index 05741385615a..5a5140bcd429 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -80,6 +80,7 @@ Clang-Tidy Checks
`bugprone-string-integer-assignment 
`_, "Yes"
`bugprone-string-literal-with-embedded-nul 
`_,
`bugprone-suspicious-enum-usage `_,
+   `bugprone-suspicious-include `_,
`bugprone-suspicious-memset-usage 
`_, "Yes"
`bugprone-suspicious-missing-comma 
`_,
`bugprone-suspicious-semicolon `_, "Yes"



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 698a127 - release notes: fix new check name

2020-03-09 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-09T16:11:35-06:00
New Revision: 698a12712920c214e39bb215fe26fad2e099425b

URL: 
https://github.com/llvm/llvm-project/commit/698a12712920c214e39bb215fe26fad2e099425b
DIFF: 
https://github.com/llvm/llvm-project/commit/698a12712920c214e39bb215fe26fad2e099425b.diff

LOG: release notes: fix new check name

Added: 


Modified: 
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 4526cf251d8c..aa9ff71ef7f8 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -98,7 +98,7 @@ New checks
 
   Finds recursive functions and diagnoses them.
 
-- New :doc:`bugprone-suspicious-includei
+- New :doc:`bugprone-suspicious-include
   ` check.
 
   Finds includes that appear to be referring to implementation files (which



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 1e0669b - [clang-tidy] New check: bugprone-suspicious-include

2020-03-09 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-09T15:54:32-06:00
New Revision: 1e0669bfe05f0f48ee88152c4a1d581f484f8d67

URL: 
https://github.com/llvm/llvm-project/commit/1e0669bfe05f0f48ee88152c4a1d581f484f8d67
DIFF: 
https://github.com/llvm/llvm-project/commit/1e0669bfe05f0f48ee88152c4a1d581f484f8d67.diff

LOG: [clang-tidy] New check: bugprone-suspicious-include

Detects and fixes suspicious code like: `#include "foo.cpp"`.

Inspired by: https://twitter.com/lefticus/status/1228458240364687360?s=20

https://reviews.llvm.org/D74669

Added: 
clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.h
clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/a
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/a.cpp
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/a.hpp
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/c.c
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/c.cc
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/c.cxx
clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/i.cpp
clang-tools-extra/test/clang-tidy/checkers/bugprone-suspicious-include.cpp

Modified: 
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp 
b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
index 86936c678562..9dcb315a257a 100644
--- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
@@ -45,6 +45,7 @@
 #include "StringIntegerAssignmentCheck.h"
 #include "StringLiteralWithEmbeddedNulCheck.h"
 #include "SuspiciousEnumUsageCheck.h"
+#include "SuspiciousIncludeCheck.h"
 #include "SuspiciousMemsetUsageCheck.h"
 #include "SuspiciousMissingCommaCheck.h"
 #include "SuspiciousSemicolonCheck.h"
@@ -140,6 +141,8 @@ class BugproneModule : public ClangTidyModule {
 "bugprone-string-literal-with-embedded-nul");
 CheckFactories.registerCheck(
 "bugprone-suspicious-enum-usage");
+CheckFactories.registerCheck(
+"bugprone-suspicious-include");
 CheckFactories.registerCheck(
 "bugprone-suspicious-memset-usage");
 CheckFactories.registerCheck(

diff  --git a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
index c9078ed390d1..a24f3bc7eb0d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
@@ -37,6 +37,7 @@ add_clang_library(clangTidyBugproneModule
   StringIntegerAssignmentCheck.cpp
   StringLiteralWithEmbeddedNulCheck.cpp
   SuspiciousEnumUsageCheck.cpp
+  SuspiciousIncludeCheck.cpp
   SuspiciousMemsetUsageCheck.cpp
   SuspiciousMissingCommaCheck.cpp
   SuspiciousSemicolonCheck.cpp

diff  --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
new file mode 100644
index ..ade7b111fc9a
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousIncludeCheck.cpp
@@ -0,0 +1,105 @@
+//===--- SuspiciousIncludeCheck.cpp - clang-tidy 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "SuspiciousIncludeCheck.h"
+#include "clang/AST/ASTContext.h"
+
+namespace clang {
+namespace tidy {
+namespace bugprone {
+
+namespace {
+class SuspiciousIncludePPCallbacks : public PPCallbacks {
+public:
+  explicit SuspiciousIncludePPCallbacks(SuspiciousIncludeCheck ,
+const SourceManager ,
+Preprocessor *PP)
+  : Check(Check), PP(PP) {}
+
+  void InclusionDirective(SourceLocation HashLoc, const Token ,
+  StringRef FileName, bool IsAngled,
+  CharSourceRange FilenameRange, const FileEntry *File,
+  StringRef SearchPath, StringRef RelativePath,
+  const Module *Imported,
+  SrcMgr::CharacteristicKind FileType) override;
+
+private:
+  SuspiciousIncludeCheck 
+  Preprocessor *PP;
+};
+} // namespace
+
+SuspiciousIncludeCheck::SuspiciousIncludeCheck(StringRef Name,
+

[clang-tools-extra] c71ef7a - Drop HEADER_ per review feedback on D74669

2020-03-09 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-09T12:14:22-06:00
New Revision: c71ef7a85d2447903ff9240aff649a57d70b050d

URL: 
https://github.com/llvm/llvm-project/commit/c71ef7a85d2447903ff9240aff649a57d70b050d
DIFF: 
https://github.com/llvm/llvm-project/commit/c71ef7a85d2447903ff9240aff649a57d70b050d.diff

LOG: Drop HEADER_ per review feedback on D74669

Added: 


Modified: 
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h 
b/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h
index 4b7810430427..43fc573aad65 100644
--- a/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h
+++ b/clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h
@@ -6,8 +6,8 @@
 //
 
//===--===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FILE_EXTENSIONS_UTILS_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FILE_EXTENSIONS_UTILS_H
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
@@ -53,4 +53,4 @@ bool isFileExtension(StringRef FileName,
 } // namespace tidy
 } // namespace clang
 
-#endif // 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADER_FILE_EXTENSIONS_UTILS_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FILE_EXTENSIONS_UTILS_H



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 47caa69 - [clang-tidy] Use ; as separator for HeaderFileExtensions

2020-03-09 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-09T11:32:44-06:00
New Revision: 47caa69120e582bf1b795ec646f069c83b0e9456

URL: 
https://github.com/llvm/llvm-project/commit/47caa69120e582bf1b795ec646f069c83b0e9456
DIFF: 
https://github.com/llvm/llvm-project/commit/47caa69120e582bf1b795ec646f069c83b0e9456.diff

LOG: [clang-tidy] Use ; as separator for HeaderFileExtensions

... and deprecate use of ',' for the same.

https://reviews.llvm.org/D75621

Added: 


Modified: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h
clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.h
clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h
clang-tools-extra/clang-tidy/utils/HeaderGuard.h
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
index 7403762122bd..d4d3ff9af75e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
@@ -32,7 +32,8 @@ 
DynamicStaticInitializersCheck::DynamicStaticInitializersCheck(StringRef Name,
   RawStringHeaderFileExtensions(Options.getLocalOrGlobal(
 "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) {
   if (!utils::parseFileExtensions(RawStringHeaderFileExtensions,
-  HeaderFileExtensions, ',')) {
+  HeaderFileExtensions,
+  utils::defaultFileExtensionDelimiters())) {
 llvm::errs() << "Invalid header file extension: "
  << RawStringHeaderFileExtensions << "\n";
   }

diff  --git 
a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h 
b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
index ac0d32202d61..f06b2d036386 100644
--- a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
@@ -19,11 +19,12 @@ namespace bugprone {
 /// Finds dynamically initialized static variables in header files.
 ///
 /// The check supports these options:
-///   - `HeaderFileExtensions`: a comma-separated list of filename extensions 
of
-/// header files (The filename extensions should not contain "." prefix).
-/// "h,hh,hpp,hxx" by default.
+///   - `HeaderFileExtensions`: a semicolon-separated list of filename
+/// extensions of header files (The filename extensions should not contain
+/// "." prefix). ";h;hh;hpp;hxx" by default.
+//
 /// For extension-less header files, using an empty string or leaving an
-/// empty string between "," if there are other filename extensions.
+/// empty string between ";" if there are other filename extensions.
 class DynamicStaticInitializersCheck : public ClangTidyCheck {
 public:
   DynamicStaticInitializersCheck(StringRef Name, ClangTidyContext *Context);

diff  --git a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp 
b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
index 09eb266efb35..968adb882391 100644
--- a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
@@ -25,7 +25,8 @@ 
GlobalNamesInHeadersCheck::GlobalNamesInHeadersCheck(StringRef Name,
   RawStringHeaderFileExtensions(Options.getLocalOrGlobal(
   "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) {
   if (!utils::parseFileExtensions(RawStringHeaderFileExtensions,
-  HeaderFileExtensions, ',')) {
+  HeaderFileExtensions,
+  utils::defaultFileExtensionDelimiters())) {
 llvm::errs() << "Invalid header file extension: "
  << RawStringHeaderFileExtensions << "\n";
   }

diff  --git a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h 
b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
index cd69df72962e..aa569dedcdb4 100644
--- a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
+++ b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
@@ -21,11 +21,12 @@ namespace 

[clang-tools-extra] 3486cc0 - [clang-tidy] Generalize HeaderFileExtensions.{h,cpp}. NFC

2020-03-09 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-03-09T11:32:44-06:00
New Revision: 3486cc014b208df3897cf5656db0d0fdeae26d6b

URL: 
https://github.com/llvm/llvm-project/commit/3486cc014b208df3897cf5656db0d0fdeae26d6b
DIFF: 
https://github.com/llvm/llvm-project/commit/3486cc014b208df3897cf5656db0d0fdeae26d6b.diff

LOG: [clang-tidy] Generalize HeaderFileExtensions.{h,cpp}. NFC

https://reviews.llvm.org/D75489

Added: 
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.cpp
clang-tools-extra/clang-tidy/utils/FileExtensionsUtils.h

Modified: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
clang-tools-extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h
clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h
clang-tools-extra/clang-tidy/utils/CMakeLists.txt
clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
clang-tools-extra/clang-tidy/utils/HeaderGuard.h

Removed: 
clang-tools-extra/clang-tidy/utils/HeaderFileExtensionsUtils.cpp
clang-tools-extra/clang-tidy/utils/HeaderFileExtensionsUtils.h



diff  --git 
a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
index 1e2184e324fc..7403762122bd 100644
--- a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
@@ -31,8 +31,8 @@ 
DynamicStaticInitializersCheck::DynamicStaticInitializersCheck(StringRef Name,
 : ClangTidyCheck(Name, Context),
   RawStringHeaderFileExtensions(Options.getLocalOrGlobal(
 "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) {
-  if (!utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
-HeaderFileExtensions, ',')) {
+  if (!utils::parseFileExtensions(RawStringHeaderFileExtensions,
+  HeaderFileExtensions, ',')) {
 llvm::errs() << "Invalid header file extension: "
  << RawStringHeaderFileExtensions << "\n";
   }

diff  --git 
a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h 
b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
index 1cf6e408aa42..ac0d32202d61 100644
--- a/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.h
@@ -10,7 +10,7 @@
 #define 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DYNAMIC_STATIC_INITIALIZERS_CHECK_H
 
 #include "../ClangTidyCheck.h"
-#include "../utils/HeaderFileExtensionsUtils.h"
+#include "../utils/FileExtensionsUtils.h"
 
 namespace clang {
 namespace tidy {
@@ -36,7 +36,7 @@ class DynamicStaticInitializersCheck : public ClangTidyCheck {
 
 private:
   const std::string RawStringHeaderFileExtensions;
-  utils::HeaderFileExtensionsSet HeaderFileExtensions;
+  utils::FileExtensionsSet HeaderFileExtensions;
 };
 
 } // namespace bugprone

diff  --git a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp 
b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
index c6d72494243c..09eb266efb35 100644
--- a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
@@ -24,8 +24,8 @@ 
GlobalNamesInHeadersCheck::GlobalNamesInHeadersCheck(StringRef Name,
 : ClangTidyCheck(Name, Context),
   RawStringHeaderFileExtensions(Options.getLocalOrGlobal(
   "HeaderFileExtensions", utils::defaultHeaderFileExtensions())) {
-  if (!utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
-HeaderFileExtensions, ',')) {
+  if (!utils::parseFileExtensions(RawStringHeaderFileExtensions,
+  HeaderFileExtensions, ',')) {
 llvm::errs() << "Invalid header file extension: "
  << RawStringHeaderFileExtensions << "\n";
   }

diff  --git a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h 
b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
index 730ef60c70fc..cd69df72962e 100644
--- a/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
+++ b/clang-tools-extra/clang-tidy/google/GlobalNamesInHeadersCheck.h
@@ -10,7 +10,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_GLOBALNAMESINHEADERSCHECK_H
 
 #include "../ClangTidyCheck.h"
-#include "../utils/HeaderFileExtensionsUtils.h"
+#include "../utils/FileExtensionsUtils.h"
 
 namespace 

[clang] 39fe440 - [clang] Fix EOL whitespace. NFC

2020-01-28 Thread Jonathan Roelofs via cfe-commits

Author: Jonathan Roelofs
Date: 2020-01-28T08:47:37-07:00
New Revision: 39fe44024689cf6d10b249db8694efbdcc6afc14

URL: 
https://github.com/llvm/llvm-project/commit/39fe44024689cf6d10b249db8694efbdcc6afc14
DIFF: 
https://github.com/llvm/llvm-project/commit/39fe44024689cf6d10b249db8694efbdcc6afc14.diff

LOG: [clang] Fix EOL whitespace. NFC

Added: 


Modified: 
clang/lib/AST/ASTContext.cpp

Removed: 




diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 75919566aa83..72969490e32d 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -636,7 +636,7 @@ comments::FullComment *ASTContext::getCommentForDecl(
   return FC;
 }
 
-void 
+void
 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID ,
const ASTContext ,
TemplateTemplateParmDecl *Parm) 
{



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r323864 - Fix typo. NFC

2018-01-31 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Wed Jan 31 04:06:15 2018
New Revision: 323864

URL: http://llvm.org/viewvc/llvm-project?rev=323864=rev
Log:
Fix typo. NFC

Modified:
cfe/trunk/www/analyzer/scan-build.html

Modified: cfe/trunk/www/analyzer/scan-build.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/scan-build.html?rev=323864=323863=323864=diff
==
--- cfe/trunk/www/analyzer/scan-build.html (original)
+++ cfe/trunk/www/analyzer/scan-build.html Wed Jan 31 04:06:15 2018
@@ -248,7 +248,7 @@ you will probably need to run config
 
 
 $ scan-build ./configure
-$ scan-build --keepk-cc make
+$ scan-build --keep-cc make
 
 
 The reason configure also needs to be run through


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r323665 - [scan-build] Add an option to skip overriding CC and CXX make vars

2018-01-29 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Mon Jan 29 08:49:34 2018
New Revision: 323665

URL: http://llvm.org/viewvc/llvm-project?rev=323665=rev
Log:
[scan-build] Add an option to skip overriding CC and CXX make vars

Autoconf and some other systems tend to add essential compilation
options to CC (e.g. -std=gnu99). When running such an auto-generated
makefile, scan-build does not need to change CC and CXX as they are
already set to use ccc-analyzer by a configure script.

Implement a new option --keep-cc as was proposed in this discussion:
http://lists.llvm.org/pipermail/cfe-dev/2013-September/031832.html

Patch by Paul Fertser!

Modified:
cfe/trunk/tools/scan-build/bin/scan-build
cfe/trunk/www/analyzer/scan-build.html

Modified: cfe/trunk/tools/scan-build/bin/scan-build
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/bin/scan-build?rev=323665=323664=323665=diff
==
--- cfe/trunk/tools/scan-build/bin/scan-build (original)
+++ cfe/trunk/tools/scan-build/bin/scan-build Mon Jan 29 08:49:34 2018
@@ -51,6 +51,7 @@ my %Options = (
   OutputDir => undef,# Parent directory to store HTML files.
   HtmlTitle => basename($CurrentDir)." - scan-build results",
   IgnoreErrors => 0, # Ignore build errors.
+  KeepCC => 0,   # Do not override CC and CXX make variables
   ViewResults => 0,  # View results when the build terminates.
   ExitStatusFoundBugs => 0,  # Exit status reflects whether bugs were found
   ShowDescription => 0,  # Display the description of the defect in the 
list
@@ -1062,6 +1063,7 @@ sub RunXcodebuild {
 sub RunBuildCommand {
   my $Args = shift;
   my $IgnoreErrors = shift;
+  my $KeepCC = shift;
   my $Cmd = $Args->[0];
   my $CCAnalyzer = shift;
   my $CXXAnalyzer = shift;
@@ -1099,8 +1101,10 @@ sub RunBuildCommand {
 unshift @$Args, $CXXAnalyzer;
   }
   elsif ($Cmd eq "make" or $Cmd eq "gmake" or $Cmd eq "mingw32-make") {
-AddIfNotPresent($Args, "CC=$CCAnalyzer");
-AddIfNotPresent($Args, "CXX=$CXXAnalyzer");
+if (!$KeepCC) {
+  AddIfNotPresent($Args, "CC=$CCAnalyzer");
+  AddIfNotPresent($Args, "CXX=$CXXAnalyzer");
+}
 if ($IgnoreErrors) {
   AddIfNotPresent($Args,"-k");
   AddIfNotPresent($Args,"-i");
@@ -1158,6 +1162,12 @@ OPTIONS:
currently supports make and xcodebuild. This is a convenience option; one
can specify this behavior directly using build options.
 
+ --keep-cc
+
+   Do not override CC and CXX make variables. Useful when running make in
+   autoconf-based (and similar) projects where configure can add extra flags
+   to those variables.
+
  --html-title [title]
  --html-title=[title]
 
@@ -1532,6 +1542,12 @@ sub ProcessArgs {
   next;
 }
 
+if ($arg eq "--keep-cc") {
+  shift @$Args;
+  $Options{KeepCC} = 1;
+  next;
+}
+
 if ($arg =~ /^--use-cc(=(.+))?$/) {
   shift @$Args;
   my $cc;
@@ -1838,8 +1854,8 @@ my %EnvVars = (
 );
 
 # Run the build.
-my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, $Cmd, $CmdCXX,
-\%EnvVars);
+my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, 
$Options{KeepCC},
+   $Cmd, $CmdCXX, \%EnvVars);
 
 if (defined $Options{OutputFormat}) {
   if ($Options{OutputFormat} =~ /plist/) {

Modified: cfe/trunk/www/analyzer/scan-build.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/scan-build.html?rev=323665=323664=323665=diff
==
--- cfe/trunk/www/analyzer/scan-build.html (original)
+++ cfe/trunk/www/analyzer/scan-build.html Mon Jan 29 08:49:34 2018
@@ -248,7 +248,7 @@ you will probably need to run config
 
 
 $ scan-build ./configure
-$ scan-build make
+$ scan-build --keepk-cc make
 
 
 The reason configure also needs to be run through


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r323664 - [analyzer] Fix -x language argument for C preprocessed sources

2018-01-29 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Mon Jan 29 08:37:53 2018
New Revision: 323664

URL: http://llvm.org/viewvc/llvm-project?rev=323664=rev
Log:
[analyzer] Fix -x language argument for C preprocessed sources

clang's -x option doesn't accept c-cpp-output as a language (even though
463eb6ab was merged, the driver still doesn't handle that).

This bug prevents testing C language projects when ccache is used.

Fixes #25851.

Investigation and patch by Dave Rigby.


Modified:
cfe/trunk/tools/scan-build/libexec/ccc-analyzer

Modified: cfe/trunk/tools/scan-build/libexec/ccc-analyzer
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/libexec/ccc-analyzer?rev=323664=323663=323664=diff
==
--- cfe/trunk/tools/scan-build/libexec/ccc-analyzer (original)
+++ cfe/trunk/tools/scan-build/libexec/ccc-analyzer Mon Jan 29 08:37:53 2018
@@ -419,7 +419,7 @@ my %LangMap = (
   'cc'  => 'c++',
   'C'   => 'c++',
   'ii'  => 'c++-cpp-output',
-  'i'   => $IsCXX ? 'c++-cpp-output' : 'c-cpp-output',
+  'i'   => $IsCXX ? 'c++-cpp-output' : 'cpp-output',
   'm'   => 'objective-c',
   'mi'  => 'objective-c-cpp-output',
   'mm'  => 'objective-c++',
@@ -439,7 +439,7 @@ my %LangsAccepted = (
   "c" => 1,
   "c++" => 1,
   "objective-c++" => 1,
-  "c-cpp-output" => 1,
+  "cpp-output" => 1,
   "objective-c-cpp-output" => 1,
   "c++-cpp-output" => 1
 );


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] [scan-build] Add an option to skip overriding CC and CXX make vars

2018-01-15 Thread Jonathan Roelofs via cfe-commits

LGTM. Would you like me to commit it for you?


Jon


On 1/14/18 9:22 AM, Paul Fertser wrote:

Autoconf and some other systems tend to add essential compilation
options to CC (e.g. -std=gnu99). When running such an auto-generated
makefile, scan-build does not need to change CC and CXX as they are
already set to use ccc-analyzer by a configure script.

Implement a new option --keep-cc as was proposed in this discussion:
http://lists.llvm.org/pipermail/cfe-dev/2013-September/031832.html
---
  tools/scan-build/bin/scan-build | 24 
  1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/tools/scan-build/bin/scan-build b/tools/scan-build/bin/scan-build
index cbf3bf3..49018eb 100755
--- a/tools/scan-build/bin/scan-build
+++ b/tools/scan-build/bin/scan-build
@@ -51,6 +51,7 @@ my %Options = (
OutputDir => undef,# Parent directory to store HTML files.
HtmlTitle => basename($CurrentDir)." - scan-build results",
IgnoreErrors => 0, # Ignore build errors.
+  KeepCC => 0,   # Do not override CC and CXX make variables
ViewResults => 0,  # View results when the build terminates.
ExitStatusFoundBugs => 0,  # Exit status reflects whether bugs were found
ShowDescription => 0,  # Display the description of the defect in the 
list
@@ -1062,6 +1063,7 @@ sub RunXcodebuild {
  sub RunBuildCommand {
my $Args = shift;
my $IgnoreErrors = shift;
+  my $KeepCC = shift;
my $Cmd = $Args->[0];
my $CCAnalyzer = shift;
my $CXXAnalyzer = shift;
@@ -1099,8 +1101,10 @@ sub RunBuildCommand {
  unshift @$Args, $CXXAnalyzer;
}
elsif ($Cmd eq "make" or $Cmd eq "gmake" or $Cmd eq "mingw32-make") {
-AddIfNotPresent($Args, "CC=$CCAnalyzer");
-AddIfNotPresent($Args, "CXX=$CXXAnalyzer");
+if (!$KeepCC) {
+  AddIfNotPresent($Args, "CC=$CCAnalyzer");
+  AddIfNotPresent($Args, "CXX=$CXXAnalyzer");
+}
  if ($IgnoreErrors) {
AddIfNotPresent($Args,"-k");
AddIfNotPresent($Args,"-i");
@@ -1158,6 +1162,12 @@ OPTIONS:
 currently supports make and xcodebuild. This is a convenience option; one
 can specify this behavior directly using build options.
  
+ --keep-cc

+
+   Do not override CC and CXX make variables. Useful when running make in
+   autoconf-based (and similar) projects where configure can add extra flags
+   to those variables.
+
   --html-title [title]
   --html-title=[title]
  
@@ -1532,6 +1542,12 @@ sub ProcessArgs {

next;
  }
  
+if ($arg eq "--keep-cc") {

+  shift @$Args;
+  $Options{KeepCC} = 1;
+  next;
+}
+
  if ($arg =~ /^--use-cc(=(.+))?$/) {
shift @$Args;
my $cc;
@@ -1838,8 +1854,8 @@ my %EnvVars = (
  );
  
  # Run the build.

-my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, $Cmd, $CmdCXX,
-\%EnvVars);
+my $ExitStatus = RunBuildCommand(\@ARGV, $Options{IgnoreErrors}, 
$Options{KeepCC},
+   $Cmd, $CmdCXX, \%EnvVars);
  
  if (defined $Options{OutputFormat}) {

if ($Options{OutputFormat} =~ /plist/) {


--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded / Siemens

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] [analyzer] Fix -x language argument for C preprocessed sources

2018-01-15 Thread Jonathan Roelofs via cfe-commits

LGTM. Would you like me to commit it for you?


Jon


On 1/14/18 3:50 AM, Paul Fertser wrote:

clang's -x option doesn't accept c-cpp-output as a language (even though
463eb6ab was merged, the driver still doesn't handle that).

This bug prevents testing C language projects when ccache is used.

Fixes #25851.

Investigation and patch by Dave Rigby.
---
  tools/scan-build/libexec/ccc-analyzer | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/scan-build/libexec/ccc-analyzer 
b/tools/scan-build/libexec/ccc-analyzer
index b0ec7e7..73cd2ff 100755
--- a/tools/scan-build/libexec/ccc-analyzer
+++ b/tools/scan-build/libexec/ccc-analyzer
@@ -419,7 +419,7 @@ my %LangMap = (
'cc'  => 'c++',
'C'   => 'c++',
'ii'  => 'c++-cpp-output',
-  'i'   => $IsCXX ? 'c++-cpp-output' : 'c-cpp-output',
+  'i'   => $IsCXX ? 'c++-cpp-output' : 'cpp-output',
'm'   => 'objective-c',
'mi'  => 'objective-c-cpp-output',
'mm'  => 'objective-c++',
@@ -439,7 +439,7 @@ my %LangsAccepted = (
"c" => 1,
"c++" => 1,
"objective-c++" => 1,
-  "c-cpp-output" => 1,
+  "cpp-output" => 1,
"objective-c-cpp-output" => 1,
"c++-cpp-output" => 1
  );


--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded / Siemens

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r321570 - Try again, this time with the correct address

2017-12-29 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Fri Dec 29 11:26:53 2017
New Revision: 321570

URL: http://llvm.org/viewvc/llvm-project?rev=321570=rev
Log:
Try again, this time with the correct address

Modified:
libcxx/trunk/CREDITS.TXT

Modified: libcxx/trunk/CREDITS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CREDITS.TXT?rev=321570=321569=321570=diff
==
--- libcxx/trunk/CREDITS.TXT (original)
+++ libcxx/trunk/CREDITS.TXT Fri Dec 29 11:26:53 2017
@@ -101,7 +101,7 @@ E: nico.ri...@gmail.com
 D: Windows fixes
 
 N: Jon Roelofs
-E: jonat...@jroelofs.com
+E: jroel...@jroelofs.com
 D: Remote testing, Newlib port, baremetal/single-threaded support.
 
 N: Jonathan Sauer


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r321569 - Try again, this time with the correct address

2017-12-29 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Fri Dec 29 11:26:28 2017
New Revision: 321569

URL: http://llvm.org/viewvc/llvm-project?rev=321569=rev
Log:
Try again, this time with the correct address

Modified:
libcxxabi/trunk/CREDITS.TXT

Modified: libcxxabi/trunk/CREDITS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CREDITS.TXT?rev=321569=321568=321569=diff
==
--- libcxxabi/trunk/CREDITS.TXT (original)
+++ libcxxabi/trunk/CREDITS.TXT Fri Dec 29 11:26:28 2017
@@ -58,7 +58,7 @@ E: e...@olofsson.info
 D: Minor patches and fixes
 
 N: Jon Roelofs
-E: jonat...@jroelofs.com
+E: jroel...@jroelofs.com
 D: ARM EHABI Unwind & Exception Handling, Bare-metal
 
 N: Nico Weber


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r321564 - Update CREDITS.txt with personal email address

2017-12-29 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Fri Dec 29 11:16:12 2017
New Revision: 321564

URL: http://llvm.org/viewvc/llvm-project?rev=321564=rev
Log:
Update CREDITS.txt with personal email address

Modified:
libcxxabi/trunk/CREDITS.TXT

Modified: libcxxabi/trunk/CREDITS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CREDITS.TXT?rev=321564=321563=321564=diff
==
--- libcxxabi/trunk/CREDITS.TXT (original)
+++ libcxxabi/trunk/CREDITS.TXT Fri Dec 29 11:16:12 2017
@@ -58,7 +58,7 @@ E: e...@olofsson.info
 D: Minor patches and fixes
 
 N: Jon Roelofs
-E: jonat...@codesourcery.com
+E: jonat...@jroelofs.com
 D: ARM EHABI Unwind & Exception Handling, Bare-metal
 
 N: Nico Weber


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r321563 - Update CREDITS.txt with personal email

2017-12-29 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Fri Dec 29 11:15:20 2017
New Revision: 321563

URL: http://llvm.org/viewvc/llvm-project?rev=321563=rev
Log:
Update CREDITS.txt with personal email

Modified:
libcxx/trunk/CREDITS.TXT

Modified: libcxx/trunk/CREDITS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CREDITS.TXT?rev=321563=321562=321563=diff
==
--- libcxx/trunk/CREDITS.TXT (original)
+++ libcxx/trunk/CREDITS.TXT Fri Dec 29 11:15:20 2017
@@ -101,7 +101,7 @@ E: nico.ri...@gmail.com
 D: Windows fixes
 
 N: Jon Roelofs
-E: jonat...@codesourcery.com
+E: jonat...@jroelofs.com
 D: Remote testing, Newlib port, baremetal/single-threaded support.
 
 N: Jonathan Sauer


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Fix for the issue 12176

2017-09-28 Thread Jonathan Roelofs via cfe-commits

+silvas


On 9/28/17 2:19 PM, Oscar Forner Martinez via cfe-commits wrote:

Hi,

Please find attached a diff to fix the issue 12176.


Link for the lazy: llvm.org/PR12176

Let me know if there 
is anything any improvements you can think of.


Best regards,

Oscar


Extract-getDepthAndIndex-issue-12176.patch


Index: lib/Sema/DepthAndIndex.h
===
--- lib/Sema/DepthAndIndex.h(nonexistent)
+++ lib/Sema/DepthAndIndex.h(working copy)
@@ -0,0 +1,32 @@
+//===- DepthAndIndex.h - Static declaration of the getDepthAndIndex function 
-*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//===--===//
+//
+//  This file defines getDepthAndIndex function.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_LIB_SEMA_DEPTHANDINDEX_H
+#define LLVM_CLANG_LIB_SEMA_DEPTHANDINDEX_H
+
+#include "clang/AST/DeclTemplate.h"
+#include "clang/Sema/DeclSpec.h"
+
+/// \brief Retrieve the depth and index of a template parameter.
+static std::pair


This should be just a declaration and a doxygen comment for it. Drop the 
'static'. You can also drop the "\brief" since autobrief is turned on.


Then the body should go in a *.cpp somewhere in lib/Sema.


+getDepthAndIndex(NamedDecl *ND) {
+  if (TemplateTypeParmDecl *TTP = dyn_cast(ND))
+return std::make_pair(TTP->getDepth(), TTP->getIndex());
+
+  if (NonTypeTemplateParmDecl *NTTP = dyn_cast(ND))
+return std::make_pair(NTTP->getDepth(), NTTP->getIndex());
+
+  TemplateTemplateParmDecl *TTP = cast(ND);
+  return std::make_pair(TTP->getDepth(), TTP->getIndex());
+}
+
+#endif // LLVM_CLANG_LIB_SEMA_DEPTHANDINDEX_H
\ No newline at end of file
Index: lib/Sema/SemaTemplateDeduction.cpp
===
--- lib/Sema/SemaTemplateDeduction.cpp  (revision 314321)
+++ lib/Sema/SemaTemplateDeduction.cpp  (working copy)
@@ -11,6 +11,7 @@
  
//===--===/
  
  #include "clang/Sema/TemplateDeduction.h"

+#include "DepthAndIndex.h"
  #include "TreeTransform.h"
  #include "clang/AST/ASTContext.h"
  #include "clang/AST/ASTLambda.h"
@@ -579,19 +580,6 @@
}
  }
  
-/// \brief Retrieve the depth and index of a template parameter.

-static std::pair
-getDepthAndIndex(NamedDecl *ND) {
-  if (TemplateTypeParmDecl *TTP = dyn_cast(ND))
-return std::make_pair(TTP->getDepth(), TTP->getIndex());
-
-  if (NonTypeTemplateParmDecl *NTTP = dyn_cast(ND))
-return std::make_pair(NTTP->getDepth(), NTTP->getIndex());
-
-  TemplateTemplateParmDecl *TTP = cast(ND);
-  return std::make_pair(TTP->getDepth(), TTP->getIndex());
-}
-
  /// \brief Retrieve the depth and index of an unexpanded parameter pack.
  static std::pair
  getDepthAndIndex(UnexpandedParameterPack UPP) {


Maybe this ^ one should go too?


Index: lib/Sema/SemaTemplateInstantiate.cpp


snip


Jon




___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded / Siemens
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r312748 - Fix validation of the -mthread-model flag in the Clang driver

2017-09-07 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu Sep  7 15:01:25 2017
New Revision: 312748

URL: http://llvm.org/viewvc/llvm-project?rev=312748=rev
Log:
Fix validation of the -mthread-model flag in the Clang driver

The ToolChain class validates the -mthread-model flag in the constructor which
doesn't work correctly since the thread model methods are virtual methods. The
check is moved into Clang::ConstructJob() when constructing the internal
command line.

https://reviews.llvm.org/D37496

Patch by: Ian Tessier!

Modified:
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=312748=312747=312748=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Sep  7 15:01:25 2017
@@ -74,11 +74,6 @@ ToolChain::ToolChain(const Driver , co
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)),
   EffectiveTriple() {
-  if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
-if (!isThreadModelSupported(A->getValue()))
-  D.Diag(diag::err_drv_invalid_thread_model_for_target)
-  << A->getValue() << A->getAsString(Args);
-
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
 getFilePaths().push_back(CandidateLibPath);

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=312748=312747=312748=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Sep  7 15:01:25 2017
@@ -3235,8 +3235,12 @@ void Clang::ConstructJob(Compilation ,
   }
 
   CmdArgs.push_back("-mthread-model");
-  if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
+  if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) {
+if (!getToolChain().isThreadModelSupported(A->getValue()))
+  D.Diag(diag::err_drv_invalid_thread_model_for_target)
+  << A->getValue() << A->getAsString(Args);
 CmdArgs.push_back(A->getValue());
+  }
   else
 CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel()));
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r312651 - Fix ARM bare metal driver to support atomics

2017-09-06 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Wed Sep  6 10:09:25 2017
New Revision: 312651

URL: http://llvm.org/viewvc/llvm-project?rev=312651=rev
Log:
Fix ARM bare metal driver to support atomics

The new bare metal support only supports the single thread model. This causes
the builtin atomic functions (e.g.: __atomic_fetch_add) to not generate
thread-safe assembly for these operations, which breaks our firmware. We target
bare metal, and need to atomically modify variables in our interrupt routines,
and task threads.

Internally, the -mthread-model flag determines whether to lower or expand
atomic operations (see D4984).

This change removes the overridden thread model methods, and instead relies on
the base ToolChain class to validate the thread model (which already includes
logic to validate single thread model support). If the single thread model is
required, the -mthread-model flag will have to be provided.

As a workaround "-mthread-model posix" could be provided, but it only works due
to a bug in the validation of the -mthread-model flag (separate patch coming to
fix this).

https://reviews.llvm.org/D37493

Patch by: Ian Tessier!

Modified:
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
cfe/trunk/lib/Driver/ToolChains/BareMetal.h
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp?rev=312651=312650=312651=diff
==
--- cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp Wed Sep  6 10:09:25 2017
@@ -65,14 +65,6 @@ Tool *BareMetal::buildLinker() const {
   return new tools::baremetal::Linker(*this);
 }
 
-std::string BareMetal::getThreadModel() const {
-  return "single";
-}
-
-bool BareMetal::isThreadModelSupported(const StringRef Model) const {
-  return Model == "single";
-}
-
 std::string BareMetal::getRuntimesDir() const {
   SmallString<128> Dir(getDriver().ResourceDir);
   llvm::sys::path::append(Dir, "lib", "baremetal");

Modified: cfe/trunk/lib/Driver/ToolChains/BareMetal.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/BareMetal.h?rev=312651=312650=312651=diff
==
--- cfe/trunk/lib/Driver/ToolChains/BareMetal.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/BareMetal.h Wed Sep  6 10:09:25 2017
@@ -38,8 +38,6 @@ public:
   bool isPICDefaultForced() const override { return false; }
   bool SupportsProfiling() const override { return false; }
   bool SupportsObjCGC() const override { return false; }
-  std::string getThreadModel() const override;
-  bool isThreadModelSupported(const StringRef Model) const override;
 
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=312651=312650=312651=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Wed Sep  6 10:09:25 2017
@@ -74,4 +74,12 @@
 
 // RUN: %clangxx -target arm-none-eabi -v 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL
-// CHECK-THREAD-MODEL: Thread model: single
+// CHECK-THREAD-MODEL: Thread model: posix
+
+// RUN: %clangxx -target arm-none-eabi -mthread-model single -v 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-SINGLE
+// CHECK-THREAD-MODEL-SINGLE: Thread model: single
+
+// RUN: %clangxx -target arm-none-eabi -mthread-model posix -v 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-POSIX
+// CHECK-THREAD-MODEL-POSIX: Thread model: posix


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r309147 - Partial fix for PR33858

2017-07-26 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Wed Jul 26 11:13:57 2017
New Revision: 309147

URL: http://llvm.org/viewvc/llvm-project?rev=309147=rev
Log:
Partial fix for PR33858

https://reviews.llvm.org/D35848

Modified:
libunwind/trunk/test/CMakeLists.txt
libunwind/trunk/test/lit.site.cfg.in

Modified: libunwind/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/CMakeLists.txt?rev=309147=309146=309147=diff
==
--- libunwind/trunk/test/CMakeLists.txt (original)
+++ libunwind/trunk/test/CMakeLists.txt Wed Jul 26 11:13:57 2017
@@ -16,7 +16,6 @@ pythonize_bool(LIBCXX_ENABLE_SHARED)
 pythonize_bool(LIBUNWIND_ENABLE_SHARED)
 pythonize_bool(LIBUNWIND_ENABLE_THREADS)
 pythonize_bool(LIBUNWIND_ENABLE_EXCEPTIONS)
-pythonize_bool(LIBUNWIND_USE_LLVM_UNWINDER)
 pythonize_bool(LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY)
 set(LIBUNWIND_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
 "TargetInfo to use when setting up test environment.")

Modified: libunwind/trunk/test/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/lit.site.cfg.in?rev=309147=309146=309147=diff
==
--- libunwind/trunk/test/lit.site.cfg.in (original)
+++ libunwind/trunk/test/lit.site.cfg.in Wed Jul 26 11:13:57 2017
@@ -7,7 +7,7 @@ config.abi_library_path = "@LIBU
 config.libcxx_src_root  = "@LIBUNWIND_LIBCXX_PATH@"
 config.libunwind_headers= "@LIBUNWIND_SOURCE_DIR@/include"
 config.cxx_library_root = "@LIBUNWIND_LIBCXX_LIBRARY_PATH@"
-config.llvm_unwinder= "@LIBUNWIND_USE_LLVM_UNWINDER@"
+config.llvm_unwinder= "1"
 config.enable_threads   = "@LIBUNWIND_ENABLE_THREADS@"
 config.use_sanitizer= "@LLVM_USE_SANITIZER@"
 config.enable_32bit = "@LIBUNWIND_BUILD_32_BITS@"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r307266 - Add a test harness

2017-07-06 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu Jul  6 08:20:12 2017
New Revision: 307266

URL: http://llvm.org/viewvc/llvm-project?rev=307266=rev
Log:
Add a test harness

Mostly cargo-culted from libcxxabi, since the unwinder was forked from there in
the first place. There may still be cruft that's only applicable to libcxxabi,
but that can be addressed in-tree.

https://reviews.llvm.org/D35038

Added:
libunwind/trunk/test/CMakeLists.txt
libunwind/trunk/test/libunwind/
libunwind/trunk/test/libunwind/__init__.py
libunwind/trunk/test/libunwind/test/
libunwind/trunk/test/libunwind/test/__init__.py
libunwind/trunk/test/libunwind/test/config.py
libunwind/trunk/test/lit.cfg
libunwind/trunk/test/lit.site.cfg.in
Modified:
libunwind/trunk/CMakeLists.txt
libunwind/trunk/test/libunwind_02.pass.cpp

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=307266=307265=307266=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Thu Jul  6 08:20:12 2017
@@ -321,3 +321,5 @@ add_subdirectory(src)
 if (LIBUNWIND_INCLUDE_DOCS)
   add_subdirectory(docs)
 endif()
+
+add_subdirectory(test)

Added: libunwind/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/CMakeLists.txt?rev=307266=auto
==
--- libunwind/trunk/test/CMakeLists.txt (added)
+++ libunwind/trunk/test/CMakeLists.txt Thu Jul  6 08:20:12 2017
@@ -0,0 +1,35 @@
+include(AddLLVM) # for add_lit_testsuite
+macro(pythonize_bool var)
+  if (${var})
+set(${var} True)
+  else()
+set(${var} False)
+  endif()
+endmacro()
+
+if (NOT DEFINED LIBCXX_ENABLE_SHARED)
+  set(LIBCXX_ENABLE_SHARED ON)
+endif()
+
+pythonize_bool(LIBUNWIND_BUILD_32_BITS)
+pythonize_bool(LIBCXX_ENABLE_SHARED)
+pythonize_bool(LIBUNWIND_ENABLE_SHARED)
+pythonize_bool(LIBUNWIND_ENABLE_THREADS)
+pythonize_bool(LIBUNWIND_ENABLE_EXCEPTIONS)
+pythonize_bool(LIBUNWIND_USE_LLVM_UNWINDER)
+pythonize_bool(LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY)
+set(LIBUNWIND_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
+"TargetInfo to use when setting up test environment.")
+set(LIBUNWIND_EXECUTOR "None" CACHE STRING
+"Executor to use when running tests.")
+
+set(AUTO_GEN_COMMENT "## Autogenerated by libunwind configuration.\n# Do not 
edit!")
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+  @ONLY)
+
+add_lit_testsuite(check-unwind "Running libunwind tests"
+  ${CMAKE_CURRENT_BINARY_DIR}
+  DEPENDS ${LIBUNWIND_TEST_DEPS}
+  )

Added: libunwind/trunk/test/libunwind/__init__.py
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/libunwind/__init__.py?rev=307266=auto
==
(empty)

Added: libunwind/trunk/test/libunwind/test/__init__.py
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/libunwind/test/__init__.py?rev=307266=auto
==
(empty)

Added: libunwind/trunk/test/libunwind/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/libunwind/test/config.py?rev=307266=auto
==
--- libunwind/trunk/test/libunwind/test/config.py (added)
+++ libunwind/trunk/test/libunwind/test/config.py Thu Jul  6 08:20:12 2017
@@ -0,0 +1,70 @@
+#===--===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is dual licensed under the MIT and the University of Illinois Open
+# Source Licenses. See LICENSE.TXT for details.
+#
+#===--===##
+import os
+import sys
+
+from libcxx.test.config import Configuration as LibcxxConfiguration
+
+
+class Configuration(LibcxxConfiguration):
+# pylint: disable=redefined-outer-name
+def __init__(self, lit_config, config):
+super(Configuration, self).__init__(lit_config, config)
+self.libunwind_src_root = None
+self.libunwind_obj_root = None
+self.abi_library_path = None
+self.libcxx_src_root = None
+
+def configure_src_root(self):
+self.libunwind_src_root = self.get_lit_conf(
+'libunwind_src_root',
+os.path.dirname(self.config.test_source_root))
+self.libcxx_src_root = self.get_lit_conf(
+'libcxx_src_root',
+os.path.join(self.libunwind_src_root, '/../libcxx'))
+
+def configure_obj_root(self):
+self.libunwind_obj_root = self.get_lit_conf('libunwind_obj_root')
+super(Configuration, self).configure_obj_root()
+
+def has_cpp_feature(self, feature, required_value):
+ 

Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits



On 5/25/17 2:41 PM, Hans Wennborg wrote:

The test was failing on Windows; r303910 for that.


Oh yuk.. thanks for fixing that.


Jon



On Thu, May 25, 2017 at 11:55 AM, Jonathan Roelofs via cfe-commits
<cfe-commits@lists.llvm.org> wrote:


On 5/25/17 11:39 AM, Galina Kistanova wrote:

Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?


r303898 should take care of that.


Jon



Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits
<cfe-commits@lists.llvm.org> wrote:

Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev
Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

  $ cmake  \
-DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
-DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
-DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
-C /path/to/clang/cmake/caches/BaremetalARM.cmake \
/path/to/llvm

https://reviews.llvm.org/D33259

Added:
 cfe/trunk/cmake/caches/BaremetalARM.cmake
 cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
 cfe/trunk/lib/Driver/ToolChains/BareMetal.h
 cfe/trunk/test/Driver/Inputs/baremetal_arm/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
 cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
 cfe/trunk/test/Driver/baremetal.cpp
Modified:
 cfe/trunk/lib/Driver/CMakeLists.txt
 cfe/trunk/lib/Driver/Driver.cpp
 cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
 cfe/trunk/lib/Driver/ToolChains/Linux.cpp
 cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto

==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS
"armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING "Builtin
Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT}
CACHE STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
"armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT}
CACHE STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING
"armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING
"armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT}
CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING
"armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL
"armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE
STRING "armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE
STRING "armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj
+  llvm-size
+  llvm-symbolizer
+  opt
+  CACHE STRING "

Re: r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits



On 5/25/17 11:39 AM, Galina Kistanova wrote:

Hello Jonathan,

This commit broke one of our builders:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2608/steps/build-unified-tree/logs/stdio

Please have a look at this?


r303898 should take care of that.


Jon



Thanks

Galina

On Thu, May 25, 2017 at 8:42 AM, Jonathan Roelofs via cfe-commits 
<cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>> wrote:


Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev
<http://llvm.org/viewvc/llvm-project?rev=303873=rev>
Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

 $ cmake  \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259 <https://reviews.llvm.org/D33259>

Added:
cfe/trunk/cmake/caches/BaremetalARM.cmake
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
cfe/trunk/lib/Driver/ToolChains/BareMetal.h
cfe/trunk/test/Driver/Inputs/baremetal_arm/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
cfe/trunk/test/Driver/baremetal.cpp
Modified:
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto

<http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto>

==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS
"armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" CACHE STRING
"Builtin Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV6M_SYSROOT} CACHE STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV7M_SYSROOT} CACHE STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING "armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT
${BAREMETAL_ARMV7EM_SYSROOT} CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE
STRING "armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON
CACHE BOOL "armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8"
CACHE STRING "armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal"
CACHE STRING &

r303898 - Appease more buildbots about r303873

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 13:55:22 2017
New Revision: 303898

URL: http://llvm.org/viewvc/llvm-project?rev=303898=rev
Log:
Appease more buildbots about r303873

Modified:
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp?rev=303898=303897=303898=diff
==
--- cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp Thu May 25 13:55:22 2017
@@ -136,6 +136,7 @@ std::string BareMetal::findLibCxxInclude
 return Dir.str();
   }
   }
+  llvm_unreachable("unhandled LibType");
 }
 
 void BareMetal::AddClangCXXStdlibIncludeArgs(


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r303880 - Relax testcase to appease buildbots

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 11:20:51 2017
New Revision: 303880

URL: http://llvm.org/viewvc/llvm-project?rev=303880=rev
Log:
Relax testcase to appease buildbots

When lld isn't built, the tests as they were previously, were too picky about
the path to the linker.

Modified:
cfe/trunk/test/Driver/baremetal.cpp

Modified: cfe/trunk/test/Driver/baremetal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=303880=303879=303880=diff
==
--- cfe/trunk/test/Driver/baremetal.cpp (original)
+++ cfe/trunk/test/Driver/baremetal.cpp Thu May 25 11:20:51 2017
@@ -10,7 +10,7 @@
 // CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include/c++/v1"
 // CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]/include"
 // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
-// CHECK-V6M-C-NEXT: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-C-NEXT: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
 // CHECK-V6M-C-SAME: "-L[[PREFIX_DIR]]/lib/clang/[[VERSION]]/lib/baremetal"
 // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome/directory/user/asked/for"
 // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
@@ -32,8 +32,8 @@
 // RUN: -target armv6m-none-eabi \
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-DEFAULTCXX %s
-// CHECK-V6M-DEFAULTCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-DEFAULTCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
@@ -45,8 +45,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBCXX %s
 // CHECK-V6M-LIBCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/{{[^v].*}}"
 // CHECK-V6M-LIBCXX: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
-// CHECK-V6M-LIBCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
 // CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
@@ -58,8 +58,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-LIBSTDCXX %s
 // CHECK-V6M-LIBSTDCXX-NOT: "-internal-isystem" "{{[^"]+}}/include/c++/v1"
 // CHECK-V6M-LIBSTDCXX: "-internal-isystem" "{{[^"]+}}/include/c++/6.0.0"
-// CHECK-V6M-LIBSTDCXX: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-LIBSTDCXX-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal"
+// CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
 // CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
 // CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
@@ -69,8 +69,8 @@
 // RUN: --sysroot=%S/Inputs/baremetal_arm \
 // RUN: -nodefaultlibs \
 // RUN:   | FileCheck --check-prefix=CHECK-V6M-NDL %s
-// CHECK-V6M-NDL: "[[PREFIX_DIR:.*]]/bin/ld.lld" "{{.*}}.o" "-Bstatic"
-// CHECK-V6M-NDL-SAME: "-L[[PREFIX_DIR]]/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
+// CHECK-V6M-NDL: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic"
+// CHECK-V6M-NDL-SAME: "-L{{[^"]*}}/lib/clang/{{.*}}/lib/baremetal" "-o" 
"{{.*}}.o"
 
 // RUN: %clangxx -target arm-none-eabi -v 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-THREAD-MODEL


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r303873 - Don't defer to the GCC driver for linking arm-baremetal

2017-05-25 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May 25 10:42:13 2017
New Revision: 303873

URL: http://llvm.org/viewvc/llvm-project?rev=303873=rev
Log:
Don't defer to the GCC driver for linking arm-baremetal

Also comes with a cmake cache for building the runtime bits:

 $ cmake  \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259

Added:
cfe/trunk/cmake/caches/BaremetalARM.cmake
cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp
cfe/trunk/lib/Driver/ToolChains/BareMetal.h
cfe/trunk/test/Driver/Inputs/baremetal_arm/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/5.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/6.0.0/.keep
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/
cfe/trunk/test/Driver/Inputs/baremetal_arm/include/c++/v1/.keep
cfe/trunk/test/Driver/baremetal.cpp
Modified:
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Frontend/gnu-mcount.c

Added: cfe/trunk/cmake/caches/BaremetalARM.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/BaremetalARM.cmake?rev=303873=auto
==
--- cfe/trunk/cmake/caches/BaremetalARM.cmake (added)
+++ cfe/trunk/cmake/caches/BaremetalARM.cmake Thu May 25 10:42:13 2017
@@ -0,0 +1,50 @@
+set(LLVM_TARGETS_TO_BUILD ARM;X86 CACHE STRING "")
+
+# Builtins
+set(LLVM_BUILTIN_TARGETS "armv7m-none-eabi;armv6m-none-eabi;armv7em-none-eabi" 
CACHE STRING "Builtin Targets")
+
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV6M_SYSROOT} CACHE 
STRING "armv6m-none-eabi Sysroot")
+set(BUILTINS_armv6m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv6m-none-eabi System Name")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv6m-none-eabi Baremetal build")
+set(BUILTINS_armv6m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv6m-none-eabi os dir")
+
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7M_SYSROOT} CACHE 
STRING "armv7m-none-eabi Sysroot")
+set(BUILTINS_armv7m-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv7m-none-eabi System Name")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv7m-none-eabi Baremetal build")
+set(BUILTINS_armv7m-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7m-none-eabi C Flags")
+set(BUILTINS_armv7m-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7m-none-eabi ASM Flags")
+set(BUILTINS_armv7m-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv7m-none-eabi os dir")
+
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSROOT ${BAREMETAL_ARMV7EM_SYSROOT} 
CACHE STRING "armv7em-none-eabi Sysroot")
+set(BUILTINS_armv7em-none-eabi_CMAKE_SYSTEM_NAME Generic CACHE STRING 
"armv7em-none-eabi System Name")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL 
"armv7em-none-eabi Baremetal build")
+set(BUILTINS_armv7em-none-eabi_CMAKE_C_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7em-none-eabi C Flags")
+set(BUILTINS_armv7em-none-eabi_CMAKE_ASM_FLAGS "-mfpu=fp-armv8" CACHE STRING 
"armv7em-none-eabi ASM Flags")
+set(BUILTINS_armv7em-none-eabi_COMPILER_RT_OS_DIR "baremetal" CACHE STRING 
"armv7em-none-eabi os dir")
+
+set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+set(LLVM_TOOLCHAIN_TOOLS
+  llc
+  llvm-ar
+  llvm-cxxfilt
+  llvm-dwarfdump
+  llvm-dsymutil
+  llvm-nm
+  llvm-objdump
+  llvm-ranlib
+  llvm-readobj
+  llvm-size
+  llvm-symbolizer
+  opt
+  CACHE STRING "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  clang
+  lld
+  clang-headers
+  builtins-armv6m-none-eabi
+  builtins-armv7m-none-eabi
+  builtins-armv7em-none-eabi
+  runtimes
+  ${LLVM_TOOLCHAIN_TOOLS}
+  CACHE STRING "")

Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=303873=303872=303873=diff
==
--- cfe/trunk/lib/Driver/CMakeLists.txt (original)
+++ cfe/trunk/lib/Driver/CMakeLists.txt Thu May 25 10:42:13 2017
@@ -30,6 +30,7 @@ add_clang_library(clangDriver
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp
   ToolChains/Bitrig.cpp
+  ToolChains/BareMetal.cpp
   ToolChains/Clang.cpp
   ToolChains/CloudABI.cpp
   ToolChains/CommonArgs.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=303873=303872=303873=diff

r302443 - Fix grammar in comment. NFC

2017-05-08 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Mon May  8 12:06:17 2017
New Revision: 302443

URL: http://llvm.org/viewvc/llvm-project?rev=302443=rev
Log:
Fix grammar in comment. NFC

Modified:
cfe/trunk/test/Misc/warning-flags.c

Modified: cfe/trunk/test/Misc/warning-flags.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=302443=302442=302443=diff
==
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Mon May  8 12:06:17 2017
@@ -6,8 +6,8 @@ This test serves two purposes:
 (1) It documents all existing warnings that currently have no associated -W 
flag,
 and ensures that the list never grows.
 
-If take an existing warning and add a flag, this test will fail.  To
-fix this test, simply remove that warning from the list below.
+If you take an existing warning and add a flag, this test will fail.
+To fix this test, simply remove that warning from the list below.
 
 (2) It prevents us adding new warnings to Clang that have no -W flag.  All
 new warnings should have -W flags.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r302296 - Multilib: add dump methods

2017-05-05 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Fri May  5 16:30:13 2017
New Revision: 302296

URL: http://llvm.org/viewvc/llvm-project?rev=302296=rev
Log:
Multilib: add dump methods

Modified:
cfe/trunk/include/clang/Driver/Multilib.h
cfe/trunk/lib/Driver/Multilib.cpp

Modified: cfe/trunk/include/clang/Driver/Multilib.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Multilib.h?rev=302296=302295=302296=diff
==
--- cfe/trunk/include/clang/Driver/Multilib.h (original)
+++ cfe/trunk/include/clang/Driver/Multilib.h Fri May  5 16:30:13 2017
@@ -84,6 +84,7 @@ public:
 return *this;
   }
 
+  LLVM_DUMP_METHOD void dump() const;
   /// \brief print summary of the Multilib
   void print(raw_ostream ) const;
 
@@ -157,6 +158,7 @@ public:
 
   unsigned size() const { return Multilibs.size(); }
 
+  LLVM_DUMP_METHOD void dump() const;
   void print(raw_ostream ) const;
 
   MultilibSet (IncludeDirsFunc F) {

Modified: cfe/trunk/lib/Driver/Multilib.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Multilib.cpp?rev=302296=302295=302296=diff
==
--- cfe/trunk/lib/Driver/Multilib.cpp (original)
+++ cfe/trunk/lib/Driver/Multilib.cpp Fri May  5 16:30:13 2017
@@ -80,6 +80,10 @@ Multilib ::includeSuffix(String
   return *this;
 }
 
+LLVM_DUMP_METHOD void Multilib::dump() const {
+  print(llvm::errs());
+}
+
 void Multilib::print(raw_ostream ) const {
   assert(GCCSuffix.empty() || (StringRef(GCCSuffix).front() == '/'));
   if (GCCSuffix.empty())
@@ -270,6 +274,10 @@ bool MultilibSet::select(const Multilib:
   return false;
 }
 
+LLVM_DUMP_METHOD void MultilibSet::dump() const {
+  print(llvm::errs());
+}
+
 void MultilibSet::print(raw_ostream ) const {
   for (const Multilib  : *this)
 OS << M << "\n";


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r302207 - Document that Multilib flags must be actual flags

2017-05-04 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu May  4 19:18:27 2017
New Revision: 302207

URL: http://llvm.org/viewvc/llvm-project?rev=302207=rev
Log:
Document that Multilib flags must be actual flags

This is because -print-multi-lib depends on them being flags for correctness.

Fixes a case of this in the arm-android multilib selection logic.

Modified:
cfe/trunk/include/clang/Driver/Multilib.h
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/test/Driver/android-ndk-standalone.cpp

Modified: cfe/trunk/include/clang/Driver/Multilib.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Multilib.h?rev=302207=302206=302207=diff
==
--- cfe/trunk/include/clang/Driver/Multilib.h (original)
+++ cfe/trunk/include/clang/Driver/Multilib.h Thu May  4 19:18:27 2017
@@ -70,7 +70,14 @@ public:
   /// All elements begin with either '+' or '-'
   const flags_list () const { return Flags; }
   flags_list () { return Flags; }
+
   /// Add a flag to the flags list
+  /// \p Flag must be a flag accepted by the driver with its leading '-' 
removed,
+  /// and replaced with either:
+  ///   '-' which contraindicates using this multilib with that flag
+  /// or:
+  ///   '+' which promotes using this multilib in the presence of that flag
+  /// otherwise '-print-multi-lib' will not emit them correctly.
   Multilib (StringRef F) {
 assert(F.front() == '+' || F.front() == '-');
 Flags.push_back(F);

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=302207=302206=302207=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Thu May  4 19:18:27 2017
@@ -893,6 +893,8 @@ static bool isSoftFloatABI(const ArgList
   A->getValue() == StringRef("soft"));
 }
 
+/// \p Flag must be a flag accepted by the driver with its leading '-' removed,
+// otherwise '-print-multi-lib' will not emit them correctly.
 static void addMultilibFlag(bool Enabled, const char *const Flag,
 std::vector ) {
   if (Enabled)
@@ -1437,17 +1439,17 @@ static void findAndroidArmMultilibs(cons
   // Find multilibs with subdirectories like armv7-a, thumb, armv7-a/thumb.
   FilterNonExistent NonExistent(Path, "/crtbegin.o", D.getVFS());
   Multilib ArmV7Multilib = makeMultilib("/armv7-a")
-   .flag("+armv7")
-   .flag("-thumb");
+   .flag("+march=armv7-a")
+   .flag("-mthumb");
   Multilib ThumbMultilib = makeMultilib("/thumb")
-   .flag("-armv7")
-   .flag("+thumb");
+   .flag("-march=armv7-a")
+   .flag("+mthumb");
   Multilib ArmV7ThumbMultilib = makeMultilib("/armv7-a/thumb")
-   .flag("+armv7")
-   .flag("+thumb");
+   .flag("+march=armv7-a")
+   .flag("+mthumb");
   Multilib DefaultMultilib = makeMultilib("")
-   .flag("-armv7")
-   .flag("-thumb");
+   .flag("-march=armv7-a")
+   .flag("-mthumb");
   MultilibSet AndroidArmMultilibs =
   MultilibSet()
   .Either(ThumbMultilib, ArmV7Multilib,
@@ -1465,8 +1467,8 @@ static void findAndroidArmMultilibs(cons
   bool IsArmV7Mode = (IsArmArch || IsThumbArch) &&
   (llvm::ARM::parseArchVersion(Arch) == 7 ||
(IsArmArch && Arch == "" && IsV7SubArch));
-  addMultilibFlag(IsArmV7Mode, "armv7", Flags);
-  addMultilibFlag(IsThumbMode, "thumb", Flags);
+  addMultilibFlag(IsArmV7Mode, "march=armv7-a", Flags);
+  addMultilibFlag(IsThumbMode, "mthumb", Flags);
 
   if (AndroidArmMultilibs.select(Flags, Result.SelectedMultilib))
 Result.Multilibs = AndroidArmMultilibs;

Modified: cfe/trunk/test/Driver/android-ndk-standalone.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/android-ndk-standalone.cpp?rev=302207=302206=302207=diff
==
--- cfe/trunk/test/Driver/android-ndk-standalone.cpp (original)
+++ cfe/trunk/test/Driver/android-ndk-standalone.cpp Thu May  4 19:18:27 2017
@@ -172,6 +172,20 @@
 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ 
]*}}/lib/armv7-a"
 // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ 
]*}}/lib"
 // CHECK-ARMV7THUMB: "-L{{.*}}/sysroot/usr/lib"
+
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi -stdlib=libstdc++ \
+// RUN: -march=armv7-a -mthumb \
+// RUN: 

[libunwind] r299381 - Try to trigger the new docs builder. NFC

2017-04-03 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Mon Apr  3 14:23:11 2017
New Revision: 299381

URL: http://llvm.org/viewvc/llvm-project?rev=299381=rev
Log:
Try to trigger the new docs builder. NFC

Modified:
libunwind/trunk/docs/index.rst

Modified: libunwind/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/index.rst?rev=299381=299380=299381=diff
==
--- libunwind/trunk/docs/index.rst (original)
+++ libunwind/trunk/docs/index.rst Mon Apr  3 14:23:11 2017
@@ -64,6 +64,7 @@ Notes and Known Issues
 
 * TODO
 
+
 Getting Involved
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r298922 - [libunwind] Add sphinx docs

2017-03-28 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Tue Mar 28 10:21:43 2017
New Revision: 298922

URL: http://llvm.org/viewvc/llvm-project?rev=298922=rev
Log:
[libunwind] Add sphinx docs

https://reviews.llvm.org/D31375

Added:
libunwind/trunk/docs/
libunwind/trunk/docs/BuildingLibunwind.rst
libunwind/trunk/docs/CMakeLists.txt
libunwind/trunk/docs/README.txt
libunwind/trunk/docs/conf.py
libunwind/trunk/docs/index.rst
Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=298922=298921=298922=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Tue Mar 28 10:21:43 2017
@@ -122,6 +122,7 @@ option(LIBUNWIND_ENABLE_STATIC "Build li
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding 
support." OFF)
 option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX 
registers." OFF)
 option(LIBUNWIND_ENABLE_THREADS "Build libunwind with threading support." ON)
+option(LIBUNWIND_INCLUDE_DOCS "Build the libunwind documentation." 
${LLVM_INCLUDE_DOCS})
 
 set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross 
compiling.")
 set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
@@ -303,3 +304,7 @@ if (NOT LIBUNWIND_CXX_INCLUDE_PATHS STRE
 endif()
 
 add_subdirectory(src)
+
+if (LIBUNWIND_INCLUDE_DOCS)
+  add_subdirectory(docs)
+endif()

Added: libunwind/trunk/docs/BuildingLibunwind.rst
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/BuildingLibunwind.rst?rev=298922=auto
==
--- libunwind/trunk/docs/BuildingLibunwind.rst (added)
+++ libunwind/trunk/docs/BuildingLibunwind.rst Tue Mar 28 10:21:43 2017
@@ -0,0 +1,167 @@
+.. _BuildingLibunwind:
+
+==
+Building libunwind
+==
+
+.. contents::
+  :local:
+
+.. _build instructions:
+
+Getting Started
+===
+
+On Mac OS, the easiest way to get this library is to link with -lSystem.
+However if you want to build tip-of-trunk from here (getting the bleeding
+edge), read on.
+
+The basic steps needed to build libc++ are:
+
+#. Checkout LLVM:
+
+   * ``cd where-you-want-llvm-to-live``
+   * ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
+
+#. Checkout libunwind:
+
+   * ``cd where-you-want-llvm-to-live``
+   * ``cd llvm/runtimes``
+   * ``svn co http://llvm.org/svn/llvm-project/libunwind/trunk libunwind``
+
+#. Configure and build libunwind:
+
+   CMake is the only supported configuration system.
+
+   Clang is the preferred compiler when building and using libunwind.
+
+   * ``cd where you want to build llvm``
+   * ``mkdir build``
+   * ``cd build``
+   * ``cmake -G  [options] ``
+
+   For more information about configuring libunwind see :ref:`CMake Options`.
+
+   * ``make unwind`` --- will build libunwind.
+   * ``make check-unwind`` --- will run the test suite.
+
+   Shared and static libraries for libunwind should now be present in 
llvm/build/lib.
+
+#. **Optional**: Install libunwind
+
+   If your system already provides an unwinder, it is important to be careful
+   not to replace it. Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to
+   select a safe place to install libunwind.
+
+   * ``make install-unwind`` --- Will install the libraries and the headers
+
+
+It is sometimes beneficial to build outside of the LLVM tree. An out-of-tree
+build would look like this:
+
+.. code-block:: bash
+
+  $ cd where-you-want-libunwind-to-live
+  $ # Check out llvm, and libunwind
+  $ ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
+  $ ``svn co http://llvm.org/svn/llvm-project/libunwind/trunk libunwind``
+  $ cd where-you-want-to-build
+  $ mkdir build && cd build
+  $ export CC=clang CXX=clang++
+  $ cmake -DLLVM_PATH=path/to/llvm \
+  path/to/libunwind
+  $ make
+
+
+.. _CMake Options:
+
+CMake Options
+=
+
+Here are some of the CMake variables that are used often, along with a
+brief explanation and LLVM-specific notes. For full documentation, check the
+CMake docs or execute ``cmake --help-variable VARIABLE_NAME``.
+
+**CMAKE_BUILD_TYPE**:STRING
+  Sets the build type for ``make`` based generators. Possible values are
+  Release, Debug, RelWithDebInfo and MinSizeRel. On systems like Visual Studio
+  the user sets the build type with the IDE settings.
+
+**CMAKE_INSTALL_PREFIX**:PATH
+  Path where LLVM will be installed if "make install" is invoked or the
+  "INSTALL" target is built.
+
+**CMAKE_CXX_COMPILER**:STRING
+  The C++ compiler to use when building and testing libunwind.
+
+
+.. _libunwind-specific options:
+
+libunwind specific options
+--
+
+.. option:: LIBUNWIND_BUILD_32_BITS:BOOL
+
+  **Default**: Same as LLVM_BUILD_32_BITS
+
+  Toggle whether libunwind should be built with -m32.

Re: [PATCH] Use the correct ObjC++ personality

2017-03-26 Thread Jonathan Roelofs via cfe-commits



On 3/26/17 10:13 AM, Jonathan Schleifer via cfe-commits wrote:

Use the correct EH personality for ObjC++ code.

Previously, it would just always use the ObjC DWARF personality, even with SjLj 
or SEH exceptions.

diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index 228efec51b..ca1535182e 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -180,8 +180,8 @@ static const EHPersonality (const 
llvm::Triple ,
  // The GCC runtime's personality function inherently doesn't support
  // mixed EH.  Use the C++ personality just to avoid returning null.
  case ObjCRuntime::GCC:
-  case ObjCRuntime::ObjFW: // XXX: this will change soon
-return EHPersonality::GNU_ObjC;
+  case ObjCRuntime::ObjFW:
+return getObjCPersonality(T, L);
  case ObjCRuntime::GNUstep:
return EHPersonality::GNU_ObjCXX;
  }



Testcase?

Jon


--
Jonathan
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298549 - Actually install scan-build / ccc-analyzer / c++-analyzer on windows

2017-03-22 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Wed Mar 22 16:13:49 2017
New Revision: 298549

URL: http://llvm.org/viewvc/llvm-project?rev=298549=rev
Log:
Actually install scan-build / ccc-analyzer / c++-analyzer on windows

Before, we were only installing the wrappers... oops.

Modified:
cfe/trunk/tools/scan-build/CMakeLists.txt

Modified: cfe/trunk/tools/scan-build/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/CMakeLists.txt?rev=298549=298548=298549=diff
==
--- cfe/trunk/tools/scan-build/CMakeLists.txt (original)
+++ cfe/trunk/tools/scan-build/CMakeLists.txt Wed Mar 22 16:13:49 2017
@@ -4,8 +4,11 @@ include(GNUInstallDirs)
 
 if (WIN32 AND NOT CYGWIN)
   set(BinFiles
+scan-build
 scan-build.bat)
   set(LibexecFiles
+ccc-analyzer
+c++-analyzer
 ccc-analyzer.bat
 c++-analyzer.bat)
 else()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D31140: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed in EHABI

2017-03-21 Thread Jonathan Roelofs via cfe-commits



On 3/21/17 1:53 PM, Christian Bruel via Phabricator wrote:

chrib added a comment.

In https://reviews.llvm.org/D31140#706411, @jroelofs wrote:


Can you clarify the logic here? It's my understanding that:

`-fno-exceptions` does *not* imply `-fno-unwind-tables`

however:

`-fno-unwind-tables` *does* imply that exceptions cannot be used on targets 
that require the tables to do unwinding.


Yes, (bad things might happen or (std::terminate will be called, or destructors 
not called.)...

But -f[no]-unwind-tables implies the UWTable attribute, not NoUwind attribute. 
To toggle NoUnwind, use -fno-exceptions

And this is getting worse with .canunwind which means DoesNotThrow :)

in my understanding,  the logic is as follow:

Since "An exception cannot propagate through a function with a nounwind table. The 
exception handling runtime environment terminates the program if it encounters a nounwind 
table during exception processing." (ARM Information Center)

The "nounwind" LLVM attribute, which means "Function does not throw" translates 
as the EXIDX_CANTUNWIND value in the exception table index table which needs to be created for the 
purpose (for the function)


I think the problem is here, actually. "nounwind" implies "does not 
throw", but "does not throw" really should not imply "nounwind". This is 
something that ought to be clarified in the langref with the addition of 
a "does not throw" attribute. Then the optimizer should be fixed to 
deduce "does not throw" instead of "nounwind", and we can let "nounwind" 
continue to imply .cantunwind.




And of course without exception runtime environment (the test here) we don't 
need this table. So I can see 3 cases:

- nounwind set :Generate .cantunwind directive and unwind 
table
- nounwind set but not EH   Do not generate the .cantunwind directive and do 
not emit the unwind table
- uwtable set Need to generate the unwind table (even 
without EH)

The  disable-arm-cantunwind flag means: without EH support if the function does 
not throw, do dot generate the exception tables and the EXIDX_CANTUNWIND value.


I'm not a big fan of this workaround flag. I'd rather see this fixed by 
clarifying/fixing the semantics of the IR.



Jon




https://reviews.llvm.org/D31140





--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298275 - Fix some sphinx -Werror's

2017-03-20 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Mon Mar 20 12:07:49 2017
New Revision: 298275

URL: http://llvm.org/viewvc/llvm-project?rev=298275=rev
Log:
Fix some sphinx -Werror's

... mostly having to do with code blocks which the syntax highlighter chokes on

Modified:
cfe/trunk/docs/ClangFormatStyleOptions.rst
cfe/trunk/docs/ReleaseNotes.rst

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=298275=298274=298275=diff
==
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Mon Mar 20 12:07:49 2017
@@ -302,7 +302,7 @@ the configuration (without a prefix: ``A
 
 .. code-block:: c++
 
-  class {
+  class Foo {
 void f() { foo(); }
   };
 
@@ -311,7 +311,7 @@ the configuration (without a prefix: ``A
 
 .. code-block:: c++
 
-  class {
+  class Foo {
 void f() { foo(); }
   };
   void f() { bar(); }
@@ -898,7 +898,7 @@ the configuration (without a prefix: ``A
 
   .. code-block:: c++
 
- CommentPragmas: '^ FOOBAR pragma:'
+ // CommentPragmas: '^ FOOBAR pragma:'
  // Will leave the following line unaffected
  #include  // FOOBAR pragma: keep
 

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=298275=298274=298275=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Mon Mar 20 12:07:49 2017
@@ -135,32 +135,43 @@ clang-format
 * Option **BreakBeforeInheritanceComma** added to break before ``:`` and ``,`` 
 in case of
   multiple inheritance in a class declaration. Enabled by default in the 
Mozilla coding style.
 
-  .. code-block:: c++
-
- true:  false:
- class MyClass  vs. class MyClass : public X, public Y 
{
- : public X };
- , public Y {
- };
+  +-++
+  | true| false  |
+  +=++
+  | .. code-block:: c++ | .. code-block:: c++|
+  | ||
+  |   class MyClass |   class MyClass : public X, public Y { |
+  |   : public X|   };   |
+  |   , public Y {  ||
+  |   };||
+  +-++
 
 * Align block comment decorations.
 
-  .. code-block:: c++
-
- /* line 1  /* line 1
-   * line 2   becomes:   * line 2
-  */ */
+  +--+-+
+  | Before   | After   |
+  +==+=+
+  |  .. code-block:: c++ | .. code-block:: c++ |
+  |  | |
+  |/* line 1 |   /* line 1 |
+  |  * line 2|* line 2 |
+  | */   |*/   |
+  +--+-+
 
 * The :doc:`ClangFormatStyleOptions` documentation provides detailed examples 
for most options.
 
 * Namespace end comments are now added or updated automatically.
 
-  .. code-block:: c++
-
- namespace A {  namespace A {
- int i; int i;
- int j;   becomes:  int j;
- }  } // namespace A
+  +-+-+
+  | Before  | After   |
+  +=+=+
+  | .. code-block:: c++ | .. code-block:: c++ |
+  | | |
+  |   namespace A { |   namespace A { |
+  |   int i;|   int i;|
+  |   int j;|   int j;|
+  |   } |   } |
+  +-+-+
 
 * Comment reflow support added. Overly long comment lines will now be reflown 
with the rest of
   the paragraph instead of just broken. Option **ReflowComments** added and 
enabled by default.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r297756 - Fix misspelled enum

2017-03-14 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Tue Mar 14 12:29:33 2017
New Revision: 297756

URL: http://llvm.org/viewvc/llvm-project?rev=297756=rev
Log:
Fix misspelled enum

https://reviews.llvm.org/D30945

Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=297756=297755=297756=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Tue Mar 14 12:29:33 2017
@@ -1686,7 +1686,7 @@ private:
 
   StmtResult ParseStatement(SourceLocation *TrailingElseLoc = nullptr,
 bool AllowOpenMPStandalone = false);
-  enum AllowedContsructsKind {
+  enum AllowedConstructsKind {
 /// \brief Allow any declarations, statements, OpenMP directives.
 ACK_Any,
 /// \brief Allow only statements and non-standalone OpenMP directives.
@@ -1695,11 +1695,11 @@ private:
 ACK_StatementsOpenMPAnyExecutable
   };
   StmtResult
-  ParseStatementOrDeclaration(StmtVector , AllowedContsructsKind Allowed,
+  ParseStatementOrDeclaration(StmtVector , AllowedConstructsKind Allowed,
   SourceLocation *TrailingElseLoc = nullptr);
   StmtResult ParseStatementOrDeclarationAfterAttributes(
  StmtVector ,
- AllowedContsructsKind Allowed,
+ AllowedConstructsKind Allowed,
  SourceLocation *TrailingElseLoc,
  ParsedAttributesWithRange );
   StmtResult ParseExprStatement();
@@ -1728,7 +1728,7 @@ private:
   StmtResult ParseAsmStatement(bool );
   StmtResult ParseMicrosoftAsmStatement(SourceLocation AsmLoc);
   StmtResult ParsePragmaLoopHint(StmtVector ,
- AllowedContsructsKind Allowed,
+ AllowedConstructsKind Allowed,
  SourceLocation *TrailingElseLoc,
  ParsedAttributesWithRange );
 
@@ -2587,7 +2587,7 @@ private:
   /// executable directives are allowed.
   ///
   StmtResult
-  ParseOpenMPDeclarativeOrExecutableDirective(AllowedContsructsKind Allowed);
+  ParseOpenMPDeclarativeOrExecutableDirective(AllowedConstructsKind Allowed);
   /// \brief Parses clause of kind \a CKind for directive of a kind \a Kind.
   ///
   /// \param DKind Kind of current directive.

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=297756=297755=297756=diff
==
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Tue Mar 14 12:29:33 2017
@@ -806,7 +806,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpen
 /// annot_pragma_openmp_end
 ///
 StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
-AllowedContsructsKind Allowed) {
+AllowedConstructsKind Allowed) {
   assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");
   ParenBraceBracketBalancer BalancerRAIIObj(*this);
   SmallVector Clauses;

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=297756=297755=297756=diff
==
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Tue Mar 14 12:29:33 2017
@@ -97,7 +97,7 @@ StmtResult Parser::ParseStatement(Source
 ///
 StmtResult
 Parser::ParseStatementOrDeclaration(StmtVector ,
-AllowedContsructsKind Allowed,
+AllowedConstructsKind Allowed,
 SourceLocation *TrailingElseLoc) {
 
   ParenBraceBracketBalancer BalancerRAIIObj(*this);
@@ -150,7 +150,7 @@ private:
 
 StmtResult
 Parser::ParseStatementOrDeclarationAfterAttributes(StmtVector ,
-  AllowedContsructsKind Allowed, SourceLocation *TrailingElseLoc,
+  AllowedConstructsKind Allowed, SourceLocation *TrailingElseLoc,
   ParsedAttributesWithRange ) {
   const char *SemiError = nullptr;
   StmtResult Res;
@@ -1903,7 +1903,7 @@ StmtResult Parser::ParseReturnStatement(
 }
 
 StmtResult Parser::ParsePragmaLoopHint(StmtVector ,
-   AllowedContsructsKind Allowed,
+   AllowedConstructsKind Allowed,
SourceLocation *TrailingElseLoc,
ParsedAttributesWithRange ) {
   // Create temporary attribute list.


___
cfe-commits 

Re: [libcxxabi] r296940 - Fix PR25874 - Detect features required for cxa_thread_atexit_test.pass.cpp

2017-03-03 Thread Jonathan Roelofs via cfe-commits



On 3/3/17 7:45 PM, Eric Fiselier wrote:
LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL should be set by 
`check_library_exists` at the bottom of `config-ix.cmake`.

Ah, cool.


Jon



On Fri, Mar 3, 2017 at 7:22 PM, Jonathan Roelofs 
> wrote:




On 3/3/17 6:26 PM, Eric Fiselier via cfe-commits wrote:

Author: ericwf
Date: Fri Mar  3 19:26:41 2017
New Revision: 296940

URL: http://llvm.org/viewvc/llvm-project?rev=296940=rev

Log:
Fix PR25874 - Detect features required for
cxa_thread_atexit_test.pass.cpp

Modified:
libcxxabi/trunk/test/CMakeLists.txt
libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp
libcxxabi/trunk/test/libcxxabi/test/config.py
libcxxabi/trunk/test/lit.site.cfg.in 

Modified: libcxxabi/trunk/test/CMakeLists.txt
URL:

http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/CMakeLists.txt?rev=296940=296939=296940=diff



==
--- libcxxabi/trunk/test/CMakeLists.txt (original)
+++ libcxxabi/trunk/test/CMakeLists.txt Fri Mar  3 19:26:41 2017
@@ -18,6 +18,7 @@ pythonize_bool(LIBCXXABI_ENABLE_THREADS)
 pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
 pythonize_bool(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
+pythonize_bool(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)


AFAIU, this is only allows specifying it at build time and not
auto-detection of it. Did you intend on setting this via something
like a CHECK_CXX_SOURCE_COMPILES check?


Jon


-- 
Jon Roelofs

jonat...@codesourcery.com 
CodeSourcery / Mentor Embedded




--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxxabi] r296940 - Fix PR25874 - Detect features required for cxa_thread_atexit_test.pass.cpp

2017-03-03 Thread Jonathan Roelofs via cfe-commits



On 3/3/17 6:26 PM, Eric Fiselier via cfe-commits wrote:

Author: ericwf
Date: Fri Mar  3 19:26:41 2017
New Revision: 296940

URL: http://llvm.org/viewvc/llvm-project?rev=296940=rev
Log:
Fix PR25874 - Detect features required for cxa_thread_atexit_test.pass.cpp

Modified:
libcxxabi/trunk/test/CMakeLists.txt
libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp
libcxxabi/trunk/test/libcxxabi/test/config.py
libcxxabi/trunk/test/lit.site.cfg.in

Modified: libcxxabi/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/CMakeLists.txt?rev=296940=296939=296940=diff
==
--- libcxxabi/trunk/test/CMakeLists.txt (original)
+++ libcxxabi/trunk/test/CMakeLists.txt Fri Mar  3 19:26:41 2017
@@ -18,6 +18,7 @@ pythonize_bool(LIBCXXABI_ENABLE_THREADS)
 pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
 pythonize_bool(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
+pythonize_bool(LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)


AFAIU, this is only allows specifying it at build time and not 
auto-detection of it. Did you intend on setting this via something like 
a CHECK_CXX_SOURCE_COMPILES check?



Jon


--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D30339: [libcxxabi] Disable calls to fprintf when building for baremetal targets in release mode

2017-02-24 Thread Jonathan Roelofs via cfe-commits



On 2/24/17 1:48 PM, Eric Fiselier wrote:
Inserting arbitrary feature macros into CMake should not be a 
supported scenario because it results is macros, such as this one, 
which are seemingly dead.


Good point.


Jon



/Eric

On Fri, Feb 24, 2017 at 1:44 PM, Jonathan Roelofs 
> wrote:




On 2/24/17 1:30 PM, Eric Fiselier via Phabricator wrote:

EricWF added a comment.

In https://reviews.llvm.org/D30339#685921
, @jroelofs wrote:

In https://reviews.llvm.org/D30339#685919
, @rmaprath wrote:

Perhaps change `config.h` and remove the definition
there and adjust other places accordingly?

The current form is very easy to trip over.


Eric's point is that LIBCXXABI_BAREMETAL is a 0/1 flag,
not a defined/not-defined flag. Please don't change from
one form to the other... it's disruptive to build systems.


I actually think it's better to maintain consistency between
libc++ and libc++abi. And libc++ never uses 0/1 flags. So I
would rather see a fix in `config.h`.

Frankly I don't care that it is disruptive to build systems
unless it's the build system owned by LLVM.


What I really care about is the interface between the build system
owned by LLVM, and the one driving it.


Jon




Repository:
   rL LLVM

https://reviews.llvm.org/D30339 




-- 
Jon Roelofs

jonat...@codesourcery.com 
CodeSourcery / Mentor Embedded




--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D30339: [libcxxabi] Disable calls to fprintf when building for baremetal targets in release mode

2017-02-24 Thread Jonathan Roelofs via cfe-commits



On 2/24/17 1:30 PM, Eric Fiselier via Phabricator wrote:

EricWF added a comment.

In https://reviews.llvm.org/D30339#685921, @jroelofs wrote:


In https://reviews.llvm.org/D30339#685919, @rmaprath wrote:


Perhaps change `config.h` and remove the definition there and adjust other 
places accordingly?

The current form is very easy to trip over.


Eric's point is that LIBCXXABI_BAREMETAL is a 0/1 flag, not a 
defined/not-defined flag. Please don't change from one form to the other... 
it's disruptive to build systems.


I actually think it's better to maintain consistency between libc++ and 
libc++abi. And libc++ never uses 0/1 flags. So I would rather see a fix in 
`config.h`.

Frankly I don't care that it is disruptive to build systems unless it's the 
build system owned by LLVM.


What I really care about is the interface between the build system owned 
by LLVM, and the one driving it.



Jon




Repository:
   rL LLVM

https://reviews.llvm.org/D30339





--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Add warning for c++ member variable shadowing

2017-02-07 Thread Jonathan Roelofs via cfe-commits



On 2/7/17 7:30 PM, Saleem Abdulrasool wrote:



On Tue, Feb 7, 2017 at 1:09 PM, Jonathan Roelofs 
> wrote:




On 1/24/17 8:10 PM, Saleem Abdulrasool via cfe-commits wrote:

Don't use the cast for the check, use isa.  Although, since
you use the
value later, it is probably better to write this as:

if (const auto *RD = cast(CurContext))
  CheckShadowInheritedVariabless(Loc, Name.getAsString(),
RD, RD);



@compnerd: s/cast/dyn_cast/ or s/cast/dyn_cast_or_null/, right?


Only in that it looks weird.  There is an assert that CurContext is a 
CXXRecordDecl, so the cast is perfectly fine.


Oh, I see. the branch is never expected to go the other way... yeah, 
that is a strange, non-idiomatic use of 'if'.



Jon



Jon


-- 
Jon Roelofs

jonat...@codesourcery.com 
CodeSourcery / Mentor Embedded




--
Saleem Abdulrasool
compnerd (at) compnerd (dot) org


--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Add warning for c++ member variable shadowing

2017-02-07 Thread Jonathan Roelofs via cfe-commits



On 1/24/17 8:10 PM, Saleem Abdulrasool via cfe-commits wrote:

Don't use the cast for the check, use isa.  Although, since you use the
value later, it is probably better to write this as:

if (const auto *RD = cast(CurContext))
  CheckShadowInheritedVariabless(Loc, Name.getAsString(), RD, RD);



@compnerd: s/cast/dyn_cast/ or s/cast/dyn_cast_or_null/, right?


Jon


--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxxabi] r292418 - Revert r286788

2017-01-18 Thread Jonathan Roelofs via cfe-commits



On 1/18/17 11:26 AM, Richard Smith via cfe-commits wrote:

On 18 January 2017 at 10:12, Jonathan Roelofs via cfe-commits
<cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>> wrote:

Author: jroelofs
Date: Wed Jan 18 12:12:39 2017
New Revision: 292418

URL: http://llvm.org/viewvc/llvm-project?rev=292418=rev
<http://llvm.org/viewvc/llvm-project?rev=292418=rev>
Log:
Revert r286788

The Itanium ABI [1] specifies that __cxa_demangle accept either:

   1) symbol names, which start with "_Z"
   2) type manglings, which do not start with "_Z"

r286788 erroneously assumes that it should only handle symbols, so
this patch
reverts it and adds a counterexample to the testcase.

1: https://mentorembedded.github.io/cxx-abi/abi.html#demangler
<https://mentorembedded.github.io/cxx-abi/abi.html#demangler>


Thanks! Just FYI, the ABI document now lives
here: https://itanium-cxx-abi.github.io/cxx-abi/


Ah, didn't realize the canonical location changed. Should I get someone 
to change where this redirect points?


   "http://www.codesourcery.com/cxx-abi/: External link to this page"

As-is, that points at the 'mentorembedded.github.io' one.


Jon



Reviewers: zygoloid, EricWF

Modified:
libcxxabi/trunk/src/cxa_demangle.cpp
libcxxabi/trunk/test/test_demangle.pass.cpp




--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r292418 - Revert r286788

2017-01-18 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Wed Jan 18 12:12:39 2017
New Revision: 292418

URL: http://llvm.org/viewvc/llvm-project?rev=292418=rev
Log:
Revert r286788

The Itanium ABI [1] specifies that __cxa_demangle accept either:

   1) symbol names, which start with "_Z"
   2) type manglings, which do not start with "_Z"

r286788 erroneously assumes that it should only handle symbols, so this patch
reverts it and adds a counterexample to the testcase.

1: https://mentorembedded.github.io/cxx-abi/abi.html#demangler


Reviewers: zygoloid, EricWF

Modified:
libcxxabi/trunk/src/cxa_demangle.cpp
libcxxabi/trunk/test/test_demangle.pass.cpp

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=292418=292417=292418=diff
==
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Wed Jan 18 12:12:39 2017
@@ -4979,22 +4979,12 @@ __cxa_demangle(const char *mangled_name,
 return nullptr;
 }
 
-size_t len = std::strlen(mangled_name);
-if (len < 2 || strncmp(mangled_name, "_Z", 2))
-{
-if (len < 4 || strncmp(mangled_name, "___Z", 4))
-{
-if (status)
-*status = invalid_mangled_name;
-return nullptr;
-}
-}
-
 size_t internal_size = buf != nullptr ? *n : 0;
 arena a;
 Db db(a);
 db.template_param.emplace_back(a);
 int internal_status = success;
+size_t len = std::strlen(mangled_name);
 demangle(mangled_name, mangled_name + len, db,
  internal_status);
 if (internal_status == success && db.fix_forward_references &&

Modified: libcxxabi/trunk/test/test_demangle.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.pass.cpp?rev=292418=292417=292418=diff
==
--- libcxxabi/trunk/test/test_demangle.pass.cpp (original)
+++ libcxxabi/trunk/test/test_demangle.pass.cpp Wed Jan 18 12:12:39 2017
@@ -29594,6 +29594,9 @@ const char* cases[][2] =
 // NOTE: disable this test since it is a negative test case, you cannot 
demangle a non-mangled symbol
 // {"\x6D", nullptr},  // This use to crash with ASAN
 {"_ZTIU4_farrVKPi", "typeinfo for int* const volatile restrict _far"},
+
+// mangled names can include type manglings too, which don't start with _Z:
+{"i", "int"},
 };
 
 const unsigned N = sizeof(cases) / sizeof(cases[0]);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r292375 - Warn when calling a non interrupt function from an interrupt on ARM

2017-01-18 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Wed Jan 18 09:31:11 2017
New Revision: 292375

URL: http://llvm.org/viewvc/llvm-project?rev=292375=rev
Log:
Warn when calling a non interrupt function from an interrupt on ARM

The idea for this originated from a really tricky bug: ISRs on ARM don't
automatically save off the VFP regs, so if say, memcpy gets interrupted and the
ISR itself calls memcpy, the regs are left clobbered when the ISR is done.

https://reviews.llvm.org/D28820

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/arm-interrupt-attr.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=292375=292374=292375=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jan 18 09:31:11 
2017
@@ -259,6 +259,9 @@ def err_anyx86_interrupt_attribute : Err
   "a pointer as the first parameter|a %2 type as the second parameter}1">;
 def err_anyx86_interrupt_called : Error<
   "interrupt service routine cannot be called directly">;
+def warn_arm_interrupt_calling_convention : Warning<
+   "call to function without interrupt attribute could clobber interruptee's 
VFP registers">,
+   InGroup;
 def warn_mips_interrupt_attribute : Warning<
"MIPS 'interrupt' attribute only applies to functions that have "
"%select{no parameters|a 'void' return type}0">,

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=292375=292374=292375=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jan 18 09:31:11 2017
@@ -5395,6 +5395,15 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
 return ExprError();
   }
 
+  // Interrupt handlers don't save off the VFP regs automatically on ARM,
+  // so there's some risk when calling out to non-interrupt handler functions
+  // that the callee might not preserve them. This is easy to diagnose here,
+  // but can be very challenging to debug.
+  if (auto *Caller = getCurFunctionDecl())
+if (Caller->hasAttr())
+  if (!FDecl->hasAttr())
+Diag(Fn->getExprLoc(), diag::warn_arm_interrupt_calling_convention);
+
   // Promote the function operand.
   // We special-case function promotion here because we only allow promoting
   // builtin functions to function pointers in the callee of a call.

Modified: cfe/trunk/test/Sema/arm-interrupt-attr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm-interrupt-attr.c?rev=292375=292374=292375=diff
==
--- cfe/trunk/test/Sema/arm-interrupt-attr.c (original)
+++ cfe/trunk/test/Sema/arm-interrupt-attr.c Wed Jan 18 09:31:11 2017
@@ -17,3 +17,14 @@ __attribute__((interrupt("UNDEF"))) void
 __attribute__((interrupt)) void foo8() {}
 __attribute__((interrupt())) void foo9() {}
 __attribute__((interrupt(""))) void foo10() {}
+
+void callee1();
+__attribute__((interrupt("IRQ"))) void callee2();
+void caller1() {
+  callee1();
+  callee2();
+}
+__attribute__((interrupt("IRQ"))) void caller2() {
+  callee1(); // expected-warning {{call to function without interrupt 
attribute could clobber interruptee's VFP registers}}
+  callee2();
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D27123: Add AVR target and toolchain to Clang

2017-01-04 Thread Jonathan Roelofs via cfe-commits



On 1/4/17 2:52 AM, Dylan McKay wrote:

I've just raised a bug here

https://llvm.org/bugs/show_bug.cgi?id=31530

> What's necessary for sign-off? Should I ping the reviewer (Richard 
Smith) again?


I think so long as Richard or someone else who actively works on Clang 
signs off. Perhaps somebody else is keen to review?


On the other hand, I can review it and then ask if there aren't any 
objections to it being in-tree within a few days, I can commit it.


LGTM


Jon



On Wed, Jan 4, 2017 at 7:20 PM, Senthil Kumar Selvaraj 
> wrote:



Dylan McKay writes:

> Did you get the BugZilla account sorted Senthil?

Nope, direct email also didn't help. Can you please file a bug with

Title:

UINT16_TYPE and INT16_TYPE are defined as short instead of int for AVR

Description:

   UINT16_TYPE and INT16_TYPE are implicitly defined by the
preprocessor
   to the short type, rather than int. While shorts and ints are both
   16 bits wide on the avr, gcc picks ints to represent 16 bits
wherever
   possible, and picking short can cause issues with C++ name mangling
   (see https://reviews.llvm.org/D27123#615854
). Therefore, clang should
   define the two types to short.

   Clang's
lib/Frontend/InitPreprocessor.cpp::DefineExactWidthIntType does not
   use TargetInfo::getIntTypeByWidth. Instead,
   InitializePredefinedMacros calls
   the function with the specific type
(SignedShort/UnsignedShort), because
   getShortWidth() > getCharWidth(), but getIntWidth() ==
   getShortWidth().


What's necessary for sign-off? Should I ping the reviewer (Richard
Smith) again?

Regards
Senthil




--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r290390 - Fix example: byref struct's init was incorrect, and the block literal's holder should point to it.

2016-12-22 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu Dec 22 17:48:23 2016
New Revision: 290390

URL: http://llvm.org/viewvc/llvm-project?rev=290390=rev
Log:
Fix example: byref struct's init was incorrect, and the block literal's holder 
should point to it.

Modified:
cfe/trunk/docs/Block-ABI-Apple.rst

Modified: cfe/trunk/docs/Block-ABI-Apple.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Block-ABI-Apple.rst?rev=290390=290389=290390=diff
==
--- cfe/trunk/docs/Block-ABI-Apple.rst (original)
+++ cfe/trunk/docs/Block-ABI-Apple.rst Thu Dec 22 17:48:23 2016
@@ -530,13 +530,13 @@ and:
 
 .. code-block:: c
 
-struct _block_byref_i i = {( .forwarding=, .flags=0, .size=sizeof(struct 
_block_byref_i) )};
+struct _block_byref_i i = {( .isa=NULL, .forwarding=, .flags=0, 
.size=sizeof(struct _block_byref_i), .captured_i=2 )};
 struct __block_literal_5 _block_literal = {
   &_NSConcreteStackBlock,
   (1<<25)|(1<<29), ,
   __block_invoke_5,
   &__block_descriptor_5,
-  2,
+  ,
 };
 
 Importing ``__attribute__((NSObject))`` ``__block`` variables


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r288818 - Fix doc string typo: s/@__yes/@__objc_yes/

2016-12-06 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Tue Dec  6 09:45:41 2016
New Revision: 288818

URL: http://llvm.org/viewvc/llvm-project?rev=288818=rev
Log:
Fix doc string typo: s/@__yes/@__objc_yes/

Modified:
cfe/trunk/include/clang/AST/ExprObjC.h

Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=288818=288817=288818=diff
==
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Tue Dec  6 09:45:41 2016
@@ -90,7 +90,7 @@ public:
 /// ObjCBoxedExpr - used for generalized expression boxing.
 /// as in: @(strdup("hello world")), @(random()) or @(view.frame)
 /// Also used for boxing non-parenthesized numeric literals;
-/// as in: @42 or \@true (c++/objc++) or \@__yes (c/objc).
+/// as in: @42 or \@true (c++/objc++) or \@__objc_yes (c/objc).
 class ObjCBoxedExpr : public Expr {
   Stmt *SubExpr;
   ObjCMethodDecl *BoxingMethod;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r288444 - Delete tautological assertion.

2016-12-01 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Thu Dec  1 18:51:58 2016
New Revision: 288444

URL: http://llvm.org/viewvc/llvm-project?rev=288444=rev
Log:
Delete tautological assertion.

After r256463, both the LHS and RHS now refer to the same variable. Before,
they referred to the member, the parameter respectively. Now GCC6's
-Wtautological-compare complains.

Modified:
cfe/trunk/lib/AST/DeclTemplate.cpp

Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=288444=288443=288444=diff
==
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Thu Dec  1 18:51:58 2016
@@ -36,7 +36,6 @@ TemplateParameterList::TemplateParameter
   : TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
 NumParams(Params.size()), ContainsUnexpandedParameterPack(false),
 HasRequiresClause(static_cast(RequiresClause)) {
-  assert(this->NumParams == NumParams && "Too many template parameters");
   for (unsigned Idx = 0; Idx < NumParams; ++Idx) {
 NamedDecl *P = Params[Idx];
 begin()[Idx] = P;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27005: [lit] Support custom parsers in parseIntegratedTestScript

2016-11-23 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In https://reviews.llvm.org/D27005#603979, @EricWF wrote:

> In https://reviews.llvm.org/D27005#603692, @jroelofs wrote:
>
> > Should probably add a testcase in lit/tests that exercises the new CUSTOM 
> > parser stuff, so people working on LIT don't have to build/test libc++ in 
> > order to know whether they've broken its testsuite.
>
>
> I plan to implement tests. I just wanted to ensure the approach was agreeable 
> first.


Looks like a good approach to me.


https://reviews.llvm.org/D27005



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27005: [lit] Support custom parsers in parseIntegratedTestScript

2016-11-22 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Should probably add a testcase in lit/tests that exercises the new CUSTOM 
parser stuff, so people working on LIT don't have to build/test libc++ in order 
to know whether they've broken its testsuite.


https://reviews.llvm.org/D27005



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26796: [Driver] Use arch type to find compiler-rt libraries (on Linux)

2016-11-17 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Testcase?


https://reviews.llvm.org/D26796



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24770: [libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)

2016-09-20 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs accepted this revision.
jroelofs added a reviewer: jroelofs.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D24770



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r281227 - Trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable

2016-09-12 Thread Jonathan Roelofs via cfe-commits
Author: jroelofs
Date: Mon Sep 12 11:14:52 2016
New Revision: 281227

URL: http://llvm.org/viewvc/llvm-project?rev=281227=rev
Log:
Trivial documentation fix regarding Obj-C ARC 
objc_arc_weak_reference_unavailable

Fixed incorrect docs that referred to:
  objc_arc_weak_unavailable
when it should be:
  objc_arc_weak_reference_unavailable

Patch by: Sean McBride!

Modified:
cfe/trunk/docs/AutomaticReferenceCounting.rst

Modified: cfe/trunk/docs/AutomaticReferenceCounting.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/AutomaticReferenceCounting.rst?rev=281227=281226=281227=diff
==
--- cfe/trunk/docs/AutomaticReferenceCounting.rst (original)
+++ cfe/trunk/docs/AutomaticReferenceCounting.rst Mon Sep 12 11:14:52 2016
@@ -910,10 +910,10 @@ not support ``__weak`` references.
   binary compatibility.
 
 A class may indicate that it does not support weak references by providing the
-``objc_arc_weak_unavailable`` attribute on the class's interface declaration.  
A
+``objc_arc_weak_reference_unavailable`` attribute on the class's interface 
declaration.  A
 retainable object pointer type is **weak-unavailable** if
 is a pointer to an (optionally protocol-qualified) Objective-C class ``T`` 
where
-``T`` or one of its superclasses has the ``objc_arc_weak_unavailable``
+``T`` or one of its superclasses has the 
``objc_arc_weak_reference_unavailable``
 attribute.  A program is ill-formed if it applies the ``__weak`` ownership
 qualifier to a weak-unavailable type or if the value operand of a weak
 assignment operation has a weak-unavailable type.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable

2016-09-02 Thread Jonathan Roelofs via cfe-commits



On 9/2/16 9:26 AM, Sean McBride via cfe-commits wrote:

Friendly ping... this is a very trivial documentation patch...


LGTM




On Wed, 10 Aug 2016 13:57:07 -0400, Sean McBride via cfe-commits said:


Fixed incorrect docs that referred to:
objc_arc_weak_unavailable
when it should be:
objc_arc_weak_reference_unavailable

Cheers,

Sean
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-09-01 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In https://reviews.llvm.org/D21803#532382, @EricWF wrote:

> In https://reviews.llvm.org/D21803#532347, @jroelofs wrote:
>
> > In https://reviews.llvm.org/D21803#532309, @EricWF wrote:
> >
> > > `__thread`
> > >
> > > What do you think of this idea?
> >
> >
> > You'll have to guard it against all the platforms that don't support TLS. 
> > Darwin 10.6 is one of them.
>
>
> Which is fine because we shouldn't supply a definition of 
> `__cxa_thread_atexit` on those platforms.


Ah, ok. Sounds good.


https://reviews.llvm.org/D21803



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

2016-09-01 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In https://reviews.llvm.org/D21803#532309, @EricWF wrote:

> `__thread`
>
> What do you think of this idea?


You'll have to guard it against all the platforms that don't support TLS. 
Darwin 10.6 is one of them.


https://reviews.llvm.org/D21803



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-22 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D23420



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23524: [libc++abi] Fix backtrace_test.pass.cpp failure seemingly caused by inlining differences.

2016-08-15 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

I'm not sure that's guaranteed behavior either. That being said, I don't see a 
more robust way to write this test.


https://reviews.llvm.org/D23524



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In https://reviews.llvm.org/D23420#513820, @zatrazz wrote:

> Yes, although in pratice for shared libraries this is not an issue (at least 
> on Linux with current linker strategies). And I open for suggestion on how to 
> proceed in this case since we have some other options:
>
> 1. Add the required soft-sp implementations when building for Linux (this 
> might happen not only on aarch64, but any other ABI that defines long double 
> using fallback soft-fp)


Are the softfp symbols you need not contained in libgcc.a?

> 2. Remove the possible soft-fp usages on all the tests. However this will 
> lead to possible remove *all* the FP cases if libcxx should be used in a pure 
> soft-fp platform

> 3. Only allows the libcxx + linunwind to be built against compiler-rt





https://reviews.llvm.org/D23420



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

This breaks the ODR... the behavior under those circumstances is undefined.


https://reviews.llvm.org/D23420



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Doesn't libgcc_s contain bits of gcc's unwinder?


https://reviews.llvm.org/D23420



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23385: Implement __has_constant_initializer(obj) expression traits.

2016-08-11 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

I don't think I have any more comments, but I'll let one of the other reviewers 
give the final go/no-go.



Comment at: docs/LanguageExtensions.rst:1047
@@ +1046,3 @@
+  Determines whether `expr` names
+  a object that will be initialized during
+  `constant initialization 
`_

s/a object/an object/

(english sucks)


https://reviews.llvm.org/D23385



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23385: Implement __has_constant_initializer(obj) expression traits.

2016-08-11 Thread Jonathan Roelofs via cfe-commits
jroelofs added inline comments.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6807
@@ +6806,3 @@
+
+def err_has_constant_init_expression_trait_invalid_arg : Error<
+  "expression does not reference a named variable">;

EricWF wrote:
> Help improving this wording would be appreciated.
`"expression must be a named variable"`, maybe?

A "counterexample" to the original wording is `__has_constant_initializer(x+1)`.


Comment at: lib/Sema/SemaExprCXX.cpp:4775
@@ +4774,3 @@
+  // a 'constant initializer'.
+  else if ((VD->hasGlobalStorage() ||
+  VD->getTLSKind() != VarDecl::TLS_None) && VD->hasInit()) {

EricWF wrote:
> EricWF wrote:
> > jroelofs wrote:
> > > no else after return.
> > > 
> > > Also, what do you want this to do for `ParmVarDecl`s that happen to have 
> > > an initializer? i.e:
> > > 
> > > ```
> > > void foo(int i = 45) {}
> > > ```
> > I believe that case should return false. `i` isn't static or thread local 
> > so it doesn't have a "constant initializer" according to 
> > [basic.start.static].
> > 
> Perhaps using `__has_constant_initializer` should emit a diagnostic when used 
> on non-static, non-thread-local objects?
//Maybe// a warning... And you might want it to behave differently when it 
comes from a macro expansion. I'm not sure what the norm is for that sort of 
thing though.

I think the more important thing at this point is to precisely document what 
you want the behavior to be in the docs. Then any difference from that spec is 
"just a compiler bug", rather than potentially being a breaking change in 
behavior for someone who used your API in a way that you didn't expect.


https://reviews.llvm.org/D23385



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23385: Implement __has_constant_initializer(obj) expression traits.

2016-08-11 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

One more thing: need to add docs to `clang/docs/LanguageExtensions.rst`.


https://reviews.llvm.org/D23385



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23385: Implement __has_constant_initializer(obj) expression traits.

2016-08-11 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.


Comment at: lib/AST/Expr.cpp:2656
@@ +2655,3 @@
+AllowNonLiteral)) {
+if (!CE->getNumArgs()) return true;
+unsigned numArgs = CE->getNumArgs();

no need for this `if`.

Also, I think the `for` should be written:

```
for (auto *Arg : CE->arguments())
  if (Arg->isConstantInitializer(Ctx, false, Culprit))
return false;
```


Comment at: lib/Sema/SemaExprCXX.cpp:4775
@@ +4774,3 @@
+  // a 'constant initializer'.
+  else if ((VD->hasGlobalStorage() ||
+  VD->getTLSKind() != VarDecl::TLS_None) && VD->hasInit()) {

no else after return.

Also, what do you want this to do for `ParmVarDecl`s that happen to have an 
initializer? i.e:

```
void foo(int i = 45) {}
```


https://reviews.llvm.org/D23385



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-08-09 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In https://reviews.llvm.org/D21134#509522, @danielmarjamaki wrote:

> In https://reviews.llvm.org/D21134#508524, @jroelofs wrote:
>
> > I think the replacement is wrong for something like:
> >
> >   int *arr; int offs1, offs2;
> >   offs1[arr + offs2] = 42;
> >
> >
> > which I think would give:
> >
> >   int *arr; int offs1, offs2;
> >   arr + offs2[offs1] = 42;
> >
> >
> > If the precedence of the "indexing" argument is less than that of the 
> > subscript operator, then you need to insert parens:
> >
> >   int *arr; int offs1, offs2;
> >   (arr + offs2)[offs1] = 42;
> >
>
>
> I don't think so. The matcher says:
>
>   hasRHS(ignoringParenImpCasts(
> anyOf(stringLiteral(), declRefExpr(hasType(pointsTo(qualType(,
>   memberExpr(hasType(pointsTo(qualType()))
>   
>
> I think it's hard to know what the replaced code should be. In some cases it 
> might be better with:
>
>   arr[offs1 + offs2] = 42;
>


Oh, yeah, you're right.


https://reviews.llvm.org/D21134



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22463: [RFC] Moving to GitHub Proposal: NOT DECISION!

2016-07-19 Thread Jonathan Roelofs via cfe-commits



On 7/19/16 8:55 AM, Robinson, Paul wrote:

I think we could emulate any pre-commit hook we like via GitHub
WebHooks by having two repositories: llvm and llvm-staging (say).

People push to llvm-staging, which notifies some LLVM server we own.
That does basic sanity checks and pushes to llvm proper if passed.


I think that would be terrible in practice, for instance how do you handle
situations like:

1) Dev A push commit A
2) Dev B push commit B that changes some lines close to the one changed by
commit A
3) sanity check fails on commit A, but llvm-staging contains A and B and
can’t get rid of A easily because B would not apply without A.

At this point Dev B gets an email (or other mechanism, I don’t know what
you imagined) telling that his changed are rejected for no good reason.

Also reverting to a state "before A” on llvm-staging would mean that that
the history would be rewritten and everyone that pulled/fetched in the
meantime would suffer .

If we want to go towards pre-check using staging, I believe we should work
with pull-request (we’d still have the issue of conflicting PR, but I
don’t believe it’d be that bad in practice).
That’d be welcome, but that’d also be a whole other story to setup and
maintain!

—
Mehdi


Hear hear.  The schemes to handle this that I'm aware of do look more like
pull requests.  You submit your change to the pre-qualification queue.
If it rebases cleanly and passes pre-qual, your change becomes the new HEAD.
If it doesn't rebase cleanly or fails pre-qual, your change gets bounced.


Reminds me a bit of a blockchain: longest validated chain of commits wins.


Jon



A pull-request-like model also helps avoid the rebase-build-test-push(fail)
loop that you can get into with a very active git-based project.  This is
a mechanical task best suited to automation rather than wasting valuable
developer time on it.  But I suspect GitHub does not have anything like
this OOB so it would be an enhancement for a later time.
--paulr

P.S. At Sony we are building a system with a "staging" step but it's not
for our own work... more of a "flood control" dam.  :-)



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22463: [RFC] Moving to GitHub Proposal: NOT DECISION!

2016-07-18 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.


Comment at: docs/Proposals/GitHub.rst:127
@@ +126,3 @@
+* The projects' repositories will remain identical, with a new address 
(GitHub).
+* They'll continue to have SVN RW access, but will also gain Git RW access.
+* The linear history can still be accessed in the (RO) submodule meta project,

rengolin wrote:
> compnerd wrote:
> > jroelofs wrote:
> > > Do you mean `s/SVN RW access/SVN RO access/` here?
> > I believe @rengolin is referring to the final state here.  I agree that the 
> > current phrasing makes it hard to follow.
> No, I actually mean SVN RW access. GitHub's SVN view does allow write access 
> to the Git repos via "svn commit".
Ah, I didn't catch that part. Cool.


Comment at: docs/Proposals/GitHub.rst:136
@@ +135,3 @@
+Essentially, we're adding Git RW access in addition to the already existing
+structure, with all the additional benefits of it being in GitHub.
+

rengolin wrote:
> compnerd wrote:
> > jroelofs wrote:
> > > Need to clarify here whether *write* access through SVN will be going 
> > > away. If I understand the proposal correctly, it will go away, but this 
> > > section makes it sound like it's staying.
> > The way that I read the nutshell is that it would potentially continue to 
> > exist, just at a different address.
> Our SVN server will die, SVN access will continue via GitHub.
Ah, ok.


Repository:
  rL LLVM

https://reviews.llvm.org/D22463



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22463: [RFC] Moving to GitHub Proposal: NOT DECISION!

2016-07-18 Thread Jonathan Roelofs via cfe-commits
jroelofs added inline comments.


Comment at: docs/Proposals/GitHub.rst:127
@@ +126,3 @@
+* The projects' repositories will remain identical, with a new address 
(GitHub).
+* They'll continue to have SVN RW access, but will also gain Git RW access.
+* The linear history can still be accessed in the (RO) submodule meta project,

Do you mean `s/SVN RW access/SVN RO access/` here?


Comment at: docs/Proposals/GitHub.rst:136
@@ +135,3 @@
+Essentially, we're adding Git RW access in addition to the already existing
+structure, with all the additional benefits of it being in GitHub.
+

Need to clarify here whether *write* access through SVN will be going away. If 
I understand the proposal correctly, it will go away, but this section makes it 
sound like it's staying.


Repository:
  rL LLVM

https://reviews.llvm.org/D22463



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2016-06-17 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM. Do you want me to commit it for you?


http://reviews.llvm.org/D14727



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libunwind] r272680 - [libunwind] Improve unwinder stack usage - III

2016-06-14 Thread Jonathan Roelofs via cfe-commits



On 6/14/16 9:51 AM, Asiri Rathnayake via cfe-commits wrote:

Author: asiri
Date: Tue Jun 14 10:51:01 2016
New Revision: 272680

URL: http://llvm.org/viewvc/llvm-project?rev=272680=rev
Log:
[libunwind] Improve unwinder stack usage - III

Implement the same optimization committed under r271004 on non-EHABI,
non-SJLJ unwinder as well.


Thanks!


Jon



Change-Id: I7f80ed91a75d1e778b50ba87cf8fb68658a083c7

Modified:
 libunwind/trunk/src/UnwindLevel1.c

Modified: libunwind/trunk/src/UnwindLevel1.c
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindLevel1.c?rev=272680=272679=272680=diff
==
--- libunwind/trunk/src/UnwindLevel1.c (original)
+++ libunwind/trunk/src/UnwindLevel1.c Tue Jun 14 10:51:01 2016
@@ -33,16 +33,15 @@
  #if !_LIBUNWIND_ARM_EHABI

  static _Unwind_Reason_Code
-unwind_phase1(unw_context_t *uc, _Unwind_Exception *exception_object) {
-  unw_cursor_t cursor1;
-  unw_init_local(, uc);
+unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception 
*exception_object) {
+  unw_init_local(cursor, uc);

// Walk each frame looking for a place to stop.
bool handlerNotFound = true;
while (handlerNotFound) {
  // Ask libuwind to get next frame (skip over first which is
  // _Unwind_RaiseException).
-int stepResult = unw_step();
+int stepResult = unw_step(cursor);
  if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_step() reached 
"
   "bottom => _URC_END_OF_STACK\n",
@@ -58,7 +57,7 @@ unwind_phase1(unw_context_t *uc, _Unwind
  // See if frame has code to run (has personality routine).
  unw_proc_info_t frameInfo;
  unw_word_t sp;
-if (unw_get_proc_info(, ) != UNW_ESUCCESS) {
+if (unw_get_proc_info(cursor, ) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info 
"
   "failed => _URC_FATAL_PHASE1_ERROR\n",
   (void *)exception_object);
@@ -70,12 +69,12 @@ unwind_phase1(unw_context_t *uc, _Unwind
char functionBuf[512];
const char *functionName = functionBuf;
unw_word_t offset;
-  if ((unw_get_proc_name(, functionBuf, sizeof(functionBuf),
+  if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
   ) != UNW_ESUCCESS) ||
(frameInfo.start_ip + offset > frameInfo.end_ip))
  functionName = ".anonymous.";
unw_word_t pc;
-  unw_get_reg(, UNW_REG_IP, );
+  unw_get_reg(cursor, UNW_REG_IP, );
_LIBUNWIND_TRACE_UNWINDING(
"unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64
", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "\n",
@@ -93,13 +92,13 @@ unwind_phase1(unw_context_t *uc, _Unwind
(void *)exception_object, (void *)(uintptr_t)p);
_Unwind_Reason_Code personalityResult =
(*p)(1, _UA_SEARCH_PHASE, exception_object->exception_class,
-   exception_object, (struct _Unwind_Context *)());
+   exception_object, (struct _Unwind_Context *)(cursor));
switch (personalityResult) {
case _URC_HANDLER_FOUND:
  // found a catch clause or locals that need destructing in this frame
  // stop search and remember stack pointer at the frame
  handlerNotFound = false;
-unw_get_reg(, UNW_REG_SP, );
+unw_get_reg(cursor, UNW_REG_SP, );
  exception_object->private_2 = (uintptr_t)sp;
  _LIBUNWIND_TRACE_UNWINDING(
  "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n",
@@ -127,9 +126,8 @@ unwind_phase1(unw_context_t *uc, _Unwind


  static _Unwind_Reason_Code
-unwind_phase2(unw_context_t *uc, _Unwind_Exception *exception_object) {
-  unw_cursor_t cursor2;
-  unw_init_local(, uc);
+unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception 
*exception_object) {
+  unw_init_local(cursor, uc);

_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
   (void *)exception_object);
@@ -139,7 +137,7 @@ unwind_phase2(unw_context_t *uc, _Unwind

  // Ask libuwind to get next frame (skip over first which is
  // _Unwind_RaiseException).
-int stepResult = unw_step();
+int stepResult = unw_step(cursor);
  if (stepResult == 0) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_step() reached 
"
   "bottom => _URC_END_OF_STACK\n",
@@ -155,8 +153,8 @@ unwind_phase2(unw_context_t *uc, _Unwind
  // Get info about this frame.
  unw_word_t sp;
  unw_proc_info_t frameInfo;
-unw_get_reg(, UNW_REG_SP, );
-if (unw_get_proc_info(, ) != UNW_ESUCCESS) {
+unw_get_reg(cursor, UNW_REG_SP, );
+if (unw_get_proc_info(cursor, ) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): 

Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II

2016-05-27 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

Probably worth doing the same thing for the non-EHABI non-SJLJ implementation, 
too (that can of course go in a separate commit).

LGTM


http://reviews.llvm.org/D20320



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations

2016-05-26 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D14727#441758, @bryanpkc wrote:

> Fixed the code to set GoodVersion.MajorStr before returning, and removed an 
> unnecessary file 
> (test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o).


That file is not unnecessary... The test is to make sure that if there are 
multiple versions installed in the same spot, that the latest one is picked up.


http://reviews.llvm.org/D14727



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libunwind] r270925 - Fix gcc libunwind build.

2016-05-26 Thread Jonathan Roelofs via cfe-commits



On 5/26/16 3:45 PM, Asiri Rathnayake via cfe-commits wrote:

struct blk_count {
-static const uint32_t count =
+static const uint64_t count =
(sizeof(T) + sizeof(uint64_t) -


Should that be 'size_t' instead?


Jon

--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage

2016-05-26 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D20119#441516, @rmaprath wrote:

> Please shout!


Just add some parens:

  static_assert((check_fit::does_fit),
"or1k registers do not fit into unw_context_t");


http://reviews.llvm.org/D20119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

This is the canonical reference for the Itanium ABI: 
https://mentorembedded.github.io/cxx-abi/abi.html


http://reviews.llvm.org/D20677



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage

2016-05-24 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D20119#437191, @rmaprath wrote:

> In http://reviews.llvm.org/D20119#436849, @jroelofs wrote:
>
> > In http://reviews.llvm.org/D20119#431997, @rmaprath wrote:
> >
> > > Addressing review comments from @jroelofs:
> > >
> > > - Moved the assertion in `libunwind.cpp` back to `UnwindCursor.cpp` where 
> > > it really belogs.
> > >
> > >   @jroelofs: I just realized that, with this new native-only build of 
> > > `libunwind`, users of `libunwind.h` would have to explicitly `#define` 
> > > the flag `_LIBUNWIND_IS_NATIVE_ONLY` in order to get the header in-sync 
> > > with the library. I can't see an immediate problem if they don't define 
> > > that flag though, it's just that they'll end up passing larger buffers 
> > > than the library needs. Do you see a problem here?
> >
> >
> > I'm not convinced it's a problem, (though possibly performance left on the 
> > table)...
> >
> > > 'libc++' uses a `__config_site` mechanism to wire the cmake build options 
> > > into the `__config` header. We can implement a similar mechanism in 
> > > `libunwind`, not sure if that's necessary here.
> >
> >
> > I think that's the right way to go.
> >
> > Jon
> >
> > > WDYT?
> >
> > > 
> >
> > > Thanks.
> >
> > > 
> >
> > > / Asiri
> >
>
>
> Apologies, it looks like we don't have any targets for installing 
> `libunwind.h` header (or any other headers from `libunwind` project for that 
> matter). I think this means we use `libunwind.h` only for building 
> libunwind+libcxxabi libraries, and there's no need to explicitly adjust 
> `libunwind.h` header as it is not used from outside as-is. Hope this makes 
> sense.
>
> OK to commit? Sorry for the diversion.


Ah, ok. LGTM then!

Jon

> / Asiri





http://reviews.llvm.org/D20119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage

2016-05-23 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D20119#431997, @rmaprath wrote:

> Addressing review comments from @jroelofs:
>
> - Moved the assertion in `libunwind.cpp` back to `UnwindCursor.cpp` where it 
> really belogs.
>
>   @jroelofs: I just realized that, with this new native-only build of 
> `libunwind`, users of `libunwind.h` would have to explicitly `#define` the 
> flag `_LIBUNWIND_IS_NATIVE_ONLY` in order to get the header in-sync with the 
> library. I can't see an immediate problem if they don't define that flag 
> though, it's just that they'll end up passing larger buffers than the library 
> needs. Do you see a problem here?


I'm not convinced it's a problem, (though possibly performance left on the 
table)...

> 'libc++' uses a `__config_site` mechanism to wire the cmake build options 
> into the `__config` header. We can implement a similar mechanism in 
> `libunwind`, not sure if that's necessary here.


I think that's the right way to go.

Jon

> WDYT?

> 

> Thanks.

> 

> / Asiri



http://reviews.llvm.org/D20119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage

2016-05-17 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Just one question, otherwise LGTM:



Comment at: src/UnwindCursor.hpp:580
@@ -579,3 +605,1 @@
   _isSignalFrame(false) {
-  static_assert(sizeof(UnwindCursor) < sizeof(unw_cursor_t),
-"UnwindCursor<> does not fit in unw_cursor_t");

Is there a good reason to move this static assert out to libunwind.cpp? ISTM it 
serves its purpose better here.


http://reviews.llvm.org/D20119



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19871: Add an AST matcher for CastExpr kind

2016-05-13 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D19871#429153, @etienneb wrote:

> In http://reviews.llvm.org/D19871#428997, @jroelofs wrote:
>
> > Drive-by thought: I think it would be useful to be able to match implicit 
> > casts separately from explicit casts when using this new matcher.
>
>
> Jonathan, I think what you are asking for is already supported.
>  I added an unittest to confirm it.
>
>   EXPECT_TRUE(matches("char *p = 0;",
>   implicitCastExpr(hasCastKind(CK_NullToPointer;
>   
>
> If I misunderstood your comment, could you provide an example.


Oh, right. That /is/ exactly what I meant. Excellent.


http://reviews.llvm.org/D19871



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19871: Add an AST matcher for CastExpr kind

2016-05-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

Drive-by thought: I think it would be useful to be able to match implicit casts 
separately from explicit casts when using this new matcher.


http://reviews.llvm.org/D19871



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19920: [libunwind][ARM] Improve unwinder stack usage on baremetal targets - part 1

2016-05-04 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D19920#421173, @rmaprath wrote:

> In http://reviews.llvm.org/D19920#421145, @jroelofs wrote:
>
> > Wouldn't this break cross unwinding?
>
>
> I wasn't aware of cross unwinding, I think you are referring to [1]. Thanks 
> for the pointer.
>
> Would it make sense to support a libunwind build that only supports native 
> unwinding? For baremetal (embedded) applications, I don't think cross 
> unwinding (if I understand it correctly) makes a lot of sense.
>
> Thanks!
>
> / Asiri
>
> [1] http://www.nongnu.org/libunwind/man/libunwind(3).html#section_4


Yeah, that's what I'm referring to. I have no idea if it's currently working or 
not, but *adding* a build mode that only supports native unwinding sounds like 
a good idea.


http://reviews.llvm.org/D19920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19920: [libunwind][ARM] Improve unwinder stack usage on baremetal targets - part 1

2016-05-04 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Wouldn't this break cross unwinding?


http://reviews.llvm.org/D19920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19835: Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

2016-05-02 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.



> Alternatively `static_assert(std::is_same bool>::value);` :-P

> 

> Testing the return type isn't the problem. The problem is telling LIT *when* 
> we expect the test to fail using the `XFAIL` directive.


O. I see.


http://reviews.llvm.org/D19835



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19835: Tolerate incorrect return type for 'isinf' and 'isnan' in tests.

2016-05-02 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

I think you could lean on the linker to cause the test to fail when the type is 
wrong:

  bool isinf(double);
  
  typedef int (*expected_signature)(double);
  
  void assert_via_linker(decltype(isinf) blah);
  void assert_via_linker(expected_signature blah) {}
  
  void foo() {
assert_via_linker(isinf);
  }


http://reviews.llvm.org/D19835



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Change Request

2016-03-10 Thread Jonathan Roelofs via cfe-commits



On 3/10/16 9:38 AM, Wes Witt via cfe-commits wrote:

I would like to submit the attached changes for your approval.


Gentle etiquette suggestion: please title your emails with something 
more descriptive. In this case, something like: "[PATCH] Windows support 
for ObjC codegen". And then in the body of the email, write a little 
blurb saying how the changes achieve that goal, and why they're necessary.




My name is Wes Witt and I’m a software engineer at Microsoft. The diff
represent some small changes that we’ve made in order to use Clang to
compile Objective C on Windows.

The compiler is used for the open source WinObjC project
(https://github.com/Microsoft/WinObjC).


While you're here changing the signature anyway, please change Name to 
be a `StringRef` instead of a `const std::string&`:


   virtual llvm::Value *GetClassNamed(CodeGenFunction ,
-  const std::string , bool isWeak);
+  const std::string , bool isWeak, bool isDLLImport);


This:

+bool isDLLImport = false;
+if (OID->hasAttr()) {
+isDLLImport = true;
+}
+return GetClassNamed(CGF, OID->getNameAsString(), 
OID->isWeakImported(), isDLLImport);


should be written as:

return GetClassNamed(CGF, OID->getNameAsString(), OID->isWeakImported(), 
OID->hasAttr());



This:

+  if (isDLLImport) 
ClassSymbol->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);


should be broken into two lines.

-  return GetClassNamed(CGF, "NSAutoreleasePool", false);
+  return GetClassNamed(CGF, "NSAutoreleasePool", false, true);

I think the last parameter there should be an "is this a windows target" 
check, rather than an unconditional 'true'.



You'll also need to write testcases to verify the changed behavior. Have 
a look in clang/test/CodeGenObjC for examples of how to do it.




Thank you for your consideration.


Welcome to the community, and happy hacking!


Jon



-Wes Witt

w...@microsoft.com 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17419: [libcxx] Split locale management out of locale_win32. NFCI

2016-03-09 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

LGTM


http://reviews.llvm.org/D17419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17456: [libcxx] Reorganize _LIBCPP_LOCALE__L_EXTENSIONS

2016-03-09 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

LGTM


http://reviews.llvm.org/D17456



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17952: [Clang] Accept absolute paths in the -fuse-ld option

2016-03-08 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs added a comment.

Testcases?


Repository:
  rL LLVM

http://reviews.llvm.org/D17952



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17456: [libcxx] Reorganize _LIBCPP_LOCALE__L_EXTENSIONS

2016-02-19 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D17456#357245, @bcraig wrote:

> In http://reviews.llvm.org/D17456#357232, @jroelofs wrote:
>
> > > The private redirector symbol names are all prefixed with _CXX_* so that 
> > > they won't conflict with user symbols,
> >
> >
> > This is more @mclow.lists/@ericwf's domain, but I think __libcxx_ prefixes 
> > would be safer (so that there's no chance of clashing with libstdc++, if 
> > they decide to do something similar, or already have).
>
>
> Do we need our headers to coexist with the headers from other C++ 
> implementations?  That seems fraught with peril.  I've tried to do something 
> like that in the past with STLPort in combination with various compilers' 
> STLs, and ADL basically made the results unusable.


I think the headers are a lost cause. It's the symbols I'm actually worried 
about. There are people who link against both standard libraries (and that's a 
valid, supported use case).


http://reviews.llvm.org/D17456



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17456: [libcxx] Reorganize _LIBCPP_LOCALE__L_EXTENSIONS

2016-02-19 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: EricWF.
jroelofs added a comment.

> The private redirector symbol names are all prefixed with _CXX_* so that they 
> won't conflict with user symbols,


This is more @mclow.lists/@ericwf's domain, but I think __libcxx_ prefixes 
would be safer (so that there's no chance of clashing with libstdc++, if they 
decide to do something similar, or already have).


http://reviews.llvm.org/D17456



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17380: [libcxx] Split locale management out of ibm/xlocale.h. NFCI

2016-02-18 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.
jroelofs accepted this revision.
jroelofs added a reviewer: jroelofs.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D17380



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17382: [libcxx] Split locale management out of newlib/xlocale.h. NFCI

2016-02-18 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D17382



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17051: Get rid of CHECK-SAME-NOT in tests.

2016-02-09 Thread Jonathan Roelofs via cfe-commits
jroelofs added a subscriber: jroelofs.


Comment at: test/Modules/ModuleDebugInfo.cpp:10
@@ -9,3 +9,3 @@
 // RUN: cat %t-mod.ll | FileCheck %s
 // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s
 

While you're here, may as well shorten these three lines to:


```
// RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 
-debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps 
-DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll 
-mllvm -debug-only=pchcontainer | FileCheck %s --check-prefix=CHECK 
--check-prefix=CHECK-NEG
```

(as long as you also move the one CHECK-NEG-NOT line up before all of the other 
`CHECK` lines)


Comment at: test/Modules/ModuleDebugInfo.cpp:25
@@ -25,1 +24,3 @@
+// CHECK-SAME:dwoId:
+// CHECK-SAME:)
 

This `CHECK-SAME` line and all the others are still dead. There's no 
`--check-prefix=CHECK-SAME`. This is really fishy.


http://reviews.llvm.org/D17051



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17051: Get rid of CHECK-SAME-NOT in tests.

2016-02-09 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a reviewer: jroelofs.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM.



Comment at: test/Modules/ModuleDebugInfo.cpp:10
@@ -9,3 +9,3 @@
 // RUN: cat %t-mod.ll | FileCheck %s
 // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s
 

jlebar wrote:
> jlebar wrote:
> > jlebar wrote:
> > > jroelofs wrote:
> > > > While you're here, may as well shorten these three lines to:
> > > > 
> > > > 
> > > > ```
> > > > // RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ 
> > > > -std=c++11 -debug-info-kind=limited -fmodules -fmodule-format=obj 
> > > > -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I 
> > > > %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer | 
> > > > FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NEG
> > > > ```
> > > > 
> > > > (as long as you also move the one CHECK-NEG-NOT line up before all of 
> > > > the other `CHECK` lines)
> > > I don't think that means the same thing?  CHECK-NOT: foo checks that 
> > > "foo" does not appear between the last match (or the beginning of the 
> > > file, if there was no last match) *and the next match*.
> > Oh, I see, it's CHECK-NEG-NOT, so there are no other instances of 
> > CHECK-NEG, it's fine how you say.  I'll change it, sure.
> Actually, if you don't mind, I'd rather do that in a separate patch, in case 
> it breaks something.  I'll send you a patch in a sec.
I don't mind.


http://reviews.llvm.org/D17051



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15450: Avoid double deletion in Clang driver.

2016-01-29 Thread Jonathan Roelofs via cfe-commits



On 1/29/16 11:51 AM, Serge Pavlov via cfe-commits wrote:

Can somebody have a look at this fix?
Thank you!


Testcase?



--Serge

2016-01-11 23:50 GMT+06:00 Serge Pavlov >:

Any feedback?

Thanks,
--Serge

2015-12-11 20:24 GMT+06:00 Serge Pavlov >:

sepavloff created this revision.
sepavloff added a subscriber: cfe-commits.

Llvm module object is shared between CodeGenerator and
BackendConsumer,
in both classes it is stored as std::unique_ptr, which is not a good
design solution and can cause double deletion error. Usually it does
not occur because in BackendConsumer::HandleTranslationUnit the
ownership of CodeGenerator over the module is taken away. If however
this method is not called, the module is deleted twice and
compiler crashes.

As the module owned by BackendConsumer is always the same as
CodeGenerator
has, local copy of llvm module can be removed from BackendGenerator.

http://reviews.llvm.org/D15450

Files:
   lib/CodeGen/CodeGenAction.cpp

Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -73,7 +73,6 @@

  std::unique_ptr Gen;

-std::unique_ptr TheModule;
  SmallVector, 4>
  LinkModules;

@@ -97,7 +96,10 @@
  this->LinkModules.push_back(
  std::make_pair(I.first,
std::unique_ptr(I.second)));
  }
-std::unique_ptr takeModule() { return
std::move(TheModule); }
+llvm::Module *getModule() const { return Gen->GetModule(); }
+std::unique_ptr takeModule() {
+  return std::unique_ptr(Gen->ReleaseModule());
+}
  void releaseLinkModules() {
for (auto  : LinkModules)
  I.second.release();
@@ -117,8 +119,6 @@

Gen->Initialize(Ctx);

-  TheModule.reset(Gen->GetModule());
-
if (llvm::TimePassesIsEnabled)
  LLVMIRGeneration.stopTimer();
  }
@@ -165,27 +165,14 @@
}

// Silently ignore if we weren't initialized for some
reason.
-  if (!TheModule)
-return;
-
-  // Make sure IR generation is happy with the module. This
is released by
-  // the module provider.
-  llvm::Module *M = Gen->ReleaseModule();
-  if (!M) {
-// The module has been released by IR gen on failures,
do not double
-// free.
-TheModule.release();
+  if (!getModule())
  return;
-  }
-
-  assert(TheModule.get() == M &&
- "Unexpected module change during IR generation");

// Link LinkModule into this module if present,
preserving its validity.
for (auto  : LinkModules) {
  unsigned LinkFlags = I.first;
  llvm::Module *LinkModule = I.second.get();
-if (Linker::linkModules(*M, *LinkModule,
+if (Linker::linkModules(*getModule(), *LinkModule,
  [=](const DiagnosticInfo ) {
linkerDiagnosticHandler(DI,
LinkModule, Diags);
  },
@@ -195,7 +182,7 @@

// Install an inline asm handler so that diagnostics get
printed through
// our diagnostics hooks.
-  LLVMContext  = TheModule->getContext();
+  LLVMContext  = getModule()->getContext();
LLVMContext::InlineAsmDiagHandlerTy OldHandler =
  Ctx.getInlineAsmDiagnosticHandler();
void *OldContext = Ctx.getInlineAsmDiagnosticContext();
@@ -208,7 +195,7 @@

EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts,
  C.getTargetInfo().getDataLayoutString(),
-TheModule.get(), Action, AsmOutStream);
+getModule(), Action, AsmOutStream);

Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);







___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list

Re: [PATCH] D15450: Avoid double deletion in Clang driver.

2016-01-29 Thread Jonathan Roelofs via cfe-commits



On 1/29/16 12:50 PM, Serge Pavlov wrote:

Crash is observed when HandleTranslation unit is not called, clang
always calls this method but a clang based project may don't call it if
it is not needed. I saw the crash in such project and used this patch to
fix it. I do not know how to make a regression test, I am not even sure
such test would be practical. The fact that an object is owned by two
unique_ptr's may be enought to change implementation. However any
thoughts how to test this behavior are wellcome.


This is what the clang/unittests is for (i.e. you can write a testcase 
that doesn't have to go through the clang driver).



Jon



Thanks,
--Serge

2016-01-30 0:54 GMT+06:00 Jonathan Roelofs >:



On 1/29/16 11:51 AM, Serge Pavlov via cfe-commits wrote:

Can somebody have a look at this fix?
Thank you!


Testcase?


--Serge

2016-01-11 23:50 GMT+06:00 Serge Pavlov 
>>:

 Any feedback?

 Thanks,
 --Serge

 2015-12-11 20:24 GMT+06:00 Serge Pavlov

 >>:


 sepavloff created this revision.
 sepavloff added a subscriber: cfe-commits.

 Llvm module object is shared between CodeGenerator and
 BackendConsumer,
 in both classes it is stored as std::unique_ptr, which
is not a good
 design solution and can cause double deletion error.
Usually it does
 not occur because in
BackendConsumer::HandleTranslationUnit the
 ownership of CodeGenerator over the module is taken
away. If however
 this method is not called, the module is deleted twice and
 compiler crashes.

 As the module owned by BackendConsumer is always the
same as
 CodeGenerator
 has, local copy of llvm module can be removed from
BackendGenerator.

http://reviews.llvm.org/D15450

 Files:
lib/CodeGen/CodeGenAction.cpp

 Index: lib/CodeGen/CodeGenAction.cpp

===
 --- lib/CodeGen/CodeGenAction.cpp
 +++ lib/CodeGen/CodeGenAction.cpp
 @@ -73,7 +73,6 @@

   std::unique_ptr Gen;

 -std::unique_ptr TheModule;
   SmallVector, 4>
   LinkModules;

 @@ -97,7 +96,10 @@
   this->LinkModules.push_back(
   std::make_pair(I.first,
 std::unique_ptr(I.second)));
   }
 -std::unique_ptr takeModule() { return
 std::move(TheModule); }
 +llvm::Module *getModule() const { return
Gen->GetModule(); }
 +std::unique_ptr takeModule() {
 +  return
std::unique_ptr(Gen->ReleaseModule());
 +}
   void releaseLinkModules() {
 for (auto  : LinkModules)
   I.second.release();
 @@ -117,8 +119,6 @@

 Gen->Initialize(Ctx);

 -  TheModule.reset(Gen->GetModule());
 -
 if (llvm::TimePassesIsEnabled)
   LLVMIRGeneration.stopTimer();
   }
 @@ -165,27 +165,14 @@
 }

 // Silently ignore if we weren't initialized
for some
 reason.
 -  if (!TheModule)
 -return;
 -
 -  // Make sure IR generation is happy with the
module. This
 is released by
 -  // the module provider.
 -  llvm::Module *M = Gen->ReleaseModule();
 -  if (!M) {
 -// The module has been released by IR gen on
failures,
 do not double
 -// free.
 -TheModule.release();
 +  if (!getModule())
   return;
 -  }
 -
 -  assert(TheModule.get() == M &&
 - "Unexpected module change during IR
generation");

 // Link LinkModule into this module if present,
   

  1   2   3   >