[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2022-02-19 Thread Chris Lattner via Phabricator via cfe-commits
lattner added a comment.

Thank you so much Carlos, I hope they can come to see the value of having first 
class support for this in LLVM/Clang.  I really appreciate you pushing for this,

-Chris


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2022-02-18 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp abandoned this revision.
carlosgalvezp added a comment.

Understood, thanks a lot for the clarification and for the time taken!

I will then abandon this patch given the high risk involved. I will forward 
this feedback to MISRA in case there is a possibility to publish the upcoming 
revision in open-source-friendly terms.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2022-02-18 Thread Chris Lattner via Phabricator via cfe-commits
lattner added a comment.

Hi all, I'm commenting on this based on my personal opinion, I don't speak for 
the LLVM board or anyone else.  I am also not a lawyer :)

This isn’t a clear cut case (as is typical!).  LLVM's approach on patents 
protection revolves primarily around the terms in the Apache 2 license, which 
is based on the owner of patents contributing code.  Beyond that, we 
can’t/don't proactively do all the research of potential patent infringement of 
contributed code.

That said, we have historically NOT taken code that is known to infringe on 
high risk patents.  The one that comes to mind is the (now expired) patents on 
Steensgaard’s unification-based pointer analysis work.  We rejected taking 
related work until those patents expire.

In this case, AUTOSAR/Parasoft looks like a little company, their spec is 
clearly saying they have IP rights associated with it, and the risks seem very 
high to me.  I think we should ask for a legal statement signed by a director 
of the company (not an informal email) saying we can use this in LLVM.  The 
risk is just otherwise too high for the vast community of people who use LLVM.

-Chris


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2022-02-14 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

In D112730#3316646 , @carlosgalvezp 
wrote:

> Thanks a lot @tonic for your update and for the work done in the last months 
> ! It's indeed very sad to hear the news. It's a pity that the work will 
> probably be duplicated in many local forks with sub-optimal solutions instead 
> of a centralized, high-quality, peer-reviewed open-source solution.
>
> I'm not very familiar with the terms so I'm not sure I fully understand the 
> reasons why we are advised not to proceed. Could you clarify/elaborate on 
> what it means "the exact patent burden is not disclosed"? I was hoping that 
> the written consent we got from AUTOSAR would be a strong basis to move 
> forward.

In general it would also be good to know if there was any other impediment to 
move forward. This information would be extremely valuable to try and do better 
in the future - I'm thinking on the upcoming MISRA release.

Chris Tapp (chair of MISRA) has been involved in similar discussions 

 in the cfe-dev mailing list, so I think it would be beneficial for him to get 
this feedback and hopefully make the upcoming MISRA release easy to work with 
from this standpoint (if MISRA is interested in an open-source checker 
implementation, of course).

Looking forward to your thoughts :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2022-02-12 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

Thanks a lot @tonic for your update and for the work done in the last months ! 
It's indeed very sad to hear the news. It's a pity that the work will probably 
be duplicated in many local forks with sub-optimal solutions instead of a 
centralized, high-quality, peer-reviewed open-source solution.

I'm not very familiar with the terms so I'm not sure I fully understand the 
reasons why we are advised not to proceed. Could you clarify/elaborate on what 
it means "the exact patent burden is not disclosed"? I was hoping that the 
written consent we got from AUTOSAR would be a strong basis to move forward.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2022-02-11 Thread Tanya Lattner via Phabricator via cfe-commits
tonic added a comment.

Unfortunately our legal counsel has advised that this patch should not be 
included into LLVM because the exact patent burden is not disclosed. Therefore, 
we can not accept this patch into LLVM. I am very sorry to have to report this 
disappointing news.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-12-05 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

@tstellar Do you have any updates on the topic? What approximate time frame 
should I expect? Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-11-25 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

@tstellar I totally missed your fast reply, sorry about that! I have just 
forwarded the mail chain to the indicated address. Let me know if there's 
anything else I can do to help.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-11-16 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

Btw can't we just have a license disclaimer like it's done for HiCPP?

https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/hicpp/LICENSE.TXT


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-11-15 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added a comment.

In D112730#3133822 , @carlosgalvezp 
wrote:

> @tstellar @tonic I have finally received an answer from AUTOSAR. Let me know 
> if you'd like me to CC you the mail chain to see the exact discussion.

Can you cc bo...@llvm.org on the mail chain.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-11-15 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

@tstellar @tonic I have finally received an answer from AUTOSAR. Let me know if 
you'd like me to CC you the mail chain to see the exact discussion.

> The AUTOSAR confidential statement states that these documents are considered 
> under the license of AUTOSAR, thus a commercial usage without being a partner 
> is not allowed.



> As you stated correctly, the C++14 guidelines have been handed over to MISRA 
> and will be released there in spring 2022 according to my knowledge.



> Since we had other similar requests already, I can state that this usage of 
> the guidelines is uncritical from AUTOSAR’s perspective.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-11-09 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

In D112730#3116281 , @tstellar wrote:

> @carlosgalvezp The LLVM Foundation Board will conduct a legal reivew of this 
> patch.  Would you be able to share any information you have about the license 
> or usage restrictions for the AUTOSAR specification?

@tstellar Thanks for taking the time to review this, very much appreciated. 
Absolutely, here's what I know:

- The AUTOSAR C++14 guidelines can be obtained freely from here: 
https://www.autosar.org/fileadmin/user_upload/standards/adaptive/20-11/AUTOSAR_RS_CPP14Guidelines.pdf

  Note: this is a new version, compared to the one one could find via a Google 
search. It's still publicly available without any kind of paywall or 
registration needed. It can be searched here: 
https://www.autosar.org/nc/document-search/

- All pages of the pdf contain the header "AUTOSAR CONFIDENTIAL". I don't 
understand what that means legally, given that the document is public.

- The second page of the pdf contains a legal disclaimer, that claims the 
document shall be used "for information purposes only". For commercial usage, 
written permission from AUTOSAR must be obtained. I think it would be best if 
you look at the written statements directly, I might have missed important bits 
here.

- There exists a llvm-project fork that has implemented some of the checks: 
https://github.com/Bareflank/llvm-project/tree/bsl-tidy/clang-tools-extra/clang-tidy/bsl.
 They don't explicitly name Autosar anywhere in the code, but it's clear that 
they implement Autosar checks. In fact some commits refer to the rule number. 
The license of this fork is kept as the existing Apache 2.0 with LLVM 
Exceptions. I don't know if this was agreed with Autosar or simply the author 
didn't take enough consideration about the licensing aspects. I just want to 
mention that open-source Autosar checks already exist today under that license, 
whether it's a mistake or not.

- I have sent an email to AUTOSAR requesting their consent to implement 
open-source checks. Would you like me to CC you and other members of the Board 
into that mail? Who should I add?

- More restrictive guidelines, like MISRA, do allow open-source checkers, as 
long as only the rule number (not the rule text) is displayed.

I believe that's all I know, I hope it helps in reviewing this issue. Let me 
know if there are more questions or anything is unclear!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-11-08 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added a comment.

@carlosgalvezp The LLVM Foundation Board will conduct a legal reivew of this 
patch.  Would you be able to share any information you have about the license 
or usage restrictions for the AUTOSAR specification?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

In D112730#3097091 , @tstellar wrote:

> @carlosgalvezp Did you write this patch or did you get it from someone else?

@tstellar I wrote it myself (following the existing pattern for the other 
modules in the llvm-project repo).

Just to clarify, I mentioned the above repo to point out about the license, but 
I don't plan


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Tom Stellard via Phabricator via cfe-commits
tstellar requested changes to this revision.
tstellar added a comment.
This revision now requires changes to proceed.

@carlosgalvezp Did you write this patch or did you get it from someone else?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

> people DO incorporate clang-tidy into their own commercial offerings

Gna, that //can// be a problem. I wonder if in that case it would be possible 
to add a few lines into the `LLVM Exceptions` part of the license. If it's too 
much of a hassle I guess I'll need to drop it and continue on a local fork 
unfortunately.

It's interesting however that this fork has implemented quite a few AUTOSAR 
checks keeping the existing LLVM license:
https://github.com/Bareflank/llvm-project/blob/bsl-tidy


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added reviewers: alexfh, tonic.
aaron.ballman added a subscriber: tonic.
aaron.ballman added a comment.

In D112730#3095767 , @carlosgalvezp 
wrote:

> Also, I've sent a mail to AUTOSAR directly asking for consent, so there's no 
> doubt.

Thank you for reaching out to them. I am also not a lawyer, but that license 
worries me because people DO incorporate clang-tidy into their own commercial 
offerings (downstream), so we could be creating a legal hassle for them. We may 
need to reach out to the LLVM Foundation for guidance depending on what the 
AUTOSAR folks come back with (adding @tonic here for awareness as llvm 
foundation president).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

Also, I've sent a mail to AUTOSAR directly asking for consent, so there's no 
doubt.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp updated this revision to Diff 383259.
carlosgalvezp added a comment.

Removed unnecessary dependency in CMakeLists.txt


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
  clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
@@ -1,6 +1,6 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast,autosar-a5-2-4-reinterpret-cast %t
 
 int i = 0;
 void *j;
 void f() { j = reinterpret_cast(i); }
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [autosar-a5-2-4-reinterpret-cast,cppcoreguidelines-pro-type-reinterpret-cast]
Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -60,6 +60,7 @@
 ``abseil-``Checks related to Abseil library.
 ``altera-``Checks related to OpenCL programming for FPGAs.
 ``android-``   Checks related to Android.
+``autosar-``   Checks related to AUTOSAR C++14 Coding Guidelines.
 ``boost-`` Checks related to Boost library.
 ``bugprone-``  Checks that target bugprone code constructs.
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -50,6 +50,7 @@
`android-cloexec-pipe2 `_,
`android-cloexec-socket `_,
`android-comparison-in-temp-failure-retry `_,
+   `autosar-a5-4-2-reinterpret-cast `_,
`boost-use-to-string `_, "Yes"
`bugprone-argument-comment `_, "Yes"
`bugprone-assert-side-effect `_,
@@ -328,6 +329,7 @@
 .. csv-table:: Aliases..
:header: "Name", "Redirect", "Offers fixes"
 
+   `autosar-a5-4-2-reinterpret-cast `_, `cppcoreguidelines-pro-type-reinterpret-cast `_,
`cert-con36-c `_, `bugprone-spuriously-wake-up-functions `_,
`cert-con54-cpp `_, `bugprone-spuriously-wake-up-functions `_,
`cert-dcl03-c `_, `misc-static-assert `_, "Yes"
Index: clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
@@ -0,0 +1,10 @@
+.. title:: clang-tidy - autosar-a5-4-2-reinterpret-cast
+.. meta::
+   :http-equiv=refresh: 5;URL=cppcoreguidelines-pro-type-reinterpret-cast.html
+
+autosar-a5-4-2-reinterpret-cast
+===
+
+The autosar-a5-4-2-reinterpret-cast check is an alias, please see
+`cppcoreguidelines-pro-type-reinterpret-cast `_
+for more information.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -67,6 +67,8 @@
 Improvements to clang-tidy
 --
 
+- New module: `autosar`, covering the AUTOSAR C++14 Coding Guidelines.
+
 - Added support for globbing in `NOLINT*` expressions, to simplify suppressing
   multiple warnings in the same line.
 
@@ -103,6 +105,11 @@
 New check aliases
 ^
 
+- New alias :doc:`autosar-a5-4-2-reinterpret-cast
+  ` to
+  :doc:`cppcoreguidelines-pro-type-reinterpret-cast
+  ` was added.
+
 - New alias :doc:`cert-exp42-c
   ` to
   :doc:`bugprone-suspicious-memory-comparison
Index: clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
@@ -0,0 +1,26 @@
+set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
+  Support
+  )
+
+add_clang_library(clangTidyAutosarModule
+  AutosarTidyModule.cpp
+
+  LINK_LIBS
+  clangTidy
+  

[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

> "C++14 Guidelines"? So it's always and definitely C++14 specific?

To my knowledge, AUTOSAR handed over the work to MISRA and the current 
direction is that MISRA will merge AUTOSAR C++14 and older MISRA revisions into 
a brand-new MISRA release, coming up 202x (The "x" is very unclear here, it 
could take years to get it in place). So I would be surprised if AUTOSAR 
released a new version after this. They way they are written they are 
targetting the use of C++14.

I suppose we can change the description in the future + add configuration to 
select whether to choose C++14 or something else if that ever comes up, but I 
think it's a bit premature at this point. Would you agree?

> What is the licencing approach of this guideline? Looking up with searchers 
> seems to turn up a few PDFs which say `--- AUTOSAR CONFIDENTIAL ---`, yet 
> they are up and out on the official-looking website.

Yes, that's strange. The disclaimer says the following:

> The material contained in this work is protected by copyright and other types 
> of
>  intellectual property rights. The commercial exploitation of the material 
> contained in
>  this work requires a license to such intellectual property rights.
>  This work may be utilized or reproduced without any modification, in any 
> form or by
>  any means, for informational purposes only. For any other purpose, no part 
> of the
>  work may be utilized or reproduced, in any form or by any means, without 
> permission
>  in writing from the publisher.

I'm not a lawyer for I think we can be sure that this is not a commercial use 
case? I guess if we were a company selling an AUTOSAR C++14-compliant static 
analyzer then we would need a license.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-29 Thread Whisperity via Phabricator via cfe-commits
whisperity added a comment.

"C++14 Guidelines"? So it's always and definitely C++14 specific? What is the 
licencing approach of this guideline? Looking up with searchers seems to turn 
up a few PDFs which say `--- AUTOSAR CONFIDENTIAL ---`, yet they are up and out 
on the official-looking website.




Comment at: clang-tools-extra/clang-tidy/autosar/CMakeLists.txt:26
+  clangTooling
+  clangStaticAnalyzerCheckers
+  )

I'm not sure this is needed here, for this module, as of now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

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


[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-28 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp updated this revision to Diff 383087.
carlosgalvezp added a comment.

Update release notes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
  clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
@@ -1,6 +1,6 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast,autosar-a5-2-4-reinterpret-cast %t
 
 int i = 0;
 void *j;
 void f() { j = reinterpret_cast(i); }
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [autosar-a5-2-4-reinterpret-cast,cppcoreguidelines-pro-type-reinterpret-cast]
Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -60,6 +60,7 @@
 ``abseil-``Checks related to Abseil library.
 ``altera-``Checks related to OpenCL programming for FPGAs.
 ``android-``   Checks related to Android.
+``autosar-``   Checks related to AUTOSAR C++14 Coding Guidelines.
 ``boost-`` Checks related to Boost library.
 ``bugprone-``  Checks that target bugprone code constructs.
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -50,6 +50,7 @@
`android-cloexec-pipe2 `_,
`android-cloexec-socket `_,
`android-comparison-in-temp-failure-retry `_,
+   `autosar-a5-4-2-reinterpret-cast `_,
`boost-use-to-string `_, "Yes"
`bugprone-argument-comment `_, "Yes"
`bugprone-assert-side-effect `_,
@@ -328,6 +329,7 @@
 .. csv-table:: Aliases..
:header: "Name", "Redirect", "Offers fixes"
 
+   `autosar-a5-4-2-reinterpret-cast `_, `cppcoreguidelines-pro-type-reinterpret-cast `_,
`cert-con36-c `_, `bugprone-spuriously-wake-up-functions `_,
`cert-con54-cpp `_, `bugprone-spuriously-wake-up-functions `_,
`cert-dcl03-c `_, `misc-static-assert `_, "Yes"
Index: clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
@@ -0,0 +1,10 @@
+.. title:: clang-tidy - autosar-a5-4-2-reinterpret-cast
+.. meta::
+   :http-equiv=refresh: 5;URL=cppcoreguidelines-pro-type-reinterpret-cast.html
+
+autosar-a5-4-2-reinterpret-cast
+===
+
+The autosar-a5-4-2-reinterpret-cast check is an alias, please see
+`cppcoreguidelines-pro-type-reinterpret-cast `_
+for more information.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -67,6 +67,8 @@
 Improvements to clang-tidy
 --
 
+- New module: `autosar`, covering the AUTOSAR C++14 Coding Guidelines.
+
 - Added support for globbing in `NOLINT*` expressions, to simplify suppressing
   multiple warnings in the same line.
 
@@ -103,6 +105,11 @@
 New check aliases
 ^
 
+- New alias :doc:`autosar-a5-4-2-reinterpret-cast
+  ` to
+  :doc:`cppcoreguidelines-pro-type-reinterpret-cast
+  ` was added.
+
 - New alias :doc:`cert-exp42-c
   ` to
   :doc:`bugprone-suspicious-memory-comparison
Index: clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
@@ -0,0 +1,27 @@
+set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
+  Support
+  )
+
+add_clang_library(clangTidyAutosarModule
+  AutosarTidyModule.cpp
+
+  LINK_LIBS
+  clangTidy
+  clangTidyUtils
+  

[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-28 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp updated this revision to Diff 383059.
carlosgalvezp added a comment.

Fix ordering in check list.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
  clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
  clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
@@ -1,6 +1,6 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast,autosar-a5-2-4-reinterpret-cast %t
 
 int i = 0;
 void *j;
 void f() { j = reinterpret_cast(i); }
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [autosar-a5-2-4-reinterpret-cast,cppcoreguidelines-pro-type-reinterpret-cast]
Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -60,6 +60,7 @@
 ``abseil-``Checks related to Abseil library.
 ``altera-``Checks related to OpenCL programming for FPGAs.
 ``android-``   Checks related to Android.
+``autosar-``   Checks related to AUTOSAR C++14 Coding Guidelines.
 ``boost-`` Checks related to Boost library.
 ``bugprone-``  Checks that target bugprone code constructs.
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -50,6 +50,7 @@
`android-cloexec-pipe2 `_,
`android-cloexec-socket `_,
`android-comparison-in-temp-failure-retry `_,
+   `autosar-a5-4-2-reinterpret-cast `_,
`boost-use-to-string `_, "Yes"
`bugprone-argument-comment `_, "Yes"
`bugprone-assert-side-effect `_,
@@ -328,6 +329,7 @@
 .. csv-table:: Aliases..
:header: "Name", "Redirect", "Offers fixes"
 
+   `autosar-a5-4-2-reinterpret-cast `_, `cppcoreguidelines-pro-type-reinterpret-cast `_,
`cert-con36-c `_, `bugprone-spuriously-wake-up-functions `_,
`cert-con54-cpp `_, `bugprone-spuriously-wake-up-functions `_,
`cert-dcl03-c `_, `misc-static-assert `_, "Yes"
Index: clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
@@ -0,0 +1,10 @@
+.. title:: clang-tidy - autosar-a5-4-2-reinterpret-cast
+.. meta::
+   :http-equiv=refresh: 5;URL=cppcoreguidelines-pro-type-reinterpret-cast.html
+
+autosar-a5-4-2-reinterpret-cast
+===
+
+The autosar-a5-4-2-reinterpret-cast check is an alias, please see
+`cppcoreguidelines-pro-type-reinterpret-cast `_
+for more information.
Index: clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
@@ -0,0 +1,27 @@
+set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
+  Support
+  )
+
+add_clang_library(clangTidyAutosarModule
+  AutosarTidyModule.cpp
+
+  LINK_LIBS
+  clangTidy
+  clangTidyUtils
+  clangTidyCppCoreGuidelinesModule
+
+  DEPENDS
+  omp_gen
+  )
+
+clang_target_link_libraries(clangTidyAutosarModule
+  PRIVATE
+  clangAnalysis
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangLex
+  clangTooling
+  clangStaticAnalyzerCheckers
+  )
Index: clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
@@ -0,0 +1,38 @@
+//===--- AutosarTidyModule.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
+//

[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-28 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp updated this revision to Diff 383058.
carlosgalvezp added a comment.

Specify C++14 in the module description.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112730/new/

https://reviews.llvm.org/D112730

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
  clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
  clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
@@ -1,6 +1,6 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast,autosar-a5-2-4-reinterpret-cast %t
 
 int i = 0;
 void *j;
 void f() { j = reinterpret_cast(i); }
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [autosar-a5-2-4-reinterpret-cast,cppcoreguidelines-pro-type-reinterpret-cast]
Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -60,6 +60,7 @@
 ``abseil-``Checks related to Abseil library.
 ``altera-``Checks related to OpenCL programming for FPGAs.
 ``android-``   Checks related to Android.
+``autosar-``   Checks related to AUTOSAR C++14 Coding Guidelines.
 ``boost-`` Checks related to Boost library.
 ``bugprone-``  Checks that target bugprone code constructs.
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -35,6 +35,7 @@
`altera-single-work-item-barrier `_,
`altera-struct-pack-align `_, "Yes"
`altera-unroll-loops `_,
+   `autosar-a5-4-2-reinterpret-cast `_,
`android-cloexec-accept `_, "Yes"
`android-cloexec-accept4 `_,
`android-cloexec-creat `_, "Yes"
@@ -328,6 +329,7 @@
 .. csv-table:: Aliases..
:header: "Name", "Redirect", "Offers fixes"
 
+   `autosar-a5-4-2-reinterpret-cast `_, `cppcoreguidelines-pro-type-reinterpret-cast `_,
`cert-con36-c `_, `bugprone-spuriously-wake-up-functions `_,
`cert-con54-cpp `_, `bugprone-spuriously-wake-up-functions `_,
`cert-dcl03-c `_, `misc-static-assert `_, "Yes"
Index: clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
@@ -0,0 +1,10 @@
+.. title:: clang-tidy - autosar-a5-4-2-reinterpret-cast
+.. meta::
+   :http-equiv=refresh: 5;URL=cppcoreguidelines-pro-type-reinterpret-cast.html
+
+autosar-a5-4-2-reinterpret-cast
+===
+
+The autosar-a5-4-2-reinterpret-cast check is an alias, please see
+`cppcoreguidelines-pro-type-reinterpret-cast `_
+for more information.
Index: clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
@@ -0,0 +1,27 @@
+set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
+  Support
+  )
+
+add_clang_library(clangTidyAutosarModule
+  AutosarTidyModule.cpp
+
+  LINK_LIBS
+  clangTidy
+  clangTidyUtils
+  clangTidyCppCoreGuidelinesModule
+
+  DEPENDS
+  omp_gen
+  )
+
+clang_target_link_libraries(clangTidyAutosarModule
+  PRIVATE
+  clangAnalysis
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangLex
+  clangTooling
+  clangStaticAnalyzerCheckers
+  )
Index: clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
@@ -0,0 +1,38 @@
+//===--- AutosarTidyModule.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
+//

[PATCH] D112730: [clang-tidy] Add AUTOSAR module

2021-10-28 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp created this revision.
carlosgalvezp added reviewers: aaron.ballman, whisperity.
carlosgalvezp added a project: clang-tools-extra.
Herald added subscribers: armkevincheng, jsmolens, eric-k256, arphaman, 
rnkovacs, kbarton, xazax.hun, mgorny, nemanjai.
Herald added a reviewer: sjarus.
carlosgalvezp requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.

To allow checking the AUTOSAR C++14 Coding Guidelines.

Also an easy check, alias of the C++ Core Guidelines one.

Test and documentation included.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112730

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/ClangTidyForceLinker.h
  clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp
  clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
  clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-reinterpret-cast.cpp
@@ -1,6 +1,6 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-reinterpret-cast,autosar-a5-2-4-reinterpret-cast %t
 
 int i = 0;
 void *j;
 void f() { j = reinterpret_cast(i); }
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: do not use reinterpret_cast [autosar-a5-2-4-reinterpret-cast,cppcoreguidelines-pro-type-reinterpret-cast]
Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -60,6 +60,7 @@
 ``abseil-``Checks related to Abseil library.
 ``altera-``Checks related to OpenCL programming for FPGAs.
 ``android-``   Checks related to Android.
+``autosar-``   Checks related to AUTOSAR C++14 Coding Guidelines.
 ``boost-`` Checks related to Boost library.
 ``bugprone-``  Checks that target bugprone code constructs.
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -35,6 +35,7 @@
`altera-single-work-item-barrier `_,
`altera-struct-pack-align `_, "Yes"
`altera-unroll-loops `_,
+   `autosar-a5-4-2-reinterpret-cast `_,
`android-cloexec-accept `_, "Yes"
`android-cloexec-accept4 `_,
`android-cloexec-creat `_, "Yes"
@@ -328,6 +329,7 @@
 .. csv-table:: Aliases..
:header: "Name", "Redirect", "Offers fixes"
 
+   `autosar-a5-4-2-reinterpret-cast `_, `cppcoreguidelines-pro-type-reinterpret-cast `_,
`cert-con36-c `_, `bugprone-spuriously-wake-up-functions `_,
`cert-con54-cpp `_, `bugprone-spuriously-wake-up-functions `_,
`cert-dcl03-c `_, `misc-static-assert `_, "Yes"
Index: clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
===
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/autosar-a5-4-2-reinterpret-cast.rst
@@ -0,0 +1,10 @@
+.. title:: clang-tidy - autosar-a5-4-2-reinterpret-cast
+.. meta::
+   :http-equiv=refresh: 5;URL=cppcoreguidelines-pro-type-reinterpret-cast.html
+
+autosar-a5-4-2-reinterpret-cast
+===
+
+The autosar-a5-4-2-reinterpret-cast check is an alias, please see
+`cppcoreguidelines-pro-type-reinterpret-cast `_
+for more information.
Index: clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
===
--- /dev/null
+++ clang-tools-extra/clang-tidy/autosar/CMakeLists.txt
@@ -0,0 +1,27 @@
+set(LLVM_LINK_COMPONENTS
+  FrontendOpenMP
+  Support
+  )
+
+add_clang_library(clangTidyAutosarModule
+  AutosarTidyModule.cpp
+
+  LINK_LIBS
+  clangTidy
+  clangTidyUtils
+  clangTidyCppCoreGuidelinesModule
+
+  DEPENDS
+  omp_gen
+  )
+
+clang_target_link_libraries(clangTidyAutosarModule
+  PRIVATE
+  clangAnalysis
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangLex
+  clangTooling
+  clangStaticAnalyzerCheckers
+  )
Index: clang-tools-extra/clang-tidy/autosar/AutosarTidyModule.cpp