[PATCH] D115503: [DebugInfo][Clang] record the access flag for class/struct/union types.

2021-12-13 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.

Got any data on how much this (combined with the LLVM patch) increases debug 
info size of, say, a clang self-host build? I assume not much, but wouldn't 
hurt to know.

(does GCC produce this sort of debug info, or does it skip the access 
specifiers on nested types?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115503

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


[PATCH] D115567: [Sema] Add FixIt when a C++ out-of-line method has extra/missing const

2021-12-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/test/FixIt/member-mismatch.cpp:9
+
+// CHECK: fix-it:"{{.*}}":{10:15-10:15}:" const"
+int Foo::get() {} // expected-error {{does not match any declaration}}

nit: using annotation `[[@LINE+1]]:15` can make the test more robust.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115567

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


[PATCH] D112903: [C++20] [Module] Fix bug47116 and implement [module.interface]/p6

2021-12-13 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu added a comment.

@rsmith @aaron.ballman @urnathan gentle ping~


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

https://reviews.llvm.org/D112903

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


[PATCH] D108189: [RISCV] Support experimental 'P' extension 0.96

2021-12-13 Thread Zixuan Wu via Phabricator via cfe-commits
zixuan-wu added a comment.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence.

Hi, @Jim.
What time is P extension going to upstream to community since it's been no 
update for some months?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108189

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


[PATCH] D70401: [WIP][RISCV] Implement ilp32e ABI

2021-12-13 Thread Sam Elliott via Phabricator via cfe-commits
lenary marked an inline comment as done.
lenary added a comment.

In D70401#3188138 , @zixuan-wu wrote:

> In D70401#3175266 , @khchen wrote:
>
>>> Is it (D70401 ) good enough to solve or 
>>> complete rv32e issue?
>>
>> It need to
>>
>> 1. disallow ilp32e ABI with D ISA extension. 
>> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/3f81fae0412bb9ad4002a4ade508be7aa5e1599b/riscv-cc.adoc#ilp32e-calling-convention
>> 2. emit predefined marco in header (`__riscv_e`)
>> 3. markSuperRegs for X16-X31
>> 4. update tests after rebase on main.
>
> Nice. If no body objects, @pcwang-thead will take this task and re-draft a 
> review.

Please do feel free to commandeer the current patch. I cannot continue to work 
on it (so, you won't see review comments from me).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70401

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


[PATCH] D112410: [SPIR-V] Add a toolchain for SPIR-V in clang

2021-12-13 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added inline comments.



Comment at: clang/test/Driver/spirv-toolchain.cl:10
+// SPV64-SAME: "-o" [[BC:".*bc"]]
+// SPV64: {{".*llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
+

Anastasia wrote:
> svenvh wrote:
> > Any reason to not just check for `llvm-spirv{{.*}}`, for consistency with 
> > the clang check above?
> Good question, apparently some tools get some target prefixes like if you 
> look at `Driver::generatePrefixedToolNames`:
> https://clang.llvm.org/doxygen/Driver_8cpp_source.html#l05169
> 
> But perhaps it doesn't happen for `llvm-spirv` and we can safely omit the 
> prefix?
Having a target prefix for llvm-spirv seems a bit redundant indeed.  
`Driver::generatePrefixedToolNames` seems to add both a prefixed and 
non-prefixed tool name.


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

https://reviews.llvm.org/D112410

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


[PATCH] D115604: [Support] Expand `<@>` as the base directory in response files.

2021-12-13 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

IIUC, the new behavior being introduced by this patch is not the ability of 
having a way to refer to other files in a config/response file relative way, 
but rather extending that ability from only the options that start with `@` to 
options that contain `@` as a sub-string in any place.

If so, why do we need that exactly? What's wrong with specifying the 
config/response file as:

  --target=sample
  -isystem
   @include
  -L
   @lib
  -T 
  @ldscripts/link.ld

instead of having them on the flag and the value on the same line? are there 
any "real" cases in which you need a `foo=@something` today and that command 
line option doesn't have a form without the `=` in between?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115604

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


[PATCH] D114583: [clang-format] Adjust braced list detection

2021-12-13 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment.

It appears that this regressed the formatting of initializer lists in some 
cases:

  # Before
  % cat ~/test.cc
  class A {
A() : a{} {}
  
A(int b) : b(b) {}
  
A(int a, int b) : a(a), bs{{bs...}} {
  f();
}
  
int a, b;
  };
  
  # After
  % build/bin/clang-format -style=google ~/test.cc
  class A {
A() : a {}
{}
  
A(int b) : b(b) {}
  
A(int a, int b) : a(a), bs {
  { bs... }
}
{ f(); }
  
int a, b;
  };

@cpplearner  could you please take a look?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114583

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


[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked an inline comment as done.
steakhal added a comment.

In D115149#3182196 , @ASDenysPetrov 
wrote:

> @steakhal
> Please provide a case which asserts before your patch.

I don't get this one. I've provided a bunch of tests, even annotated with 
`no-crash` comments where we crashed prior to this change.

In D115149#3181552 , @NoQ wrote:

>> There is the reinterpret-cast operation which is capable of crossing these 
>> two domains, producing an expression that can participate in arithmetic 
>> operations, but on the abstract domain side, we still stick to Locs
>
> Such cast should turn the `loc::ConcreteInt` into a `nonloc::ConcreteInt` 
> with the same integral value.
>
> The distinction between Loc and NonLoc is very important. It's at the core of 
> our type correctness. We should fight tooth and nail to preserve it because 
> assertions about these things (such as the one removed here) help us discover 
> a lot of bugs in other places (such as genuinely misplacing a value).

Yes, it makes sense to look for bugs in the cast handling. Ideally, we should 
not transform `loc::ConcreteInt` to `nonloc::ConcreteInt` by hand. The 
reinterpret-cast should have done this transformation for us.
If that is fixed, I'm fine reverting this one. Sorry for rushing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115149

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


[PATCH] D113752: [Parse] Use empty RecoveryExpr when if/while/do/switch conditions fail to parse

2021-12-13 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

since we're now preserving  more invalid code, we should check whether 
const-evaluator is cable of handling these newly-added invalid case.

I have played around it, it seems that if, do/while, while cases are already 
handled well. `switch` case need some work:

- the ASTs among different cases (`switch (;)`, `switch(;;)`, `switch(!!;)`) 
are subtle
- the follow case will result an value-dependent violation, the fix would be to 
handle value-dependent condition in `EvaluateSwitch` 
(`clang/lib/AST/ExprConstant.cpp`)

  constexpr int s() {
switch(!!) {
}
return 0;
  }
  void a() {
constexpr int k = s();
  }




Comment at: clang/lib/Parse/ParseExprCXX.cpp:1962
 ///
 /// \returns The parsed condition.
+Sema::ConditionResult

nit:  update the doc comment, though the comment is already stale (missing 
`CK`).



Comment at: clang/lib/Parse/ParseStmt.cpp:1194
SourceLocation Loc,
-   Sema::ConditionKind CK,
+   Sema::ConditionKind CK, bool MissingOK,
SourceLocation *LParenLoc,

sammccall wrote:
> hokein wrote:
> > what's the purpose of introducing `MissingOK`? It seems unclear to me, my 
> > understanding is
> > 
> > - before the patch, ActionOnCondition always returned a valid 
> > ConditionResult for an empty ConditionResult. I assume this was 
> > conceptually a "MissingOK-true" case.
> > - now in the patch, the MissingOK is propagated to `ActOnCondition`, which 
> > determines the returning result;  ​The MissingOK is set to false in 
> > ParseSwitchStatement, ParseDoStatement below. 
> > 
> > The only case I can think of is that we might fail to create a recoveryExpr 
> > (when the recovery-ast flag is off) for the condition.
> Your understanding is right: previously we were returning a "valid but empty" 
> ConditionResult for a while loop with no condition.
> 
> We want functions like ParseParenExprOrCondition to be able to recover in 
> this case, without having them "recover" legitimately missing for loop 
> conditions.
> 
> It would be possible to have ParseParenExprOrCondition conditionally recover 
> based on MissingOK, but since we're already using the tristate 
> ConditionResult, using its error state seems cleaner.
> 
> > The only case I can think of is that we might fail to create a recoveryExpr 
> > (when the recovery-ast flag is off) for the condition.
> 
> I'm not sure what you're saying here - what is that a case of?
> Is there something you'd like me to do here?
> I'm not sure what you're saying here - what is that a case of?
> Is there something you'd like me to do here?

sorry, no action needed.  



Comment at: clang/test/AST/loop-recovery.cpp:40
+
+  switch(!!!) // expected-error {{expected expression}}
+int switchBody;

can you add an init-statement switch case? e.g. `switch (;)`, `switch(;;)`, 
`switch(!!;)`



Comment at: clang/test/Parser/cxx0x-attributes.cpp:155
   alignas(4 ns::i; // expected-note {{to match this '('}}
+   // expected-error@-1 {{expected ';' after do/while}}
 } // expected-error 2{{expected ')'}} expected-error {{expected expression}}

This looks like a bogus diagnostic, but I think it is ok, as this is a 
poor-recovery case for clang already -- IIUC, the do-while statement range 
claims to the `}` on Line56.

this is a case which can be improved by our bracket-matching repair :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113752

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


[PATCH] D115441: [X86][MS] Add 80bit long double support for Windows

2021-12-13 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

In D115441#3188172 , @pengfei wrote:

>> In GCC on Windows (and clang in mingw mode), long double is always 80 bit on 
>> x86. (On i386, sizeof(long double) == 12, while on x86_64 it's 16.)
>
> How about the alignment? I can see on the i386 Linux case, the alignment is 
> 4, I assume it is also 4 for GCC on Windows, right?

Yes, it's 4 for i386 in GCC on Windows too (and Clang in mingw mode). For 
x86_64, both sizeof and alignof are 16.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115441

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


[PATCH] D102669: [analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file

2021-12-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision.
steakhal added a comment.
This revision is now accepted and ready to land.

I think it looks great. Thanks.


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

https://reviews.llvm.org/D102669

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


[clang] 41def32 - [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

2021-12-13 Thread Matt Devereau via cfe-commits

Author: Matt Devereau
Date: 2021-12-13T11:31:57Z
New Revision: 41def32040787e917b52279cc30231b27f2f02f7

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

LOG: [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

Adds svset_neonq, svget_neonq, svdup_neonq AArch64 intrinsics.

These are described in the ACLE specification:
https://github.com/ARM-software/acle/pull/72

https://reviews.llvm.org/D114713

Added: 
clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def
clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def
clang/lib/Headers/arm_neon_sve_bridge.h

clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_dup_neonq.c

clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_get_neonq.c

clang/test/CodeGen/aarch64_neon_sve_bridge_intrinsics/acle_neon_sve_bridge_set_neonq.c

Modified: 
clang/include/clang/Basic/BuiltinsSVE.def
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/CMakeLists.txt
llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def 
b/clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def
new file mode 100644
index 0..8e3229984d8b7
--- /dev/null
+++ b/clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge.def
@@ -0,0 +1,39 @@
+#ifdef GET_SVE_BUILTINS
+BUILTIN(__builtin_sve_svget_neonq_s8, "V16Scq16Sc", "n")
+BUILTIN(__builtin_sve_svget_neonq_s16, "V8sq8s", "n")
+BUILTIN(__builtin_sve_svget_neonq_s32, "V4iq4i", "n")
+BUILTIN(__builtin_sve_svget_neonq_s64, "V2Wiq2Wi", "n")
+BUILTIN(__builtin_sve_svget_neonq_u8, "V16Ucq16Uc", "n")
+BUILTIN(__builtin_sve_svget_neonq_u16, "V16Usq16Us", "n")
+BUILTIN(__builtin_sve_svget_neonq_u32, "V4Uiq4Ui", "n")
+BUILTIN(__builtin_sve_svget_neonq_u64, "V2UWiq2UWi", "n")
+BUILTIN(__builtin_sve_svget_neonq_f16, "V8hq8h", "n")
+BUILTIN(__builtin_sve_svget_neonq_f32, "V4fq4f", "n")
+BUILTIN(__builtin_sve_svget_neonq_f64, "V2dq2d", "n")
+BUILTIN(__builtin_sve_svget_neonq_bf16, "V8yq8y", "n")
+BUILTIN(__builtin_sve_svset_neonq_s8, "q16Scq16ScV16Sc", "n")
+BUILTIN(__builtin_sve_svset_neonq_s16, "q8sq8sV8s", "n")
+BUILTIN(__builtin_sve_svset_neonq_s32, "q4iq4iV4i", "n")
+BUILTIN(__builtin_sve_svset_neonq_s64, "q2Wiq2WiV2Wi", "n")
+BUILTIN(__builtin_sve_svset_neonq_u8, "q16Ucq16UcV16Uc", "n")
+BUILTIN(__builtin_sve_svset_neonq_u16, "q8Usq8UsV8s", "n")
+BUILTIN(__builtin_sve_svset_neonq_u32, "q4Uiq4UiV4Ui", "n")
+BUILTIN(__builtin_sve_svset_neonq_u64, "q2UWiq2UWiV2UWi", "n")
+BUILTIN(__builtin_sve_svset_neonq_f16, "q8hq8hV8h", "n")
+BUILTIN(__builtin_sve_svset_neonq_f32, "q4fq4fV4f", "n")
+BUILTIN(__builtin_sve_svset_neonq_f64, "q2dq2dV2d", "n")
+BUILTIN(__builtin_sve_svset_neonq_bf16, "q8yq8yV8y", "n")
+BUILTIN(__builtin_sve_svdup_neonq_s8, "q16ScV16Sc", "n")
+BUILTIN(__builtin_sve_svdup_neonq_s16, "q8sV8s", "n")
+BUILTIN(__builtin_sve_svdup_neonq_s32, "q4iV4i", "n")
+BUILTIN(__builtin_sve_svdup_neonq_s64, "q4iV4i", "n")
+BUILTIN(__builtin_sve_svdup_neonq_u8, "q16UcV16Uc", "n")
+BUILTIN(__builtin_sve_svdup_neonq_u16, "q8UsV8Us", "n")
+BUILTIN(__builtin_sve_svdup_neonq_u32, "q4UiV4Ui", "n")
+BUILTIN(__builtin_sve_svdup_neonq_u64, "q2UWiV2UWi", "n")
+BUILTIN(__builtin_sve_svdup_neonq_f16, "q8hV8h", "n")
+BUILTIN(__builtin_sve_svdup_neonq_f32, "q4fV4f", "n")
+BUILTIN(__builtin_sve_svdup_neonq_f64, "q2dV2d", "n")
+BUILTIN(__builtin_sve_svdup_neonq_bf16, "q8yV8y", "n")
+#endif
+

diff  --git a/clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def 
b/clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def
new file mode 100644
index 0..7717ba67b4279
--- /dev/null
+++ b/clang/include/clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def
@@ -0,0 +1,39 @@
+#ifdef GET_SVE_LLVM_INTRINSIC_MAP
+SVEMAP2(svget_neonq_s8, SVETypeFlags::EltTyInt8),
+SVEMAP2(svget_neonq_s16, SVETypeFlags::EltTyInt16),
+SVEMAP2(svget_neonq_s32, SVETypeFlags::EltTyInt32),
+SVEMAP2(svget_neonq_s64, SVETypeFlags::EltTyInt64),
+SVEMAP2(svget_neonq_u8, SVETypeFlags::EltTyInt8),
+SVEMAP2(svget_neonq_u16, SVETypeFlags::EltTyInt16),
+SVEMAP2(svget_neonq_u32, SVETypeFlags::EltTyInt32),
+SVEMAP2(svget_neonq_u64, SVETypeFlags::EltTyInt64),
+SVEMAP2(svget_neonq_f16, SVETypeFlags::EltTyFloat16),
+SVEMAP2(svget_neonq_f32, SVETypeFlags::EltTyFloat32),
+SVEMAP2(svget_neonq_f64, SVETypeFlags::EltTyFloat64),
+SVEMAP2(svget_neonq_bf16, SVETypeFlags::EltTyBFloat16),
+SVEMAP2(svset_neonq_s8, SVETypeFlags::EltTyInt8),
+SVEMAP2(svset_neonq_s16, SVETypeFlags::EltTyInt16),
+SVEMAP2(svset_neonq_s32, SVETypeFlags::EltTyInt32),
+SVEMAP2(svset_neonq_s64, SVETypeFlags::EltTyInt64),
+SVEMAP2(svset_neonq_u8, SVETypeFlags::EltTyInt8),
+SVEMAP2(svset_neonq_u16, SVETypeFlags::E

[PATCH] D114713: [AArch64][SVE][NEON] Add NEON-SVE-Bridge intrinsics

2021-12-13 Thread Matt Devereau via Phabricator via cfe-commits
MattDevereau closed this revision.
MattDevereau added a comment.

41def32040787e917b52279cc30231b27f2f02f7 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114713

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


[PATCH] D114095: [clang][lex] Include tracking: simplify and move to preprocessor

2021-12-13 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added a comment.

You're right, I measured only this patch, not per-submodule include tracking 
(D112915 ).

With per-submodule tracking, the results look like this:

  
+--+--+--+---+--+
  | original | ID vector|bit vector| subm. w incl. [%] | 1 in 
bitvec. [%] |
  
+--+--+--+---+--+
  |23348 |23380 +32 |23380 +32 |   100.0   |   
33.3   |
  |52188 |52224 +36 |52224 +36 |   100.0   |
6.3   |
  |74808 |74856 +48 |74840 +32 |   100.0   |
9.4   |
  |   171772 |   171836 +64 |   171840 +68 |40.0   |
5.7   |
  |   206524 |   206584 +60 |   206540 +16 |   100.0   |   
32.5   |
  |   227716 |   227904+188 |   227856+140 | 6.3   |   
33.3   |
  |   253656 |   253812+156 |   253788+132 |90.0   |
7.6   |
  |   271332 |   271584+252 |   271524+192 |85.7   |
8.5   |
  |   280280 |   280460+180 |   280428+148 |91.7   |
5.6   |
  |   340024 |   340176+152 |   340144+120 |21.4   |   
10.9   |
  |   394692 |   394928+236 |   394872+180 |25.0   |   
18.1   |
  |   629740 |   630028+288 |   629940+200 |83.3   |   
20.0   |
  |   707456 |   707732+276 |   707676+220 |85.7   |   
13.9   |
  |   785508 |   785632+124 |   785616+108 |85.7   |   
18.1   |
  |   835204 |   835824+620 |   835616+412 |93.8   |   
12.5   |
  |   887764 |   888004+240 |   887940+176 | 8.7   |   
19.1   |
  |   971352 |   971504+152 |   971500+148 |66.7   |
6.0   |
  |   994112 |   995048+936 |   994672+560 |93.5   |
9.1   |
  |  124 |  1249408+520 |  1249352+464 |29.6   |
5.0   |
  |  3642908 |  3650076   +7168 |  3652668   +9760 |74.5   |
2.8   |
  |  4112848 |  4114016   +1168 |  4113780+932 |17.7   |
5.3   |
  |  5213344 |  5216228   +2884 |  5216552   +3208 |22.0   |
2.2   |
  
+--+--+--+---+--+
  | 22325464 | 22341244  +15780 | 22342748  +17284 |   |
  |
  
+--+--+--+---+--+

The `subm. w incl. [%]` column shows the percentage of submodules that include 
any headers and for the ones that do, `1 in bitvec. [%]` shows how sparse are 
the bitvectors on average (what percentage of `1` bits they contain).

It seems like smaller modules are generally better off with bitvectors, but for 
larger modules with greater cumulative number of includes, the bitvectors get 
long and sparse. And it's the larger modules whose size ends up impacting the 
overall size of module cache. I think that matches my intuition and roughly 
corresponds to your own measurements.

(Note that in any case, the module cache growth is negligible: `.071%` for ID 
vector and  `.077%` for bitvector.)

Given that, I think we should commit this patch with ID vectors, even though in 
isolation (without D112915 ) it's the worse 
solution. WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114095

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


[PATCH] D115622: [Debugify] Optimize debugify original mode

2021-12-13 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro created this revision.
djtodoro added reviewers: Orlando, StephenTozer.
djtodoro added projects: debug-info, LLVM.
Herald added subscribers: ormris, hiraditya.
djtodoro requested review of this revision.
Herald added a project: clang.
Herald added subscribers: llvm-commits, cfe-commits.

Before we start addressing the issue with having a lot of false positives when 
using debugify in the original mode, we have made a few patches that should 
speed up the execution of the testing utility Passes.

For example, when testing a large project (let's say LLVM project itself), we 
can face a lot of potential DI issues. Usually, we use 
`-verify-each-debuginfo-preserve` (that is very similar to `-debugify-each`) -- 
it collects DI metadata before each Pass, and after the Pass it checks if the 
Pass preserved the DI metadata. However, we can speed up this process, since we 
don't need to collect DI metadata before each pass -- we could use the DI 
metadata that are collected after the previous Pass from the pipeline as an 
input for the next Pass.

This patch speeds up the utility for ~2x.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115622

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Utils/Debugify.h
  llvm/lib/Transforms/Utils/Debugify.cpp
  llvm/tools/opt/opt.cpp
  llvm/unittests/Transforms/Utils/DebugifyTest.cpp

Index: llvm/unittests/Transforms/Utils/DebugifyTest.cpp
===
--- llvm/unittests/Transforms/Utils/DebugifyTest.cpp
+++ llvm/unittests/Transforms/Utils/DebugifyTest.cpp
@@ -121,15 +121,15 @@
 
   DebugInfoDrop *P = new DebugInfoDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -172,15 +172,15 @@
 
   DebugValueDrop *P = new DebugValueDrop();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
@@ -225,15 +225,15 @@
 
   DebugInfoDummyAnalysis *P = new DebugInfoDummyAnalysis();
 
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DIBeforePass;
   DebugifyCustomPassManager Passes;
-  Passes.setDIPreservationMap(DIPreservationMap);
+  Passes.setDebugInfoBeforePass(DIBeforePass);
   Passes.add(createDebugifyModulePass(DebugifyMode::OriginalDebugInfo, "",
-  &(Passes.getDebugInfoPerPassMap(;
+  &(Passes.getDebugInfoPerPass(;
   Passes.add(P);
   Passes.add(createCheckDebugifyModulePass(false, "", nullptr,
DebugifyMode::OriginalDebugInfo,
-   &(Passes.getDebugInfoPerPassMap(;
+   &(Passes.getDebugInfoPerPass(;
 
   testing::internal::CaptureStderr();
   Passes.run(*M);
Index: llvm/tools/opt/opt.cpp
===
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -829,13 +829,13 @@
   // the (-check)-debugify passes.
   DebugifyCustomPassManager Passes;
   DebugifyStatsMap DIStatsMap;
-  DebugInfoPerPassMap DIPreservationMap;
+  DebugInfoPerPass DebugInfoBeforePass;
   if (DebugifyEach) {
 Passes.setDebugifyMode(DebugifyMode::SyntheticDebugInfo);
 Passes.setDIStatsMap(DIStatsMap);
   } else if (VerifyEachDebugInfoPreserve) {
 Passes.setDebugifyMode(DebugifyMode::OriginalDebugInfo);
-Passes.setDIPreservationMap(DIPreservationMap);
+Passes.setDebugInfoBeforePass(DebugInfoBefo

[clang] 7c51a12 - [NFC] format .cppm files in test

2021-12-13 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2021-12-13T19:52:31+08:00
New Revision: 7c51a128339184c64307f3862e4cd36bf996189b

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

LOG: [NFC] format .cppm files in test

Added: 


Modified: 
clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
clang/test/CXX/modules-ts/codegen-basics.cppm
clang/test/Parser/cxx-modules-interface.cppm
clang/test/SemaCXX/modules-ts.cppm

Removed: 




diff  --git 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
index 4266a4b510a4..a7f102759a0e 100644
--- 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
+++ 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
@@ -4,4 +4,4 @@ export module Y;
 export namespace foo {
 // We need to export something at least
 void print();
-}
+} // namespace foo

diff  --git 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
index 86c67452aa14..61f13ce01925 100644
--- a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
+++ b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
@@ -8,7 +8,7 @@ export module X;
 import Y;
 
 export namespace foo {
-namespace bar{
-void baz();
-}
+namespace bar {
+void baz();
 }
+} // namespace foo

diff  --git a/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm 
b/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
index 377733b61b25..af3f5c728378 100644
--- a/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
+++ b/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
@@ -4,5 +4,5 @@ export module X;
 
 extern "C++" class CPP {
 public:
-void print() {}
+  void print() {}
 };

diff  --git a/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm 
b/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
index bb261700db84..11052432d0ad 100644
--- a/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
+++ b/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
@@ -13,8 +13,8 @@ static void internal_linkage_fn() {}
 export struct external_linkage_class {};
 struct module_linkage_class {};
 namespace {
-  struct internal_linkage_class {};
-}
+struct internal_linkage_class {};
+} // namespace
 
 void use() {
   external_linkage_fn();

diff  --git a/clang/test/CXX/modules-ts/codegen-basics.cppm 
b/clang/test/CXX/modules-ts/codegen-basics.cppm
index c1c726978a88..7ccf6de1f376 100644
--- a/clang/test/CXX/modules-ts/codegen-basics.cppm
+++ b/clang/test/CXX/modules-ts/codegen-basics.cppm
@@ -9,7 +9,7 @@ export {
 }
 
 // CHECK-DAG: define weak_odr void @_ZW6FooBarE2f2v(
-inline void f2() { }
+inline void f2() {}
 
 // CHECK-DAG: define{{.*}} void @_ZW6FooBarE2f3v(
 static void f3() {}

diff  --git a/clang/test/Parser/cxx-modules-interface.cppm 
b/clang/test/Parser/cxx-modules-interface.cppm
index 0e7c74683353..cb63d1c69938 100644
--- a/clang/test/Parser/cxx-modules-interface.cppm
+++ b/clang/test/Parser/cxx-modules-interface.cppm
@@ -16,13 +16,14 @@ export {
 export int c;
 
 namespace N {
-  export void f() {}
-}
+export void f() {}
+} // namespace N
 
-export struct T {} t;
+export struct T {
+} t;
 
 struct S {
-  export int n; // expected-error {{expected member name or ';'}}
+  export int n;// expected-error {{expected member name or ';'}}
   export static int n; // expected-error {{expected member name or ';'}}
 };
 void f() {

diff  --git a/clang/test/SemaCXX/modules-ts.cppm 
b/clang/test/SemaCXX/modules-ts.cppm
index ae15c0825d1a..f3db369f4b97 100644
--- a/clang/test/SemaCXX/modules-ts.cppm
+++ b/clang/test/SemaCXX/modules-ts.cppm
@@ -37,10 +37,11 @@ export {
 export int c;
 
 namespace N {
-  export void f() {}
-}
+export void f() {}
+} // namespace N
 
-export struct T {} t;
+export struct T {
+} t;
 #elif TEST == 3
 int use_a = a; // expected-error {{declaration of 'a' must be imported from 
module 'foo' before it is required}}
 // expected-note@-13 {{declaration here is not visible}}
@@ -49,10 +50,10 @@ int use_a = a; // expected-error {{declaration of 'a' must 
be imported from modu
 import foo;
 
 export {} // expected-error {{export declaration cannot be empty}}
-export { // expected-note {{begins here}}
-  ; // expected-warning {{ISO C++20 does not permit an empty declaration to 
appear in an export block}}
+export {  // expected-note {{begins here}}
+  ;   // expected-warning {{ISO C++20 does not permit an

[PATCH] D115625: [clang-format] add support for cppm files

2021-12-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: ChuanqiXu, HazardyKnusperkeks, curdeius, 
krasimir.
MyDeveloperDay added projects: clang, clang-format.
MyDeveloperDay requested review of this revision.

C++20 Modules current style is to assign a new file suffix .cppm instead of 
.cpp and .h

Ensure git-clang-format can handle that as a default extension


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115625

Files:
  clang/tools/clang-format/clang-format-diff.py
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -78,7 +78,7 @@
   'c', 'h',  # C
   'm',  # ObjC
   'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm'  # C++
   'cu', 'cuh',  # CUDA
   # Other languages that clang-format supports
   'proto', 'protodevel',  # Protocol Buffers
Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -48,7 +48,7 @@
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
-  r'|proto|protodevel|java|cs|json)',
+  r'|proto|protodevel|java|cs|json|cppm)',
   help='custom pattern selecting file paths to reformat '
   '(case insensitive, overridden by -regex)')
   parser.add_argument('-sort-includes', action='store_true', default=False,


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -78,7 +78,7 @@
   'c', 'h',  # C
   'm',  # ObjC
   'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm'  # C++
   'cu', 'cuh',  # CUDA
   # Other languages that clang-format supports
   'proto', 'protodevel',  # Protocol Buffers
Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -48,7 +48,7 @@
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
-  r'|proto|protodevel|java|cs|json)',
+  r'|proto|protodevel|java|cs|json|cppm)',
   help='custom pattern selecting file paths to reformat '
   '(case insensitive, overridden by -regex)')
   parser.add_argument('-sort-includes', action='store_true', default=False,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115625: [clang-format] add support for cppm files

2021-12-13 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.

Thanks for the quick respond!

A note in the summary:

  - C++20 Modules current style is to assign a new file suffix .cppm instead of 
.cpp and .h
  + C++20 Modules current style is to assign a new file suffix .cppm.

Since *.cpp and *.h is not deprecated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115625

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


[PATCH] D114583: [clang-format] Adjust braced list detection

2021-12-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

We might want to revert this until we get a solution to avoid flip flopping 
peoples formats, but this to me comes down to what we've been saying before 
about using the TT_ types to labels the types of `() {} []`

I think in hindsight adding l_brace here just too generic (we need to know if 
its a "BracedInitializer {" or just a scope "{"

  (NextTok->isOneOf(tok::l_brace, tok::identifier)




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114583

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


[PATCH] D112890: headers: optionalise some generated resource headers

2021-12-13 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D112890#3119897 , @jrtc27 wrote:

> This change seems pretty counter to Clang's ability to spit out IR for 
> anything regardless of what backends you have. The right fix should be to 
> shrink the headers, not mask the problem by changing the principles of how 
> Clang works.

For what it's worth, I agree with this. "RISC-V did it already" seems like a 
weak justification given relative popularity of RISC-V and ARM.

What's more, I haven't seen the intrinsic header generation take up a lot of 
time, and 10 MB isn't a lot of storage.

(Intrinsic _tests_ on the other hand did take quite a lot of time on RISC-V, 
which is why they got disabled if the RISC-V is off. This doesn't help bots 
much, since bots need to enable all backends. We had a discussion about this 
when the intrinsics got added, but in the end we sadly just accepted a big 
increase in test time instead of figuring out some less expensive approach.)

Anyways, I agree with @jrtc27 about this change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112890

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


[clang] b6f317d - [gn build] Make arm_neon_sve_bridge.h header auto-syncable

2021-12-13 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-12-13T07:04:45-05:00
New Revision: b6f317d94d894142f5ab9a9e3e942acbfff1dc4b

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

LOG: [gn build] Make arm_neon_sve_bridge.h header auto-syncable

Added: 


Modified: 
clang/lib/Headers/CMakeLists.txt

Removed: 




diff  --git a/clang/lib/Headers/CMakeLists.txt 
b/clang/lib/Headers/CMakeLists.txt
index ca903da1fef3..078988980c52 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -220,7 +220,9 @@ if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST 
LLVM_TARGETS_TO_BUILD)
   # Generate arm_cde.h
   clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
   # Copy arm_neon_sve_bridge.h
-  copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} arm_neon_sve_bridge.h)
+  copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR}
+arm_neon_sve_bridge.h
+  )
 endif()
 if(RISCV IN_LIST LLVM_TARGETS_TO_BUILD)
   # Generate riscv_vector.h



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


[PATCH] D112890: headers: optionalise some generated resource headers

2021-12-13 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

(…at least for the arm headers, which

1. didn't use to do this
2. are a lot smaller than the risc-v headers

)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112890

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


[clang] 45158b1 - Revert "[NFC] format .cppm files in test"

2021-12-13 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-12-13T07:13:17-05:00
New Revision: 45158b18041584e0056f85c04057d5098956257d

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

LOG: Revert "[NFC] format .cppm files in test"

This reverts commit 7c51a128339184c64307f3862e4cd36bf996189b.
Breaks SemaCXX/modules-ts.cppm in check-clang.

Added: 


Modified: 
clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
clang/test/CXX/modules-ts/codegen-basics.cppm
clang/test/Parser/cxx-modules-interface.cppm
clang/test/SemaCXX/modules-ts.cppm

Removed: 




diff  --git 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
index a7f102759a0e..4266a4b510a4 100644
--- 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
+++ 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
@@ -4,4 +4,4 @@ export module Y;
 export namespace foo {
 // We need to export something at least
 void print();
-} // namespace foo
+}

diff  --git 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
index 61f13ce01925..86c67452aa14 100644
--- a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
+++ b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
@@ -8,7 +8,7 @@ export module X;
 import Y;
 
 export namespace foo {
-namespace bar {
-void baz();
+namespace bar{
+void baz();
+}
 }
-} // namespace foo

diff  --git a/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm 
b/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
index af3f5c728378..377733b61b25 100644
--- a/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
+++ b/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
@@ -4,5 +4,5 @@ export module X;
 
 extern "C++" class CPP {
 public:
-  void print() {}
+void print() {}
 };

diff  --git a/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm 
b/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
index 11052432d0ad..bb261700db84 100644
--- a/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
+++ b/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
@@ -13,8 +13,8 @@ static void internal_linkage_fn() {}
 export struct external_linkage_class {};
 struct module_linkage_class {};
 namespace {
-struct internal_linkage_class {};
-} // namespace
+  struct internal_linkage_class {};
+}
 
 void use() {
   external_linkage_fn();

diff  --git a/clang/test/CXX/modules-ts/codegen-basics.cppm 
b/clang/test/CXX/modules-ts/codegen-basics.cppm
index 7ccf6de1f376..c1c726978a88 100644
--- a/clang/test/CXX/modules-ts/codegen-basics.cppm
+++ b/clang/test/CXX/modules-ts/codegen-basics.cppm
@@ -9,7 +9,7 @@ export {
 }
 
 // CHECK-DAG: define weak_odr void @_ZW6FooBarE2f2v(
-inline void f2() {}
+inline void f2() { }
 
 // CHECK-DAG: define{{.*}} void @_ZW6FooBarE2f3v(
 static void f3() {}

diff  --git a/clang/test/Parser/cxx-modules-interface.cppm 
b/clang/test/Parser/cxx-modules-interface.cppm
index cb63d1c69938..0e7c74683353 100644
--- a/clang/test/Parser/cxx-modules-interface.cppm
+++ b/clang/test/Parser/cxx-modules-interface.cppm
@@ -16,14 +16,13 @@ export {
 export int c;
 
 namespace N {
-export void f() {}
-} // namespace N
+  export void f() {}
+}
 
-export struct T {
-} t;
+export struct T {} t;
 
 struct S {
-  export int n;// expected-error {{expected member name or ';'}}
+  export int n; // expected-error {{expected member name or ';'}}
   export static int n; // expected-error {{expected member name or ';'}}
 };
 void f() {

diff  --git a/clang/test/SemaCXX/modules-ts.cppm 
b/clang/test/SemaCXX/modules-ts.cppm
index f3db369f4b97..ae15c0825d1a 100644
--- a/clang/test/SemaCXX/modules-ts.cppm
+++ b/clang/test/SemaCXX/modules-ts.cppm
@@ -37,11 +37,10 @@ export {
 export int c;
 
 namespace N {
-export void f() {}
-} // namespace N
+  export void f() {}
+}
 
-export struct T {
-} t;
+export struct T {} t;
 #elif TEST == 3
 int use_a = a; // expected-error {{declaration of 'a' must be imported from 
module 'foo' before it is required}}
 // expected-note@-13 {{declaration here is not visible}}
@@ -50,10 +49,10 @@ int use_a = a; // expected-error {{declaration of 'a' must 
be imported from modu
 import foo;
 
 export {} // expected-error {{export declaration cannot be empty}}
-export {  // expected-note {{begins here}}
-  ;   // expected-warning {{ISO C++20 does not permit an empty declaration 
to appear 

[PATCH] D115628: [clang][deps] Remove hard-coded resource directory from tests

2021-12-13 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith, arphaman, mgorny.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Dependency scanner test for resource directory deduction doesn't account for 
LLVM builds with custom `CLANG_RESOURCE_DIR`.

This patch ensures we don't hardcode the default behavior into the test and 
take into account the actual value. This is done by running `%clang 
-print-resource-dir` and using that as the expected value in test assertions.
New comment also clarifies this is different from running that command as part 
of the dependency scan.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115628

Files:
  clang/test/ClangScanDeps/Inputs/resource_directory/compiler
  clang/test/ClangScanDeps/resource_directory.c


Index: clang/test/ClangScanDeps/resource_directory.c
===
--- clang/test/ClangScanDeps/resource_directory.c
+++ clang/test/ClangScanDeps/resource_directory.c
@@ -5,21 +5,42 @@
 
 // Deduce the resource directory from the compiler path.
 //
-// RUN: sed -e "s|CLANG|/our/custom/bin/clang|g" -e "s|DIR|%/t|g" \
+// With `%clang-scan-deps --resource-dir-recipe modify-compiler-path`, the
+// resource directory should be identical to `%clang -print-resource-dir`.
+// (Assuming both binaries are built from the same Git checkout.)
+// Here we get the expected path by running `%clang -print-resource-dir` and
+// then verify `%clang-scan-deps` arrives at the same path by calling the
+// `Driver::GetResourcesPath` function.
+//
+// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir`
+// RUN: sed -e "s|CLANG|%clang|g" -e "s|DIR|%/t|g" \
 // RUN:   %S/Inputs/resource_directory/cdb.json.template > %t/cdb_path.json
+//
 // RUN: clang-scan-deps -compilation-database %t/cdb_path.json --format 
experimental-full \
 // RUN:   --resource-dir-recipe modify-compiler-path > %t/result_path.json
-// RUN: cat %t/result_path.json | sed 's:\?:/:g' | FileCheck %s 
--check-prefix=CHECK-PATH
+// RUN: cat %t/result_path.json | sed 's:\?:/:g' \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PATH 
-DEXPECTED_RESOURCE_DIR="$EXPECTED_RESOURCE_DIR"
 // CHECK-PATH:  "-resource-dir"
-// CHECK-PATH-NEXT: "/our/custom/lib{{.*}}"
+// CHECK-PATH-NEXT: "[[EXPECTED_RESOURCE_DIR]]"
 
 // Run the compiler and ask it for the resource directory.
 //
+// With `%clang-scan-deps --resource-dir-recipe invoke-compiler`, the resource
+// directory should be identical to ` -print-resource-dir`, where 

+// is an arbitrary version of Clang. (This configuration is not really 
supported.)
+// Here we hard-code the expected path into `%t/compiler` and then verify
+// `%clang-scan-deps` arrives at the path by actually running the executable.
+//
+// RUN: EXPECTED_RESOURCE_DIR="/custom/compiler/resources"
+// RUN: echo "#!/bin/sh"  > %t/compiler
+// RUN: echo "echo '$EXPECTED_RESOURCE_DIR'" >> %t/compiler
 // RUN: chmod +x %t/compiler
 // RUN: sed -e "s|CLANG|%/t/compiler|g" -e "s|DIR|%/t|g" \
 // RUN:   %S/Inputs/resource_directory/cdb.json.template > 
%t/cdb_invocation.json
+//
 // RUN: clang-scan-deps -compilation-database %t/cdb_invocation.json --format 
experimental-full \
 // RUN:   --resource-dir-recipe invoke-compiler > %t/result_invocation.json
-// RUN: cat %t/result_invocation.json | sed 's:\?:/:g' | FileCheck %s 
--check-prefix=CHECK-INVOCATION
+// RUN: cat %t/result_invocation.json | sed 's:\?:/:g' \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PATH 
-DEXPECTED_RESOURCE_DIR="$EXPECTED_RESOURCE_DIR"
 // CHECK-INVOCATION:  "-resource-dir"
-// CHECK-INVOCATION-NEXT: "/custom/compiler/resources"
+// CHECK-INVOCATION-NEXT: "[[EXPECTED_RESOURCE_DIR]]"
Index: clang/test/ClangScanDeps/Inputs/resource_directory/compiler
===
--- clang/test/ClangScanDeps/Inputs/resource_directory/compiler
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-echo "/custom/compiler/resources"


Index: clang/test/ClangScanDeps/resource_directory.c
===
--- clang/test/ClangScanDeps/resource_directory.c
+++ clang/test/ClangScanDeps/resource_directory.c
@@ -5,21 +5,42 @@
 
 // Deduce the resource directory from the compiler path.
 //
-// RUN: sed -e "s|CLANG|/our/custom/bin/clang|g" -e "s|DIR|%/t|g" \
+// With `%clang-scan-deps --resource-dir-recipe modify-compiler-path`, the
+// resource directory should be identical to `%clang -print-resource-dir`.
+// (Assuming both binaries are built from the same Git checkout.)
+// Here we get the expected path by running `%clang -print-resource-dir` and
+// then verify `%clang-scan-deps` arrives at the same path by calling the
+// `Driver::GetResourcesPath` function.
+//
+// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir`
+// RUN: sed -e "s|CLANG|%clang|g" -e

[PATCH] D115625: [clang-format] add support for cppm files

2021-12-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/tools/clang-format/git-clang-format:81
   'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm'  # C++
   'cu', 'cuh',  # CUDA

I missed a `,` here I think


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115625

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


[PATCH] D108366: [clang][deps] Make resource directory deduction configurable

2021-12-13 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 added a comment.

In D108366#3188028 , @mgorny wrote:

> This change causes a test regression on Gentoo (where 
> `CLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}"`):

Thanks for reporting this. Should be fixed in D115628 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108366

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


[PATCH] D115625: [clang-format] add support for cppm files

2021-12-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 393851.
MyDeveloperDay added a comment.

Missed a comma


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

https://reviews.llvm.org/D115625

Files:
  clang/tools/clang-format/clang-format-diff.py
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -78,7 +78,7 @@
   'c', 'h',  # C
   'm',  # ObjC
   'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm',  # C++
   'cu', 'cuh',  # CUDA
   # Other languages that clang-format supports
   'proto', 'protodevel',  # Protocol Buffers
Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -48,7 +48,7 @@
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
-  r'|proto|protodevel|java|cs|json)',
+  r'|proto|protodevel|java|cs|json|cppm)',
   help='custom pattern selecting file paths to reformat '
   '(case insensitive, overridden by -regex)')
   parser.add_argument('-sort-includes', action='store_true', default=False,


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -78,7 +78,7 @@
   'c', 'h',  # C
   'm',  # ObjC
   'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm',  # C++
   'cu', 'cuh',  # CUDA
   # Other languages that clang-format supports
   'proto', 'protodevel',  # Protocol Buffers
Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -48,7 +48,7 @@
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
-  r'|proto|protodevel|java|cs|json)',
+  r'|proto|protodevel|java|cs|json|cppm)',
   help='custom pattern selecting file paths to reformat '
   '(case insensitive, overridden by -regex)')
   parser.add_argument('-sort-includes', action='store_true', default=False,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115094: Fix -Wdeclaration-after-statement doesn't work when used with -std=c99

2021-12-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D115094#3187152 , @xgupta wrote:

> There is already a revision uploaded for this: 
> https://reviews.llvm.org/D114787 by @zero9178.

Thanks for pointing this out! I thought this seemed familiar. :-D The patch 
author should coordinate to determine who drives one of these patches forward.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115094

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


[PATCH] D114787: [clang][PR51931] Enable `-Wdeclaration-after-statement` for all C versions

2021-12-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

https://reviews.llvm.org/D115094 is a review for doing effectively the same 
fix. Can you coordinate with the other patch author to determine who will drive 
this fix?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114787

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


[PATCH] D115625: [clang-format] add support for cppm files

2021-12-13 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius accepted this revision.
curdeius added a comment.

LGTM.




Comment at: clang/tools/clang-format/clang-format-diff.py:51
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
-  r'|proto|protodevel|java|cs|json)',
+  r'|proto|protodevel|java|cs|json|cppm)',
   help='custom pattern selecting file paths to reformat '

Nit: I would put it close to other C++ extensions.


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

https://reviews.llvm.org/D115625

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


[PATCH] D115149: [analyzer][solver] Fix assertion on (NonLoc, Op, Loc) expressions

2021-12-13 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment.

> @steakhal
> I don't get this one. I've provided a bunch of tests, even annotated with 
> `no-crash` comments where we crashed prior to this change.

I wasn't able to catch any crashes with your tests file 
//(symbol-simplification-nonloc-loc.cpp)// on the baseline before your patch 
(D115149#3180005 ). So I ask you to 
provide the concrete example you've caught which promted you to do this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115149

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


[PATCH] D115625: [clang-format] add support for cppm files

2021-12-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 393858.
MyDeveloperDay added a comment.

Move cppm to be with other cxx extensions


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

https://reviews.llvm.org/D115625

Files:
  clang/tools/clang-format/clang-format-diff.py
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -78,7 +78,7 @@
   'c', 'h',  # C
   'm',  # ObjC
   'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm',  # C++
   'cu', 'cuh',  # CUDA
   # Other languages that clang-format supports
   'proto', 'protodevel',  # Protocol Buffers
Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -47,7 +47,7 @@
   help='custom pattern selecting file paths to reformat '
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
-  r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
+  
r'.*\.(cpp|cc|c\+\+|cxx|cppm|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
   r'|proto|protodevel|java|cs|json)',
   help='custom pattern selecting file paths to reformat '
   '(case insensitive, overridden by -regex)')


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -78,7 +78,7 @@
   'c', 'h',  # C
   'm',  # ObjC
   'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm',  # C++
   'cu', 'cuh',  # CUDA
   # Other languages that clang-format supports
   'proto', 'protodevel',  # Protocol Buffers
Index: clang/tools/clang-format/clang-format-diff.py
===
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -47,7 +47,7 @@
   help='custom pattern selecting file paths to reformat '
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
-  r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
+  r'.*\.(cpp|cc|c\+\+|cxx|cppm|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
   r'|proto|protodevel|java|cs|json)',
   help='custom pattern selecting file paths to reformat '
   '(case insensitive, overridden by -regex)')
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108367: [NFC] computeSPIRKernelABIInfo(): use SPIRABInfo

2021-12-13 Thread Henry Linjamäki via Phabricator via cfe-commits
linjamaki abandoned this revision.
linjamaki added a comment.

D109818  includes the change in this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108367

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


[PATCH] D115604: [Support] Expand `<@>` as the base directory in response files.

2021-12-13 Thread Jack Andersen via Phabricator via cfe-commits
jackoalan added a comment.

In D115604#3188392 , @kadircet wrote:

> IIUC, the new behavior being introduced by this patch is not the ability of 
> having a way to refer to other files in a config/response file relative way, 
> but rather extending that ability from only the options that start with `@` 
> to options that contain `@` as a sub-string in any place.

`@` actually behaves as an "include" operation (i.e. the contents of the 
relative file are tokenized into more response file args). It will fail if a 
directory is passed because it is only used by `FileSystem::getBufferForFile`.

The `<@>` operation I am proposing does not perform any file load and simply 
expands to the base path as the function already knows it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115604

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


Re: [clang] 9791b58 - [C++20 Modules] Don't create global module fragment for extern linkage declaration in GMF already

2021-12-13 Thread chuanqi.xcq via cfe-commits
Hi Richard,

Thanks for reporting this! I found the reason that why it didn't get tested 
previously is that we didn't use `extern "C"/"C++"` actually since we 
implemented partitions internally. Sorry for confusing. I would try to work on 
it.

Thanks,
Chuanqi


--
From:Richard Smith 
Send Time:2021年12月11日(星期六) 08:28
To:Chuanqi Xu ; Chuanqi Xu 
Cc:cfe-commits 
Subject:Re: [clang] 9791b58 - [C++20 Modules] Don't create global module 
fragment for extern linkage declaration in GMF already

On Wed, 8 Dec 2021 at 21:56, Chuanqi Xu via cfe-commits 
 wrote:

 Author: Chuanqi Xu
 Date: 2021-12-09T13:55:15+08:00
 New Revision: 9791b589516b644a6273607b46a9c6661993d667

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

 LOG: [C++20 Modules] Don't create global module fragment for extern linkage 
declaration in GMF already

 Previously we would create global module fragment for extern linkage
 declaration which is alreday in global module fragment. However, it is
 clearly redundant to do so. This patch would check if the extern linkage
 declaration are already in GMF before we create a GMF for it.

I'm still seeing some problems even after this patch -- linkage spec 
declarations within the purview of the module still create new global module 
fragments, and then the serialization code seems to sometimes get confused 
because we have multiple submodules with the same name "". Perhaps we 
should reuse an existing global module fragment if there is one, even when 
inside the purview of the module?

Here's an example end-to-end testcase for which I'm seeing an assertion 
failure; I've not got a reduced testcase yet:

$ cat say_hello.cppm
module;
#include 
#include 
export module Hello;
export void SayHello
  (std::string_view const &name)
{
  std::cout << "Hello " << name << "!\n";
}

$ cat hello.cpp
#include 
import Hello;
int main() {
  SayHello("world");
  return 0;
}

$ ./build/bin/clang++ say_hello.cppm --precompile -o say_hello.pcm -std=c++20
$ ./build/bin/clang++ say_hello.cppm hello.cpp -fmodule-file=say_hello.pcm 
-std=c++20

 Added: 
 clang/test/CXX/module/module.unit/p7/Inputs/h7.h
 clang/test/CXX/module/module.unit/p7/t7.cpp

 Modified: 
 clang/include/clang/Sema/Sema.h
 clang/lib/Sema/SemaDeclCXX.cpp

 Removed: 



 

 diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
 index a12dd4db66c13..73c5ad1dd7acf 100644
 --- a/clang/include/clang/Sema/Sema.h
 +++ b/clang/include/clang/Sema/Sema.h
 @@ -,6 +,12 @@ class Sema final {
  return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
}

 +  /// Helper function to judge if we are in module purview.
 +  /// Return false if we are not in a module.
 +  bool isCurrentModulePurview() const {
 +return getCurrentModule() ? getCurrentModule()->isModulePurview() : false;
 +  }
 +
/// Enter the scope of the global module.
Module *PushGlobalModuleFragment(SourceLocation BeginLoc, bool IsImplicit);
/// Leave the scope of the global module.

 diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
 index 4a0eda2a700fe..3f6bde1b9ed6a 100644
 --- a/clang/lib/Sema/SemaDeclCXX.cpp
 +++ b/clang/lib/Sema/SemaDeclCXX.cpp
 @@ -16153,7 +16153,10 @@ Decl *Sema::ActOnStartLinkageSpecification(Scope *S, 
SourceLocation ExternLoc,
///   - ...
///   - appears within a linkage-specification,
///   it is attached to the global module.
 -  if (getLangOpts().CPlusPlusModules && getCurrentModule()) {
 +  ///
 +  /// If the declaration is already in global module fragment, we don't
 +  /// need to attach it again.
 +  if (getLangOpts().CPlusPlusModules && isCurrentModulePurview()) {
  Module *GlobalModule =
  PushGlobalModuleFragment(ExternLoc, /*IsImplicit=*/true);
  D->setModuleOwnershipKind(Decl::ModuleOwnershipKind::ModulePrivate);
 @@ -16177,7 +16180,11 @@ Decl *Sema::ActOnFinishLinkageSpecification(Scope *S,
  LSDecl->setRBraceLoc(RBraceLoc);
}

 -  if (getLangOpts().CPlusPlusModules && getCurrentModule())
 +  // If the current module doesn't has Parent, it implies that the
 +  // LinkageSpec isn't in the module created by itself. So we don't
 +  // need to pop it.
 +  if (getLangOpts().CPlusPlusModules && getCurrentModule() &&
 +  getCurrentModule()->isGlobalModule() && getCurrentModule()->Parent)
  PopGlobalModuleFragment();

PopDeclContext();

 diff  --git a/clang/test/CXX/module/module.unit/p7/Inputs/h7.h 
b/clang/test/CXX/module/module.unit/p7/Inputs/h7.h
 new file mode 100644
 index 0..cd3b6706d561c
 --- /dev/null
 +++ b/clang/test/CXX/module/module.unit/p7/Inputs/h7.h
 @@ -0,0 +1,10 @@
 +#ifndef H7_H
 +#define H7_H
 +
 +extern "C+

[PATCH] D115566: Quote some more destination paths with variables

2021-12-13 Thread Louis Dionne via Phabricator via cfe-commits
ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

This looks reasonable to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115566

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


[PATCH] D115628: [clang][deps] Remove hard-coded resource directory from tests

2021-12-13 Thread Michał Górny via Phabricator via cfe-commits
mgorny accepted this revision.
mgorny added a comment.
This revision is now accepted and ready to land.

I can confirm that the test failure is gone with this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115628

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


[PATCH] D115628: [clang][deps] Remove hard-coded resource directory from tests

2021-12-13 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

I can confirm that the test failure is gone with this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115628

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


[clang-tools-extra] a47af1a - [clangd][Dex] Fix crashes when building trigrams for empty identifier

2021-12-13 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2021-12-13T15:58:33+01:00
New Revision: a47af1ac343faba5581dfd243a8d8c56cb7f74b4

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

LOG: [clangd][Dex] Fix crashes when building trigrams for empty identifier

Added: 


Modified: 
clang-tools-extra/clangd/index/dex/Trigram.cpp
clang-tools-extra/clangd/unittests/DexTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/dex/Trigram.cpp 
b/clang-tools-extra/clangd/index/dex/Trigram.cpp
index e6f42f67c50e7..16bb580179d0e 100644
--- a/clang-tools-extra/clangd/index/dex/Trigram.cpp
+++ b/clang-tools-extra/clangd/index/dex/Trigram.cpp
@@ -28,6 +28,7 @@ namespace dex {
 // Produce trigrams (including duplicates) and pass them to Out().
 template 
 static void identifierTrigrams(llvm::StringRef Identifier, Func Out) {
+  assert(!Identifier.empty());
   // Apply fuzzy matching text segmentation.
   llvm::SmallVector Roles(Identifier.size());
   calculateRoles(Identifier,
@@ -104,6 +105,9 @@ void generateIdentifierTrigrams(llvm::StringRef Identifier,
   // The magic number was tuned by running IndexBenchmark.DexBuild.
   constexpr unsigned ManyTrigramsIdentifierThreshold = 14;
   Result.clear();
+  if (Identifier.empty())
+return;
+
   if (Identifier.size() < ManyTrigramsIdentifierThreshold) {
 identifierTrigrams(Identifier, [&](Trigram T) {
   if (!llvm::is_contained(Result, T))

diff  --git a/clang-tools-extra/clangd/unittests/DexTests.cpp 
b/clang-tools-extra/clangd/unittests/DexTests.cpp
index 249cc101a74cd..7e10ea53a43e2 100644
--- a/clang-tools-extra/clangd/unittests/DexTests.cpp
+++ b/clang-tools-extra/clangd/unittests/DexTests.cpp
@@ -415,6 +415,7 @@ TEST(DexTrigrams, IdentifierTrigrams) {
"cdg", "def", "deg", "dgh", "dgk", "efg", "egh",
"egk", "fgh", "fgk", "ghi", "ghk", "gkl", "hij",
"hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
+  EXPECT_THAT(identifierTrigramTokens(""), IsEmpty());
 }
 
 TEST(DexTrigrams, QueryTrigrams) {



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


[PATCH] D112646: [clang-tidy] Add `readability-container-contains` check

2021-12-13 Thread Adrian Vogelsgesang via Phabricator via cfe-commits
avogelsgesang added a comment.

gentle ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112646

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


[PATCH] D113898: [NFC][clangd] cleaning up llvm-qualified-auto

2021-12-13 Thread Christian Kühnel via Phabricator via cfe-commits
kuhnel added a comment.

In D113898#3167215 , @kbobyrev wrote:

> In D113898#3167050 , @kuhnel wrote:
>
>> Looking at the documentation, this looks like a bug in the clang-tidy check:
>> https://releases.llvm.org/13.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability-qualified-auto.html
>>
>> The rule `llvm-qualified-auto` should not add a `const` qualifier.
>
> I don't see how that is a bug: the docs specially cover the `const auto *` 
> conversion in the first example by drawing the line between `observe()` 
> (non-mutating function) and `change()` (possibly mutating function).

Sorry I should have been more precise here: `AddConstToQualified` allows to 
configure if we want to have `const` added or not. The default for that rule is 
`true`. However the last sentence on that page says:

> Note in the LLVM alias, the default value is false.

So my understanding of this is: With the LLVM-rules we're using, `const` should 
not be added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113898

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


[PATCH] D113898: [NFC][clangd] cleaning up llvm-qualified-auto

2021-12-13 Thread Christian Kühnel via Phabricator via cfe-commits
kuhnel updated this revision to Diff 393890.
kuhnel added a comment.

reverted the `const` as advised in Sam's comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113898

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/ExpectedTypes.cpp
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/HeaderSourceSwitch.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/index/IndexAction.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/dex/Iterator.cpp
  clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExpandMacro.cpp
  clang-tools-extra/clangd/unittests/ClangdTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
  clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp

Index: clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
===
--- clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
@@ -192,7 +192,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformNestedNamespaces) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   void bar();
   namespace b {
@@ -220,7 +220,7 @@
   b::c::aux();
   a::b::c::aux();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   void bar();
   namespace b {
@@ -252,7 +252,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformUsings) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a { namespace b { namespace c { void aux(); } } }
 
 void foo();
@@ -263,7 +263,7 @@
   using c::aux;
   namespace d = c;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a { namespace b { namespace c { void aux(); } } }
 
 void foo(){
@@ -278,7 +278,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDecls) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 void foo();
 void f^oo() {
   class Foo {
@@ -293,7 +293,7 @@
   enum class EnClass { Zero, One };
   EnClass y = EnClass::Zero;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 void foo(){
   class Foo {
   public:
@@ -312,7 +312,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTemplDecls) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -329,7 +329,7 @@
   bar>.bar();
   aux>();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -350,7 +350,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformMembers) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 class Foo {
   void foo();
 };
@@ -358,7 +358,7 @@
 void Foo::f^oo() {
   return;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 class Foo {
   void foo(){
   return;
@@ -395,7 +395,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDependentTypes) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {};
 }
@@ -409,7 +409,7 @@
   Bar B;
   Bar> q;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {};
 }
@@ -511,7 +511,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTypeLocs) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -528,7 +528,7 @@
   Foo foo;
   a::Bar>::Baz> q;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -549,7 +549,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDeclRefs) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -575,7 +575,7 @@
   bar();
   a::test();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -605,12 +605,12 @@
 }
 
 TEST_F(DefineInlineTest, StaticMembers) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace ns { class X { static void foo(); void bar(); }; }
 void ns::X::b^ar() {
   foo();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace ns { class X { static void foo(); void bar(){
   foo();
 } }; }
@@ -654,7 +654,7 @@
 }
 
 TEST_F(DefineInlineT

[PATCH] D112024: [clang] diagnose_as attribute for Fortify diagnosing like builtins.

2021-12-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

In D112024#3180347 , @mbenfield wrote:

> @aaron.ballman Look to you like this is ready to land?
>
> EDIT: oops sorry, missed your latest comments, will address them shortly.

Thanks for catching those! FWIW, I think we're close, but precommit CI is 
failing: https://reviews.llvm.org/harbormaster/unit/view/1534779/  In fact, 
LGTM aside from that bit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112024

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


[PATCH] D113898: [NFC][clangd] cleaning up llvm-qualified-auto

2021-12-13 Thread Christian Kühnel via Phabricator via cfe-commits
kuhnel updated this revision to Diff 393892.
kuhnel added a comment.

fixed more const ClangdTests.cpp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113898

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/ExpectedTypes.cpp
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/HeaderSourceSwitch.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/index/IndexAction.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/dex/Iterator.cpp
  clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExpandMacro.cpp
  clang-tools-extra/clangd/unittests/ClangdTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
  clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp

Index: clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
===
--- clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
@@ -192,7 +192,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformNestedNamespaces) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   void bar();
   namespace b {
@@ -220,7 +220,7 @@
   b::c::aux();
   a::b::c::aux();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   void bar();
   namespace b {
@@ -252,7 +252,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformUsings) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a { namespace b { namespace c { void aux(); } } }
 
 void foo();
@@ -263,7 +263,7 @@
   using c::aux;
   namespace d = c;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a { namespace b { namespace c { void aux(); } } }
 
 void foo(){
@@ -278,7 +278,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDecls) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 void foo();
 void f^oo() {
   class Foo {
@@ -293,7 +293,7 @@
   enum class EnClass { Zero, One };
   EnClass y = EnClass::Zero;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 void foo(){
   class Foo {
   public:
@@ -312,7 +312,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTemplDecls) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -329,7 +329,7 @@
   bar>.bar();
   aux>();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -350,7 +350,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformMembers) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 class Foo {
   void foo();
 };
@@ -358,7 +358,7 @@
 void Foo::f^oo() {
   return;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 class Foo {
   void foo(){
   return;
@@ -395,7 +395,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDependentTypes) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {};
 }
@@ -409,7 +409,7 @@
   Bar B;
   Bar> q;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {};
 }
@@ -511,7 +511,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTypeLocs) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -528,7 +528,7 @@
   Foo foo;
   a::Bar>::Baz> q;
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -549,7 +549,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDeclRefs) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -575,7 +575,7 @@
   bar();
   a::test();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -605,12 +605,12 @@
 }
 
 TEST_F(DefineInlineTest, StaticMembers) {
-  auto Test = R"cpp(
+  const auto *Test = R"cpp(
 namespace ns { class X { static void foo(); void bar(); }; }
 void ns::X::b^ar() {
   foo();
 })cpp";
-  auto Expected = R"cpp(
+  const auto *Expected = R"cpp(
 namespace ns { class X { static void foo(); void bar(){
   foo();
 } }; }
@@ -654,7 +654,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTe

[clang] 9db8162 - [NFC] Format .cppm files in tests

2021-12-13 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2021-12-13T23:32:25+08:00
New Revision: 9db8162820c49b2b9f17f3542b3cc2e05d8c00ea

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

LOG: [NFC] Format .cppm files in tests

Added: 


Modified: 
clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
clang/test/CXX/modules-ts/codegen-basics.cppm
clang/test/Parser/cxx-modules-interface.cppm
clang/test/SemaCXX/modules-ts.cppm

Removed: 




diff  --git 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
index 4266a4b510a49..a7f102759a0eb 100644
--- 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
+++ 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/Inputs/p2.cppm
@@ -4,4 +4,4 @@ export module Y;
 export namespace foo {
 // We need to export something at least
 void print();
-}
+} // namespace foo

diff  --git 
a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm 
b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
index 86c67452aa148..61f13ce01925b 100644
--- a/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
+++ b/clang/test/CXX/basic/basic.namespace/basic.namespace.general/p2.cppm
@@ -8,7 +8,7 @@ export module X;
 import Y;
 
 export namespace foo {
-namespace bar{
-void baz();
-}
+namespace bar {
+void baz();
 }
+} // namespace foo

diff  --git a/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm 
b/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
index 377733b61b255..af3f5c728378c 100644
--- a/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
+++ b/clang/test/CXX/module/module.unit/p7/Inputs/CPP.cppm
@@ -4,5 +4,5 @@ export module X;
 
 extern "C++" class CPP {
 public:
-void print() {}
+  void print() {}
 };

diff  --git a/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm 
b/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
index bb261700db84f..11052432d0adc 100644
--- a/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
+++ b/clang/test/CXX/modules-ts/basic/basic.link/p2/module.cppm
@@ -13,8 +13,8 @@ static void internal_linkage_fn() {}
 export struct external_linkage_class {};
 struct module_linkage_class {};
 namespace {
-  struct internal_linkage_class {};
-}
+struct internal_linkage_class {};
+} // namespace
 
 void use() {
   external_linkage_fn();

diff  --git a/clang/test/CXX/modules-ts/codegen-basics.cppm 
b/clang/test/CXX/modules-ts/codegen-basics.cppm
index c1c726978a888..7ccf6de1f3761 100644
--- a/clang/test/CXX/modules-ts/codegen-basics.cppm
+++ b/clang/test/CXX/modules-ts/codegen-basics.cppm
@@ -9,7 +9,7 @@ export {
 }
 
 // CHECK-DAG: define weak_odr void @_ZW6FooBarE2f2v(
-inline void f2() { }
+inline void f2() {}
 
 // CHECK-DAG: define{{.*}} void @_ZW6FooBarE2f3v(
 static void f3() {}

diff  --git a/clang/test/Parser/cxx-modules-interface.cppm 
b/clang/test/Parser/cxx-modules-interface.cppm
index 0e7c746833534..cb63d1c699381 100644
--- a/clang/test/Parser/cxx-modules-interface.cppm
+++ b/clang/test/Parser/cxx-modules-interface.cppm
@@ -16,13 +16,14 @@ export {
 export int c;
 
 namespace N {
-  export void f() {}
-}
+export void f() {}
+} // namespace N
 
-export struct T {} t;
+export struct T {
+} t;
 
 struct S {
-  export int n; // expected-error {{expected member name or ';'}}
+  export int n;// expected-error {{expected member name or ';'}}
   export static int n; // expected-error {{expected member name or ';'}}
 };
 void f() {

diff  --git a/clang/test/SemaCXX/modules-ts.cppm 
b/clang/test/SemaCXX/modules-ts.cppm
index ae15c0825d1ab..64beb959edf20 100644
--- a/clang/test/SemaCXX/modules-ts.cppm
+++ b/clang/test/SemaCXX/modules-ts.cppm
@@ -37,22 +37,23 @@ export {
 export int c;
 
 namespace N {
-  export void f() {}
-}
+export void f() {}
+} // namespace N
 
-export struct T {} t;
+export struct T {
+} t;
 #elif TEST == 3
 int use_a = a; // expected-error {{declaration of 'a' must be imported from 
module 'foo' before it is required}}
-// expected-note@-13 {{declaration here is not visible}}
+// expected-note@-14 {{declaration here is not visible}}
 
 #undef foo
 import foo;
 
 export {} // expected-error {{export declaration cannot be empty}}
-export { // expected-note {{begins here}}
-  ; // expected-warning {{ISO C++20 does not permit an empty declaration to 
appear in an export block}}
+export {  // expected-note {{begins here}}
+  ;   // expected-warning {{ISO C++20 does not permit an empty declarat

[PATCH] D113898: [NFC][clangd] cleaning up llvm-qualified-auto

2021-12-13 Thread Christian Kühnel via Phabricator via cfe-commits
kuhnel updated this revision to Diff 393894.
kuhnel added a comment.

more reverts of consts


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113898

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/ExpectedTypes.cpp
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/HeaderSourceSwitch.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/index/IndexAction.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/dex/Iterator.cpp
  clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExpandMacro.cpp
  clang-tools-extra/clangd/unittests/ClangdTests.cpp
  clang-tools-extra/clangd/unittests/FileIndexTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
  clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp

Index: clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
===
--- clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp
@@ -192,7 +192,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformNestedNamespaces) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 namespace a {
   void bar();
   namespace b {
@@ -220,7 +220,7 @@
   b::c::aux();
   a::b::c::aux();
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 namespace a {
   void bar();
   namespace b {
@@ -252,7 +252,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformUsings) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 namespace a { namespace b { namespace c { void aux(); } } }
 
 void foo();
@@ -263,7 +263,7 @@
   using c::aux;
   namespace d = c;
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 namespace a { namespace b { namespace c { void aux(); } } }
 
 void foo(){
@@ -278,7 +278,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDecls) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 void foo();
 void f^oo() {
   class Foo {
@@ -293,7 +293,7 @@
   enum class EnClass { Zero, One };
   EnClass y = EnClass::Zero;
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 void foo(){
   class Foo {
   public:
@@ -312,7 +312,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTemplDecls) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -329,7 +329,7 @@
   bar>.bar();
   aux>();
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -350,7 +350,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformMembers) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 class Foo {
   void foo();
 };
@@ -358,7 +358,7 @@
 void Foo::f^oo() {
   return;
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 class Foo {
   void foo(){
   return;
@@ -395,7 +395,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDependentTypes) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 namespace a {
   template  class Bar {};
 }
@@ -409,7 +409,7 @@
   Bar B;
   Bar> q;
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 namespace a {
   template  class Bar {};
 }
@@ -511,7 +511,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTypeLocs) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -528,7 +528,7 @@
   Foo foo;
   a::Bar>::Baz> q;
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -549,7 +549,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformDeclRefs) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -575,7 +575,7 @@
   bar();
   a::test();
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 namespace a {
   template  class Bar {
   public:
@@ -605,12 +605,12 @@
 }
 
 TEST_F(DefineInlineTest, StaticMembers) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 namespace ns { class X { static void foo(); void bar(); }; }
 void ns::X::b^ar() {
   foo();
 })cpp";
-  auto Expected = R"cpp(
+  auto *Expected = R"cpp(
 namespace ns { class X { static void foo(); void bar(){
   foo();
 } }; }
@@ -654,7 +654,7 @@
 }
 
 TEST_F(DefineInlineTest, TransformTemplParamNames) {
-  auto Test = R"cpp(
+  auto *Test = R"cpp(
 struct Foo {
   struct Bar {
 template 

[PATCH] D115199: [X86][AMX] Support amxpreserve attribute in clang.

2021-12-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

I'm worried about the extra overhead imposed on all users by this change. This 
appears to be adding another calling convention to Clang (despite the claim 
that it's not); can you share a motivation for why everyone should pay the 
price for adding it?




Comment at: clang/include/clang/AST/Type.h:1588
 /// regparm and the calling convention.
-unsigned ExtInfo : 13;
+unsigned ExtInfo : 14;
 

This is problematic because it increases the cost of forming a type.



Comment at: clang/include/clang/AST/Type.h:1826
canon.isNull() ? QualType(this_(), 0) : canon) {
-static_assert(sizeof(*this) <= 8 + sizeof(ExtQualsTypeCommonBase),
+static_assert(sizeof(*this) <= 16 + sizeof(ExtQualsTypeCommonBase),
   "changing bitfields changed sizeof(Type)!");

(From comment above) this means that every type is now more expensive to create 
and that has cascading effects on things like template instantiation depth and 
memory pressures for all users, including people not using this feature.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115199

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


[PATCH] D113898: [NFC][clangd] cleaning up llvm-qualified-auto

2021-12-13 Thread Christian Kühnel via Phabricator via cfe-commits
kuhnel marked 3 inline comments as done.
kuhnel added inline comments.



Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:2550
   auto AST = TU.build();
-  for (auto Comment : {"doc1", "doc2", "doc3"}) {
+  for (const auto *Comment : {"doc1", "doc2", "doc3"}) {
 for (const auto &P : T.points(Comment)) {

while clang-tidy added a const here, I would keep it for consistency with the 
next line...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113898

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


[PATCH] D115640: [OpenCL] Add support of __opencl_c_device_enqueue feature macro.

2021-12-13 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov created this revision.
azabaznov added reviewers: Anastasia, svenvh.
Herald added subscribers: Naghasan, ldrumm, yaxunl.
azabaznov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This feature requires support of __opencl_c_generic_address_space and
__opencl_c_program_scope_global_variables so diagnostics for that is provided 
as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115640

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/OpenCLOptions.h
  clang/lib/Basic/OpenCLOptions.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Headers/opencl-c-base.h
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/Sema.cpp
  clang/test/CodeGenOpenCL/address-spaces-mangling.cl
  clang/test/CodeGenOpenCL/address-spaces.cl
  clang/test/CodeGenOpenCL/blocks.cl
  clang/test/CodeGenOpenCL/pipe_types.cl
  clang/test/CodeGenOpenCL/pipe_types_mangling.cl
  clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp
  clang/test/Frontend/opencl.cl
  clang/test/Misc/opencl-c-3.0.incorrect_options.cl
  clang/test/SemaOpenCL/invalid-block.cl
  clang/test/SemaOpenCL/invalid-device-enqueue-types-cl3.0.cl
  clang/test/SemaOpenCL/invalid-pipes-cl1.2.cl
  clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
  clang/test/SemaOpenCL/storageclass.cl

Index: clang/test/SemaOpenCL/storageclass.cl
===
--- clang/test/SemaOpenCL/storageclass.cl
+++ clang/test/SemaOpenCL/storageclass.cl
@@ -1,12 +1,12 @@
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=-__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=-__opencl_c_program_scope_global_variables,+__opencl_c_generic_address_space
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=-__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes,-__opencl_c_device_enqueue
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes,-__opencl_c_device_enqueue
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=-__opencl_c_program_scope_global_variables,+__opencl_c_generic_address_space,-__opencl_c_device_enqueue
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_program_scope_global_variables,+__opencl_c_generic_address_space
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=-__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=-__opencl_c_program_scope_global_variables,+__opencl_c_generic_address_space
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_program_scope_global_variables,+__opencl_c_generic_address_space
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=-__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes,-__opencl_c_device_enqueue
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_program_scope_global_variables,-__opencl_c_generic_address_space,-__opencl_c_pipes,-__opencl_c_device_enqueue
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=-__opencl_c_program_scope_global_variables,+__opencl_c_generic_address_space,-__opencl_c_device_enqueue
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021 -cl-ext=+__opencl_c_program_scope_global_variables,+__opencl_c_generic_address_space,-__opencl_c_device_enqueue
 static constant int G1 = 0;
 constant int G2 = 0;
 
Index: clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
===
--- clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
+++ clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space,-__opencl_c_program_scope_glob

[PATCH] D112230: [OpenCL] Add support of __opencl_c_device_enqueue feature macro.

2021-12-13 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov abandoned this revision.
azabaznov added a comment.

Now program scope global variables are required by device enqueue in the spec, 
new patch for device enqueue support: https://reviews.llvm.org/D115640


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112230

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


[clang] 78b0f37 - [HIPSPV][1/4] Refactor HIP tool chain

2021-12-13 Thread Yaxun Liu via cfe-commits

Author: Yaxun (Sam) Liu
Date: 2021-12-13T10:50:25-05:00
New Revision: 78b0f3701d441e887e92ff9feec4c226c67c334f

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

LOG: [HIPSPV][1/4] Refactor HIP tool chain

This patch refactors the HIP tool chain for new HIP tool chain, HIPSPV
tool chain, which is added in the follow up patch part 2.

Rename HIPToolChain to HIPAMDToolChain and Renames HIP.* files to HIPAMD.*.
Introduce HIPUtility.* file where common HIP utilities, shared among HIP
tool chain implementations, are placed in.
Move constructHIPFatbinCommand() and
constructGenerateObjFileFromHIPFatBinary() to HIPUtility. HIPSPV tool
chain is going to use them.
Tweak bundle target ID in constructHIPFatbinCommand(): extra dashes are
dropped if the Target ID is empty and 'hip' offload kind is made default
for non-AMD targets.

Patch by: Henry Linjamäki

Reviewed by: Yaxun Liu, Artem Belevich, Eric Christopher

Differential Revision: https://reviews.llvm.org/D110549

Added: 
clang/lib/Driver/ToolChains/HIPAMD.cpp
clang/lib/Driver/ToolChains/HIPAMD.h
clang/lib/Driver/ToolChains/HIPUtility.cpp
clang/lib/Driver/ToolChains/HIPUtility.h

Modified: 
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp

Removed: 
clang/lib/Driver/ToolChains/HIP.cpp
clang/lib/Driver/ToolChains/HIP.h



diff  --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 580355ba7e121..3083cae8ad096 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -53,7 +53,8 @@ add_clang_library(clangDriver
   ToolChains/Fuchsia.cpp
   ToolChains/Gnu.cpp
   ToolChains/Haiku.cpp
-  ToolChains/HIP.cpp
+  ToolChains/HIPUtility.cpp
+  ToolChains/HIPAMD.cpp
   ToolChains/Hexagon.cpp
   ToolChains/Hurd.cpp
   ToolChains/Linux.cpp

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 6fae41bc30de6..a5f9222d3253b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -23,7 +23,7 @@
 #include "ToolChains/FreeBSD.h"
 #include "ToolChains/Fuchsia.h"
 #include "ToolChains/Gnu.h"
-#include "ToolChains/HIP.h"
+#include "ToolChains/HIPAMD.h"
 #include "ToolChains/Haiku.h"
 #include "ToolChains/Hexagon.h"
 #include "ToolChains/Hurd.h"
@@ -701,7 +701,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation 
&C,
 // because the device toolchain we create depends on both.
 auto &HIPTC = ToolChains[HIPTriple.str() + "/" + HostTriple.str()];
 if (!HIPTC) {
-  HIPTC = std::make_unique(
+  HIPTC = std::make_unique(
   *this, HIPTriple, *HostTC, C.getInputArgs());
 }
 C.addOffloadDeviceToolChain(HIPTC.get(), OFK);

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 92b7fdb8e7355..d76f810f1a7f0 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7861,7 +7861,7 @@ void OffloadBundler::ConstructJob(Compilation &C, const 
JobAction &JA,
 Triples += '-';
 Triples += CurTC->getTriple().normalize();
 if ((CurKind == Action::OFK_HIP || CurKind == Action::OFK_Cuda) &&
-CurDep->getOffloadingArch()) {
+!StringRef(CurDep->getOffloadingArch()).empty()) {
   Triples += '-';
   Triples += CurDep->getOffloadingArch();
 }

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 630baf9d6ae6e..407f81a2ae09a 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -15,7 +15,7 @@
 #include "Arch/SystemZ.h"
 #include "Arch/VE.h"
 #include "Arch/X86.h"
-#include "HIP.h"
+#include "HIPAMD.h"
 #include "Hexagon.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/LangOptions.h"

diff  --git a/clang/lib/Driver/ToolChains/HIP.cpp 
b/clang/lib/Driver/ToolChains/HIPAMD.cpp
similarity index 59%
rename from clang/lib/Driver/ToolChains/HIP.cpp
rename to clang/lib/Driver/ToolChains/HIPAMD.cpp
index 097cfaa771415..9aa56b21c6bc4 100644
--- a/clang/lib/Driver/ToolChains/HIP.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -1,4 +1,4 @@
-//===--- HIP.cpp - HIP Tool and ToolChain Implementations ---*- C++ 
-*-===//
+//===--- HIPAMD.cpp - HIP Tool and ToolChain Implementations *- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,9 +6,10 @@
 //
 
//===--===//
 
-#include "HIP.h"
+#include "HIPAMD.h"
 #include "AMDGPU.h"
 #include "CommonArgs.h"
+#include "HIPUtility.h"
 #include "clang/Basic/Cuda.h"
 

[PATCH] D110549: [HIPSPV][1/4] Refactor HIP tool chain

2021-12-13 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG78b0f3701d44: [HIPSPV][1/4] Refactor HIP tool chain 
(authored by yaxunl).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110549

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/HIP.cpp
  clang/lib/Driver/ToolChains/HIP.h
  clang/lib/Driver/ToolChains/HIPAMD.cpp
  clang/lib/Driver/ToolChains/HIPAMD.h
  clang/lib/Driver/ToolChains/HIPUtility.cpp
  clang/lib/Driver/ToolChains/HIPUtility.h

Index: clang/lib/Driver/ToolChains/HIPUtility.h
===
--- /dev/null
+++ clang/lib/Driver/ToolChains/HIPUtility.h
@@ -0,0 +1,35 @@
+//===--- HIPUtility.h - Common HIP Tool Chain Utilities -*- C++ -*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPUTILITY_H
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPUTILITY_H
+
+#include "clang/Driver/Tool.h"
+
+namespace clang {
+namespace driver {
+namespace tools {
+namespace HIP {
+
+// Construct command for creating HIP fatbin.
+void constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
+   StringRef OutputFileName,
+   const InputInfoList &Inputs,
+   const llvm::opt::ArgList &TCArgs, const Tool &T);
+
+// Construct command for creating Object from HIP fatbin.
+void constructGenerateObjFileFromHIPFatBinary(
+Compilation &C, const InputInfo &Output, const InputInfoList &Inputs,
+const llvm::opt::ArgList &Args, const JobAction &JA, const Tool &T);
+
+} // namespace HIP
+} // namespace tools
+} // namespace driver
+} // namespace clang
+
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPUTILITY_H
Index: clang/lib/Driver/ToolChains/HIPUtility.cpp
===
--- /dev/null
+++ clang/lib/Driver/ToolChains/HIPUtility.cpp
@@ -0,0 +1,166 @@
+//===--- HIPUtility.cpp - Common HIP Tool Chain Utilities ---*- C++ -*-===//
+//
+// 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 "HIPUtility.h"
+#include "CommonArgs.h"
+#include "clang/Driver/Compilation.h"
+#include "llvm/ADT/Triple.h"
+#include "llvm/Support/Path.h"
+
+using namespace clang::driver;
+using namespace clang::driver::tools;
+using namespace llvm::opt;
+
+#if defined(_WIN32) || defined(_WIN64)
+#define NULL_FILE "nul"
+#else
+#define NULL_FILE "/dev/null"
+#endif
+
+namespace {
+const unsigned HIPCodeObjectAlign = 4096;
+} // namespace
+
+// Constructs a triple string for clang offload bundler.
+static std::string normalizeForBundler(const llvm::Triple &T,
+   bool HasTargetID) {
+  return HasTargetID ? (T.getArchName() + "-" + T.getVendorName() + "-" +
+T.getOSName() + "-" + T.getEnvironmentName())
+   .str()
+ : T.normalize();
+}
+
+// Construct a clang-offload-bundler command to bundle code objects for
+// different devices into a HIP fat binary.
+void HIP::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
+StringRef OutputFileName,
+const InputInfoList &Inputs,
+const llvm::opt::ArgList &Args,
+const Tool &T) {
+  // Construct clang-offload-bundler command to bundle object files for
+  // for different GPU archs.
+  ArgStringList BundlerArgs;
+  BundlerArgs.push_back(Args.MakeArgString("-type=o"));
+  BundlerArgs.push_back(
+  Args.MakeArgString("-bundle-align=" + Twine(HIPCodeObjectAlign)));
+
+  // ToDo: Remove the dummy host binary entry which is required by
+  // clang-offload-bundler.
+  std::string BundlerTargetArg = "-targets=host-x86_64-unknown-linux";
+  std::string BundlerInputArg = "-inputs=" NULL_FILE;
+
+  // AMDGCN:
+  // For code object version 2 and 3, the offload kind in bundle ID is 'hip'
+  // for backward compatibility. For code object version 4 and greater, the
+  // offload kind in bundle ID is 'hipv4'.
+  std::string OffloadKind = "hip";
+  auto &TT = T.getToolChain().getTriple();
+  if (TT.isAMDGCN() && getAMDGPUCodeObje

[PATCH] D115561: [Clang][OpenMP] Add the support for atomic compare in parser

2021-12-13 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

All good but parser tests needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115561

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


[PATCH] D115586: [NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive

2021-12-13 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115586

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


[clang] 240be65 - Fix warning about unused variable in HIPAMD.cpp

2021-12-13 Thread Yaxun Liu via cfe-commits

Author: Yaxun (Sam) Liu
Date: 2021-12-13T11:25:48-05:00
New Revision: 240be6541d49ee7c810cf60fb809409cbadd59c6

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

LOG: Fix warning about unused variable in HIPAMD.cpp

Added: 


Modified: 
clang/lib/Driver/ToolChains/HIPAMD.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/HIPAMD.cpp 
b/clang/lib/Driver/ToolChains/HIPAMD.cpp
index 9aa56b21c6bc4..c08f825e0cb9e 100644
--- a/clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ b/clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -35,10 +35,6 @@ using namespace llvm::opt;
 #define NULL_FILE "/dev/null"
 #endif
 
-namespace {
-const unsigned HIPCodeObjectAlign = 4096;
-} // namespace
-
 static bool shouldSkipSanitizeOption(const ToolChain &TC,
  const llvm::opt::ArgList &DriverArgs,
  StringRef TargetID,



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


[clang] 006fb62 - Fix build failure of HIPUtility.cpp on Windows

2021-12-13 Thread Yaxun Liu via cfe-commits

Author: Yaxun (Sam) Liu
Date: 2021-12-13T11:53:06-05:00
New Revision: 006fb62434f58f69eb7d3d48c81975df2c002778

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

LOG: Fix build failure of HIPUtility.cpp on Windows

Added: 


Modified: 
clang/lib/Driver/ToolChains/HIPUtility.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp 
b/clang/lib/Driver/ToolChains/HIPUtility.cpp
index 03e17de9fbae..1b04a20bacbf 100644
--- a/clang/lib/Driver/ToolChains/HIPUtility.cpp
+++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp
@@ -9,6 +9,7 @@
 #include "HIPUtility.h"
 #include "CommonArgs.h"
 #include "clang/Driver/Compilation.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/Support/Path.h"
 
@@ -38,7 +39,7 @@ static std::string normalizeForBundler(const llvm::Triple &T,
 // Construct a clang-offload-bundler command to bundle code objects for
 // 
diff erent devices into a HIP fat binary.
 void HIP::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
-StringRef OutputFileName,
+llvm::StringRef OutputFileName,
 const InputInfoList &Inputs,
 const llvm::opt::ArgList &Args,
 const Tool &T) {
@@ -64,7 +65,7 @@ void HIP::constructHIPFatbinCommand(Compilation &C, const 
JobAction &JA,
 OffloadKind = OffloadKind + "v4";
   for (const auto &II : Inputs) {
 const auto *A = II.getAction();
-auto ArchStr = StringRef(A->getOffloadingArch());
+auto ArchStr = llvm::StringRef(A->getOffloadingArch());
 BundlerTargetArg +=
 "," + OffloadKind + "-" + normalizeForBundler(TT, !ArchStr.empty());
 if (!ArchStr.empty())



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


[PATCH] D115501: [clang][ARM] Emit warnings when PACBTI-M is used with unsupported architectures

2021-12-13 Thread Amilendra Kodithuwakku via Phabricator via cfe-commits
amilendra updated this revision to Diff 393917.
amilendra added a comment.

Address review comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115501

Files:
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -6403,7 +6403,8 @@
 // If the Branch Protection attribute is missing, validate the target
 // Architecture attribute against Branch Protection command line
 // settings.
-if 
(!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
+if (!Attr.Architecture.empty() &&
+
!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
   CGM.getDiags().Report(
   D->getLocation(),
   diag::warn_target_unsupported_branch_protection_attribute)
Index: clang/lib/Basic/Targets/ARM.cpp
===
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -369,7 +369,7 @@
 
 bool ARMTargetInfo::isBranchProtectionSupportedArch(StringRef Arch) const {
   if (Arch.empty())
-return true;
+return false;
 
   llvm::ARM::ArchKind ArchKind = llvm::ARM::parseCPUArch(Arch);
   if (ArchKind != llvm::ARM::ArchKind::ARMV8_1MMainline &&
@@ -388,7 +388,7 @@
   if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err))
 return false;
 
-  if (!isBranchProtectionSupportedArch(Arch))
+  if (!Arch.empty() && !isBranchProtectionSupportedArch(Arch))
 return false;
 
   BPI.SignReturnAddr =


Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -6403,7 +6403,8 @@
 // If the Branch Protection attribute is missing, validate the target
 // Architecture attribute against Branch Protection command line
 // settings.
-if (!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
+if (!Attr.Architecture.empty() &&
+!CGM.getTarget().isBranchProtectionSupportedArch(Attr.Architecture))
   CGM.getDiags().Report(
   D->getLocation(),
   diag::warn_target_unsupported_branch_protection_attribute)
Index: clang/lib/Basic/Targets/ARM.cpp
===
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -369,7 +369,7 @@
 
 bool ARMTargetInfo::isBranchProtectionSupportedArch(StringRef Arch) const {
   if (Arch.empty())
-return true;
+return false;
 
   llvm::ARM::ArchKind ArchKind = llvm::ARM::parseCPUArch(Arch);
   if (ArchKind != llvm::ARM::ArchKind::ARMV8_1MMainline &&
@@ -388,7 +388,7 @@
   if (!llvm::ARM::parseBranchProtection(Spec, PBP, Err))
 return false;
 
-  if (!isBranchProtectionSupportedArch(Arch))
+  if (!Arch.empty() && !isBranchProtectionSupportedArch(Arch))
 return false;
 
   BPI.SignReturnAddr =
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115501: [clang][ARM] Emit warnings when PACBTI-M is used with unsupported architectures

2021-12-13 Thread Amilendra Kodithuwakku via Phabricator via cfe-commits
amilendra updated this revision to Diff 393918.
amilendra added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115501

Files:
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/ARM.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/arm-branch-protection-attr-2.c
  clang/test/CodeGen/arm_acle.c
  clang/test/Driver/arm-security-options.c
  clang/test/Frontend/arm-branch-protection-default-arch.c
  clang/test/Frontend/arm-ignore-branch-protection-option.c
  clang/test/Frontend/arm-invalid-branch-protection.c
  clang/test/Sema/arm-branch-protection-attr-warn.c
  clang/test/Sema/arm-branch-protection.c

Index: clang/test/Sema/arm-branch-protection.c
===
--- /dev/null
+++ clang/test/Sema/arm-branch-protection.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple thumbv6m -verify -fsyntax-only %s
+
+// expected-no-diagnostics
+// Armv8.1-M.Main
+__attribute__((target("arch=cortex-m55,branch-protection=bti"))) void f1() {}
+__attribute__((target("arch=cortex-m55,branch-protection=pac-ret"))) void f2() {}
+__attribute__((target("arch=cortex-m55,branch-protection=bti+pac-ret"))) void f3() {}
+__attribute__((target("arch=cortex-m55,branch-protection=bti+pac-ret+leaf"))) void f4() {}
+// Armv8-M.Main
+__attribute__((target("arch=cortex-m33,branch-protection=bti"))) void f5() {}
+__attribute__((target("arch=cortex-m33,branch-protection=pac-ret"))) void f6() {}
+__attribute__((target("arch=cortex-m33,branch-protection=bti+pac-ret"))) void f7() {}
+__attribute__((target("arch=cortex-m33,branch-protection=bti+pac-ret+leaf"))) void f8() {}
+// Armv7-M
+__attribute__((target("arch=cortex-m3,branch-protection=bti"))) void f9() {}
+__attribute__((target("arch=cortex-m3,branch-protection=pac-ret"))) void f10() {}
+__attribute__((target("arch=cortex-m3,branch-protection=bti+pac-ret"))) void f11() {}
+__attribute__((target("arch=cortex-m3,branch-protection=bti+pac-ret+leaf"))) void f12() {}
+// Armv7E-M
+__attribute__((target("arch=cortex-m4,branch-protection=bti"))) void f13() {}
+__attribute__((target("arch=cortex-m4,branch-protection=pac-ret"))) void f14() {}
+__attribute__((target("arch=cortex-m4,branch-protection=bti+pac-ret"))) void f15() {}
+__attribute__((target("arch=cortex-m4,branch-protection=bti+pac-ret+leaf"))) void f16() {}
Index: clang/test/Sema/arm-branch-protection-attr-warn.c
===
--- /dev/null
+++ clang/test/Sema/arm-branch-protection-attr-warn.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple thumbv6m -verify -fsyntax-only %s
+
+// expected-warning@+1 {{unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored}}
+__attribute__((target("arch=cortex-m0,branch-protection=bti"))) void f1() {}
+
+// expected-warning@+1 {{unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored}}
+__attribute__((target("arch=cortex-m0,branch-protection=pac-ret"))) void f2() {}
+
+// expected-warning@+1 {{unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored}}
+__attribute__((target("arch=cortex-m0,branch-protection=bti+pac-ret"))) void f3() {}
+
+// expected-warning@+1 {{unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored}}
+__attribute__((target("arch=cortex-m0,branch-protection=bti+pac-ret+leaf"))) void f4() {}
Index: clang/test/Frontend/arm-invalid-branch-protection.c
===
--- clang/test/Frontend/arm-invalid-branch-protection.c
+++ clang/test/Frontend/arm-invalid-branch-protection.c
@@ -1,7 +1,7 @@
 // REQUIRES: arm-registered-target
-// RUN: %clang -target arm-arm-none-eabi -mbranch-protection=pac-ret+b-key -c %s -o /dev/null 2>&1 | FileCheck %s
-// RUN: %clang -target arm-arm-none-eabi -mbranch-protection=pac-ret+b-key+leaf -c %s -o /dev/null 2>&1 | FileCheck %s
-// RUN: %clang -target arm-arm-none-eabi -mbranch-protection=bti+pac-ret+b-key -c %s -o /dev/null 2>&1 | FileCheck %s
-// RUN: %clang -target arm-arm-none-eabi -mbranch-protection=bti+pac-ret+b-key+leaf -c %s -o /dev/null 2>&1 | FileCheck %s
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=pac-ret+b-key -c %s -o /dev/null 2>&1 | FileCheck %s
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=pac-ret+b-key+leaf -c %s -o /dev/null 2>&1 | FileCheck %s
+// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -mbranch-protection=bti+pac-ret+b-key -c %s -o /dev/null 2>&1 | FileChec

[PATCH] D115634: [clangd] Cleanup of readability-identifier-naming

2021-12-13 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

Generally looks good with a few nits for individual names.

The matcher cleanup is a problem though, because you haven't cleaned up the 
functions created using the macros `MATCHER`, `MATCHER_P`, `MATCHER_P2` etc. 
Presumably this is because names created through macros are excluded by the 
clang-tidy check.
IMO as a question of style we need to change all such functions we define or 
none of them.




Comment at: clang-tools-extra/clangd/TUScheduler.cpp:103
 
-static clang::clangd::Key kFileBeingProcessed;
+static clang::clangd::Key KFileBeingProcessed;
 

I don't think it makes sense to keep the K here if it has to be uppercase.

The LLVM styleguide doesn't encourage this prefix. Styleguides that do tend to 
use a lowercase `k` for readability. If we want to strictly follow the LLVM 
styleguide I think we should just drop it.



Comment at: clang-tools-extra/clangd/fuzzer/FuzzerClangdMain.cpp:15
 
+// NOLINTNEXTLINE(readability-identifier-naming)
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);

This name is always exempt, and should rather be excluded by config: 
https://clang.llvm.org/extra/clang-tidy/checks/readability-identifier-naming.html#cmdoption-arg-functionignoredregexp



Comment at: clang-tools-extra/clangd/index/YAMLSerialization.cpp:176
 template <> struct MappingTraits {
-  static void mapping(IO &io, SymbolInfo &SymInfo) {
+  static void mapping(IO &Io, SymbolInfo &SymInfo) {
 // FIXME: expose other fields?

We use `IO` rather than `Io` for initialisms.
There are cases where the type/name can't match, but this doesn't appear to be 
one of them (we use `IO &IO` in similar mapping function below)



Comment at: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp:39
 ::testing::Matcher
-RefsAre(std::vector<::testing::Matcher> Matchers) {
+refsAre(std::vector<::testing::Matcher> Matchers) {
   return ElementsAre(::testing::Pair(_, UnorderedElementsAreArray(Matchers)));

Note that `MATCHER_P(FileURI, F, "") { ... ]` above also defines a function 
returning a `Matcher`.

I think it's OK for our functions to have different case than matcher functions 
from the upstream gtest (different libraries have different styles), but I 
don't think it's OK for matcher functions to have different case depending on 
whether `MATCHER_P` was used or not.

And I agree that `//NOLINT` everywhere is not a good option.

So as far as I'm concerned:
- OK: change these functions and also all the MATCHER, MATCHER_P etc instances 
to lowerCamelCase
- OK: ignore this style rule and check results for matcher names
- Not OK: follow the rule for explicitly-defined function but ignore it for 
`MATCHER_P`s
- Not OK: ignore the rule and add // NOLINT to enough exceptions to silence the 
checker
- Bonus: teach the tidy check to flag violations introduced through macros 
(probably with an allowlist of macro names)

(I'm not quite sure how our convention of using UpperCamelCase for matcher 
factory functions got started, but I suspect it's from following upstream 
recipes without thinking hard about whether the new symbol is a function or a 
type).



Comment at: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp:228
   EXPECT_THAT(getRefs(Idx, Common.ID),
-  RefsAre({FileURI("unittest:///root/A.h"),
+  refsAre({FileURI("unittest:///root/A.h"),
FileURI("unittest:///root/A.cc"),

this illustrates the problem: `RefsAre({FileURI(...)})` or `refsAre({fileURI})` 
make sense, but the mix does not.



Comment at: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp:272
   )cpp";
-  std::string A_CC = "";
+  std::string ACc = "";
   FS.Files[testPath("root/A.cc")] = R"cpp(

This new name is no good, but in fact the variable is unused, just delete it



Comment at: clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp:346
   )cpp";
-  std::string A_CC = "#include \"A.h\"\nvoid g() { (void)common; }";
-  FS.Files[testPath("root/A.cc")] = A_CC;
+  std::string ACc = "#include \"A.h\"\nvoid g() { (void)common; }";
+  FS.Files[testPath("root/A.cc")] = ACc;

This name is also no good, and it's used exactly once - inline it



Comment at: clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp:25
 namespace config {
-template  void PrintTo(const Located &V, std::ostream *OS) {
+template  void printTo(const Located &V, std::ostream *OS) {
   *OS << ::testing::PrintToString(*V);

This is a magic function used by GTest, it is found via ADL and must be spelled 
exactly `PrintTo`.

This rename is dangerous because it doesn't cause tests to fail, but it causes 
them to have useless error messages if they fail later.

Please exclude this from the checker using 

[clang] c03c58c - Add missing textual header to module map

2021-12-13 Thread Adrian Prantl via cfe-commits

Author: Adrian Prantl
Date: 2021-12-13T09:19:22-08:00
New Revision: c03c58c97ab8ac41c84b5269a40c0b35455e

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

LOG: Add missing textual header to module map

Added: 


Modified: 
clang/include/clang/module.modulemap

Removed: 




diff  --git a/clang/include/clang/module.modulemap 
b/clang/include/clang/module.modulemap
index e850a1cd4b9ad..420a2a8ec5ee2 100644
--- a/clang/include/clang/module.modulemap
+++ b/clang/include/clang/module.modulemap
@@ -33,6 +33,7 @@ module Clang_Basic {
 
   textual header "Basic/AArch64SVEACLETypes.def"
   textual header "Basic/BuiltinsAArch64.def"
+  textual header "Basic/BuiltinsAArch64NeonSVEBridge.def"
   textual header "Basic/BuiltinsAMDGPU.def"
   textual header "Basic/BuiltinsARM.def"
   textual header "Basic/BuiltinsBPF.def"



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


[PATCH] D115492: [LTO] Ignore unreachable virtual functions in WPD in hybrid LTO

2021-12-13 Thread Mingming Liu via Phabricator via cfe-commits
luna updated this revision to Diff 393921.
luna added a comment.

Use GUID computed with exported function name as a fallback to look up index 
when there isn't an entry for current function GUID.

- Based on feedback in https://reviews.llvm.org/D115203#inline-1104045
- The entry might be absent when enable-lto-internalization is on (default 
value).
- Also guard second index lookup and saves GUID.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115492

Files:
  clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
  clang/test/CodeGen/thinlto-distributed-cfi.ll
  clang/test/CodeGen/thinlto-funcattr-prop.ll
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/test/Assembler/thinlto-summary.ll
  llvm/test/Bitcode/thinlto-function-summary-refgraph.ll
  llvm/test/Bitcode/thinlto-type-vcalls.ll
  llvm/test/ThinLTO/X86/Inputs/devirt_hybrid_after_filtering_unreachable_lib.ll
  llvm/test/ThinLTO/X86/devirt_hybrid_after_filtering_unreachable.ll
  llvm/test/ThinLTO/X86/dot-dumper.ll
  llvm/test/ThinLTO/X86/dot-dumper2.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
  llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll

Index: llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
===
--- llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
+++ llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
@@ -23,4 +23,4 @@
 }
 
 attributes #0 = { alwaysinline nounwind uwtable }
-; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0
+; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0
Index: llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
===
--- llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
+++ llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
@@ -48,9 +48,9 @@
 ; CHECK-DAG: attributes [[ATTR_NOUNWIND]] = { norecurse nounwind }
 ; CHECK-DAG: attributes [[ATTR_MAYTHROW]] = { norecurse }
 
-; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "catchret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "catchret", summari

[clang] 915d1c0 - Add missing textual header to module map

2021-12-13 Thread Adrian Prantl via cfe-commits

Author: Adrian Prantl
Date: 2021-12-13T09:21:21-08:00
New Revision: 915d1c0b74b5e9462a9ae7cd684a70d1422c7f5a

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

LOG: Add missing textual header to module map

Added: 


Modified: 
clang/include/clang/module.modulemap

Removed: 




diff  --git a/clang/include/clang/module.modulemap 
b/clang/include/clang/module.modulemap
index 420a2a8ec5ee..2b73cd5451b7 100644
--- a/clang/include/clang/module.modulemap
+++ b/clang/include/clang/module.modulemap
@@ -33,8 +33,9 @@ module Clang_Basic {
 
   textual header "Basic/AArch64SVEACLETypes.def"
   textual header "Basic/BuiltinsAArch64.def"
-  textual header "Basic/BuiltinsAArch64NeonSVEBridge.def"
   textual header "Basic/BuiltinsAMDGPU.def"
+  textual header "Basic/BuiltinsAArch64NeonSVEBridge.def"
+  textual header "Basic/BuiltinsAArch64NeonSVEBridge_cg.def"
   textual header "Basic/BuiltinsARM.def"
   textual header "Basic/BuiltinsBPF.def"
   textual header "Basic/Builtins.def"



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


[PATCH] D115492: [LTO] Ignore unreachable virtual functions in WPD in hybrid LTO

2021-12-13 Thread Mingming Liu via Phabricator via cfe-commits
luna updated this revision to Diff 393927.
luna added a comment.

Use type `auto` for GUID to fix a compile error.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115492

Files:
  clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
  clang/test/CodeGen/thinlto-distributed-cfi.ll
  clang/test/CodeGen/thinlto-funcattr-prop.ll
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/test/Assembler/thinlto-summary.ll
  llvm/test/Bitcode/thinlto-function-summary-refgraph.ll
  llvm/test/Bitcode/thinlto-type-vcalls.ll
  llvm/test/ThinLTO/X86/Inputs/devirt_hybrid_after_filtering_unreachable_lib.ll
  llvm/test/ThinLTO/X86/devirt_hybrid_after_filtering_unreachable.ll
  llvm/test/ThinLTO/X86/dot-dumper.ll
  llvm/test/ThinLTO/X86/dot-dumper2.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
  llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll

Index: llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
===
--- llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
+++ llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
@@ -23,4 +23,4 @@
 }
 
 attributes #0 = { alwaysinline nounwind uwtable }
-; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0
+; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0
Index: llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
===
--- llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
+++ llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
@@ -48,9 +48,9 @@
 ; CHECK-DAG: attributes [[ATTR_NOUNWIND]] = { norecurse nounwind }
 ; CHECK-DAG: attributes [[ATTR_MAYTHROW]] = { norecurse }
 
-; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "catchret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "catchret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnkn

[clang] ddcc02d - Quote some more destination paths with variables

2021-12-13 Thread John Ericson via cfe-commits

Author: John Ericson
Date: 2021-12-13T17:29:08Z
New Revision: ddcc02dbcc4767b289776f73f26fe444964d0942

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

LOG: Quote some more destination paths with variables

Just defensive CMake-ing. I pulled this from D115544 and D99484 which
are blocked on some lldb CI failures I don't yet understand. Hoping to land
something smaller in the meantime.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D115566

Added: 


Modified: 
clang/tools/scan-build/CMakeLists.txt
libclc/CMakeLists.txt
libcxx/include/CMakeLists.txt
lldb/cmake/modules/FindLibEdit.cmake
llvm/cmake/modules/AddSphinxTarget.cmake
openmp/runtime/src/CMakeLists.txt

Removed: 




diff  --git a/clang/tools/scan-build/CMakeLists.txt 
b/clang/tools/scan-build/CMakeLists.txt
index ec0702d76f184..74334e53c9b18 100644
--- a/clang/tools/scan-build/CMakeLists.txt
+++ b/clang/tools/scan-build/CMakeLists.txt
@@ -66,16 +66,16 @@ if(CLANG_INSTALL_SCANBUILD)
   endforeach()
 
   foreach(ManPage ${ManPages})
-add_custom_command(OUTPUT 
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}
+add_custom_command(OUTPUT 
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}"
COMMAND ${CMAKE_COMMAND} -E make_directory
- ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1
+ "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1"
COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}
- ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/
+ "${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}"
+ "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage})
-list(APPEND Depends 
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage})
+list(APPEND Depends 
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}")
 install(PROGRAMS man/${ManPage}
-DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
+DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
 COMPONENT scan-build)
   endforeach()
 

diff  --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index ec39ea63f2d02..e90e0fd852012 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -183,8 +183,8 @@ endif()
 
 # pkg-config file
 configure_file( libclc.pc.in libclc.pc @ONLY )
-install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION 
${CMAKE_INSTALL_DATADIR}/pkgconfig )
-install( DIRECTORY generic/include/clc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 
)
+install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION 
"${CMAKE_INSTALL_DATADIR}/pkgconfig" )
+install( DIRECTORY generic/include/clc DESTINATION 
"${CMAKE_INSTALL_INCLUDEDIR}" )
 
 if( ENABLE_RUNTIME_SUBNORMAL )
add_library( subnormal_use_default STATIC
@@ -192,7 +192,7 @@ if( ENABLE_RUNTIME_SUBNORMAL )
add_library( subnormal_disable STATIC
generic/lib/subnormal_disable.ll )
install( TARGETS subnormal_use_default subnormal_disable ARCHIVE
-   DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
+   DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
 endif()
 
 find_package( Python3 REQUIRED COMPONENTS Interpreter )
@@ -343,7 +343,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
add_custom_target( "prepare-${spv_suffix}" ALL
   DEPENDS "${spv_suffix}" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${spv_suffix}
-DESTINATION ${CMAKE_INSTALL_DATADIR}/clc )
+DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
else()
 
# Add prepare target
@@ -366,7 +366,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
PROPERTIES ENVIRONMENT 
"LLVM_CONFIG=${LLVM_CONFIG}" )
endif()
 
-   install( FILES 
${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION 
${CMAKE_INSTALL_DATADIR}/clc )
+   install( FILES 
${CMAKE_CURRENT_BINARY_DIR}/${obj_suffix} DESTINATION 
"${CMAKE_INSTALL_DATADIR}/clc" )
foreach( a ${${d}_aliases} )
set( alias_suffix "${a}-${t}.bc" )
add_custom_target( ${alias_suffix} ALL
@@ -374,7 +374,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
   create_symlink ${obj_suffix}
   ${alias_suffix}
  

[PATCH] D115647: [clang-format] FixNamespaceComments does not understand namespace aliases

2021-12-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: HazardyKnusperkeks, curdeius, owenpan.
MyDeveloperDay added projects: clang, clang-format.
Herald added a subscriber: jeroen.dobbelaere.
MyDeveloperDay requested review of this revision.

https://github.com/llvm/llvm-project/issues/35876

Ensure a namespace alias doesn't get incorrectly identifier as a namespace

  namespace nn {}
  void f() {
namespace n = nn;
{
  int i;
  int j;
} // namespace n=nn;
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115647

Files:
  clang/lib/Format/NamespaceEndCommentsFixer.cpp
  clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp


Index: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -1185,6 +1185,22 @@
 "}\n",
 Style));
 }
+
+TEST_F(ShortNamespaceLinesTest, NameSpaceAlias) {
+  auto Style = getLLVMStyle();
+
+  EXPECT_EQ("namespace n = nn;\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+fixNamespaceEndComments("namespace n = nn;\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+Style));
+}
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/NamespaceEndCommentsFixer.cpp
===
--- clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -24,11 +24,11 @@
 namespace {
 // Computes the name of a namespace given the namespace token.
 // Returns "" for anonymous namespace.
-std::string computeName(const FormatToken *NamespaceTok) {
+bool computeName(const FormatToken *NamespaceTok, std::string &name) {
   assert(NamespaceTok &&
  NamespaceTok->isOneOf(tok::kw_namespace, TT_NamespaceMacro) &&
  "expecting a namespace token");
-  std::string name = "";
+  name = "";
   const FormatToken *Tok = NamespaceTok->getNextNonComment();
   if (NamespaceTok->is(TT_NamespaceMacro)) {
 // Collects all the non-comment tokens between opening parenthesis
@@ -55,10 +55,13 @@
   name += Tok->TokenText;
   if (Tok->is(tok::kw_inline))
 name += " ";
+  // Namespace alias
+  if (Tok->isOneOf(tok::equal, tok::semi))
+return false;
   Tok = Tok->getNextNonComment();
 }
   }
-  return name;
+  return true;
 }
 
 std::string computeEndCommentText(StringRef NamespaceName, bool AddNewline,
@@ -242,7 +245,13 @@
 }
 if (StartLineIndex == SIZE_MAX)
   StartLineIndex = EndLine->MatchingOpeningBlockLineIndex;
-std::string NamespaceName = computeName(NamespaceTok);
+
+std::string NamespaceName;
+if (!computeName(NamespaceTok, NamespaceName)) {
+  // Its likely a namespace alias.
+  continue;
+}
+
 if (Style.CompactNamespaces) {
   if (CompactedNamespacesCount == 0)
 NamespaceTokenText = NamespaceTok->TokenText;


Index: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -1185,6 +1185,22 @@
 "}\n",
 Style));
 }
+
+TEST_F(ShortNamespaceLinesTest, NameSpaceAlias) {
+  auto Style = getLLVMStyle();
+
+  EXPECT_EQ("namespace n = nn;\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+fixNamespaceEndComments("namespace n = nn;\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+Style));
+}
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/NamespaceEndCommentsFixer.cpp
===
--- clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -24,11 +24,11 @@
 namespace {
 // Computes the name of a namespace given the namespace token.
 // Returns "" for anonymous namespace.
-std::string computeName(const FormatToken *NamespaceTok) {
+bool computeName(const FormatToken *NamespaceTok, std::string &name) {
   assert(NamespaceTok &&
  NamespaceTok->isOneOf(tok::kw_namespace, TT_NamespaceMacro) &&
  "expecting a namespace token");
-  std::string name = "";
+  name = "";
   const FormatToken *Tok = 

[PATCH] D115648: [LTO] Ignore unreachable virtual functions in WPD in hybrid LTO

2021-12-13 Thread Mingming Liu via Phabricator via cfe-commits
luna created this revision.
Herald added subscribers: ormris, pengfei, arphaman, steven_wu, hiraditya, 
inglorion.
luna requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

- In FunctionSummary, add a new bit `mustBeUnreachable`.

- In ModuleSummaryAnalysis, set this bit to 1 if a function is unreachable.

- For hybrid LTO, ignore unreachable functions (by reading from index) when 
finding virtual functions. This helps to de-virtualize. See the test case in 
llvm/test/ThinLTO/X86/devirt_hybrid_after_filtering_unreachable.ll


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115648

Files:
  clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
  clang/test/CodeGen/thinlto-distributed-cfi.ll
  clang/test/CodeGen/thinlto-funcattr-prop.ll
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/test/Assembler/thinlto-summary.ll
  llvm/test/Bitcode/thinlto-function-summary-refgraph.ll
  llvm/test/Bitcode/thinlto-type-vcalls.ll
  llvm/test/ThinLTO/X86/Inputs/devirt_hybrid_after_filtering_unreachable_lib.ll
  llvm/test/ThinLTO/X86/devirt_hybrid_after_filtering_unreachable.ll
  llvm/test/ThinLTO/X86/dot-dumper.ll
  llvm/test/ThinLTO/X86/dot-dumper2.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
  llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll

Index: llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
===
--- llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
+++ llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
@@ -23,4 +23,4 @@
 }
 
 attributes #0 = { alwaysinline nounwind uwtable }
-; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0
+; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0
Index: llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
===
--- llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
+++ llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
@@ -48,9 +48,9 @@
 ; CHECK-DAG: attributes [[ATTR_NOUNWIND]] = { norecurse nounwind }
 ; CHECK-DAG: attributes [[ATTR_MAYTHROW]] = { norecurse }
 
-; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "catchret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasU

[PATCH] D112024: [clang] diagnose_as attribute for Fortify diagnosing like builtins.

2021-12-13 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield updated this revision to Diff 393942.
mbenfield added a comment.
Herald added a subscriber: jdoerfert.

Fix test clang/test/Misc/pragma-attribute-supported-attributes-list.test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112024

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/ParsedAttr.h
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Sema/attr-diagnose-as-builtin.c

Index: clang/test/Sema/attr-diagnose-as-builtin.c
===
--- /dev/null
+++ clang/test/Sema/attr-diagnose-as-builtin.c
@@ -0,0 +1,118 @@
+// RUN: %clang_cc1 -Wfortify-source -triple x86_64-apple-macosx10.14.0 %s -verify
+// RUN: %clang_cc1 -Wfortify-source -xc++ -triple x86_64-apple-macosx10.14.0 %s -verify
+
+typedef unsigned long size_t;
+
+__attribute__((diagnose_as_builtin(__builtin_memcpy, 3, 1, 2))) int x; // expected-warning {{'diagnose_as_builtin' attribute only applies to functions}}
+
+void *test_memcpy(const void *src, size_t c, void *dst) __attribute__((diagnose_as_builtin(__builtin_memcpy, 3, 1, 2))) {
+  return __builtin_memcpy(dst, src, c);
+}
+
+void call_test_memcpy() {
+  char bufferA[10];
+  char bufferB[11];
+  test_memcpy(bufferB, 10, bufferA);
+  test_memcpy(bufferB, 11, bufferA); // expected-warning {{'memcpy' will always overflow; destination buffer has size 10, but size argument is 11}}
+}
+
+void failure_function_doesnt_exist() __attribute__((diagnose_as_builtin(__function_that_doesnt_exist))) {} // expected-error {{use of undeclared identifier '__function_that_doesnt_exist'}}
+
+void not_a_builtin() {}
+
+void failure_not_a_builtin() __attribute__((diagnose_as_builtin(not_a_builtin))) {} // expected-error {{'diagnose_as_builtin' attribute requires parameter 1 to be a builtin function}}
+
+void failure_too_many_parameters(void *dst, const void *src, size_t count, size_t nothing) __attribute__((diagnose_as_builtin(__builtin_memcpy, 1, 2, 3, 4))) {} // expected-error {{'diagnose_as_builtin' attribute references function '__builtin_memcpy', which takes exactly 3 arguments}}
+
+void failure_too_few_parameters(void *dst, const void *src) __attribute__((diagnose_as_builtin(__builtin_memcpy, 1, 2))) {} // expected-error{{'diagnose_as_builtin' attribute references function '__builtin_memcpy', which takes exactly 3 arguments}}
+
+void failure_not_an_integer(void *dst, const void *src, size_t count) __attribute__((diagnose_as_builtin(__builtin_memcpy, "abc", 2, 3))) {} // expected-error{{'diagnose_as_builtin' attribute requires parameter 2 to be an integer constant}}
+
+void failure_not_a_builtin2() __attribute__((diagnose_as_builtin("abc"))) {} // expected-error{{'diagnose_as_builtin' attribute requires parameter 1 to be a builtin function}}
+
+void failure_parameter_index_bounds(void *dst, const void *src) __attribute__((diagnose_as_builtin(__builtin_memcpy, 1, 2, 3))) {} // expected-error{{'diagnose_as_builtin' attribute references parameter 3, but the function 'failure_parameter_index_bounds' has only 2 parameters}}
+
+void failure_parameter_types(double dst, const void *src, size_t count) __attribute__((diagnose_as_builtin(__builtin_memcpy, 1, 2, 3))) {} // expected-error{{'diagnose_as_builtin' attribute parameter types do not match: parameter 1 of function 'failure_parameter_types' has type 'double', but parameter 1 of function '__builtin_memcpy' has type 'void *'}}
+
+void to_redeclare(void *dst, const void *src, size_t count);
+
+void use_to_redeclare() {
+  char src[10];
+  char dst[9];
+  // We shouldn't get an error yet.
+  to_redeclare(dst, src, 10);
+}
+
+void to_redeclare(void *dst, const void *src, size_t count) __attribute((diagnose_as_builtin(__builtin_memcpy, 1, 2, 3)));
+
+void error_to_redeclare() {
+  char src[10];
+  char dst[9];
+  // Now we get an error.
+  to_redeclare(dst, src, 10); // expected-warning {{'memcpy' will always overflow; destination buffer has size 9, but size argument is 10}}
+}
+
+// Make sure this works even with extra qualifiers and the pass_object_size attribute.
+void *memcpy2(void *const dst __attribute__((pass_object_size(0))), const void *src, size_t copy_amount) __attribute((diagnose_as_builtin(__builtin_memcpy, 1, 2, 3)));
+
+void call_memcpy2() {
+  char buf1[10];
+  char buf2[11];
+  memcpy2(buf1, buf2, 11); // expected-warning {{'memcpy' will always overflow; destination buffer has size 10, but size argument is 11}}
+}
+
+// We require the types to be identical, modulo canonicalization and qualifiers.
+// Maybe this could be relaxed if it proves too restrictive.
+void failure_type(void *dest, char val, size_t n) __attribute__((diagnose_as_builtin(__builtin_memset, 1, 2, 3))) {} // expected-error {{'diagnose_a

[PATCH] D115320: Avoid setting tbaa information on store of return type of call to inline assember

2021-12-13 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir updated this revision to Diff 393945.
schittir added a comment.

Changing test's CHECK lines


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

https://reviews.llvm.org/D115320

Files:
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/avoidTBAAonASMstore.cpp


Index: clang/test/CodeGen/avoidTBAAonASMstore.cpp
===
--- /dev/null
+++ clang/test/CodeGen/avoidTBAAonASMstore.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -O2 -disable-llvm-passes 
-fasm-blocks %s -emit-llvm -o - | FileCheck --check-prefix=STORE-LINE %s
+double foo(double z) {
+// CHECK-LABEL: define{{.*}} double @_Z3food
+   unsigned short ControlWord;
+   __asm { fnstcw word ptr[ControlWord] };
+// STORE-LINE: store i64 %{{.*}}, i64* %{{.*}},
+// STORE-LINE-NOT: align 4, !tbaa
+// STORE-LINE-SAME: align 4
+   return z;
+}
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -2504,6 +2504,13 @@
 BaseInfo, TBAAInfo);
   }
 
+  LValue
+  MakeAddrLValueWithoutTBAA(Address Addr, QualType T,
+AlignmentSource Source = AlignmentSource::Type) {
+return LValue::MakeAddr(Addr, T, getContext(), LValueBaseInfo(Source),
+TBAAAccessInfo());
+  }
+
   LValue MakeNaturalAlignPointeeAddrLValue(llvm::Value *V, QualType T);
   LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T);
 
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -2454,7 +2454,7 @@
 const ABIArgInfo &RetAI = CurFnInfo->getReturnInfo();
 if (RetAI.isDirect() || RetAI.isExtend()) {
   // Make a fake lvalue for the return value slot.
-  LValue ReturnSlot = MakeAddrLValue(ReturnValue, FnRetTy);
+  LValue ReturnSlot = MakeAddrLValueWithoutTBAA(ReturnValue, FnRetTy);
   CGM.getTargetCodeGenInfo().addReturnRegisterOutputs(
   *this, ReturnSlot, Constraints, ResultRegTypes, ResultTruncRegTypes,
   ResultRegDests, AsmString, S.getNumOutputs());


Index: clang/test/CodeGen/avoidTBAAonASMstore.cpp
===
--- /dev/null
+++ clang/test/CodeGen/avoidTBAAonASMstore.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -O2 -disable-llvm-passes -fasm-blocks %s -emit-llvm -o - | FileCheck --check-prefix=STORE-LINE %s
+double foo(double z) {
+// CHECK-LABEL: define{{.*}} double @_Z3food
+	unsigned short ControlWord;
+	__asm { fnstcw word ptr[ControlWord] };
+// STORE-LINE: store i64 %{{.*}}, i64* %{{.*}},
+// STORE-LINE-NOT: align 4, !tbaa
+// STORE-LINE-SAME: align 4
+	return z;
+}
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -2504,6 +2504,13 @@
 BaseInfo, TBAAInfo);
   }
 
+  LValue
+  MakeAddrLValueWithoutTBAA(Address Addr, QualType T,
+AlignmentSource Source = AlignmentSource::Type) {
+return LValue::MakeAddr(Addr, T, getContext(), LValueBaseInfo(Source),
+TBAAAccessInfo());
+  }
+
   LValue MakeNaturalAlignPointeeAddrLValue(llvm::Value *V, QualType T);
   LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T);
 
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -2454,7 +2454,7 @@
 const ABIArgInfo &RetAI = CurFnInfo->getReturnInfo();
 if (RetAI.isDirect() || RetAI.isExtend()) {
   // Make a fake lvalue for the return value slot.
-  LValue ReturnSlot = MakeAddrLValue(ReturnValue, FnRetTy);
+  LValue ReturnSlot = MakeAddrLValueWithoutTBAA(ReturnValue, FnRetTy);
   CGM.getTargetCodeGenInfo().addReturnRegisterOutputs(
   *this, ReturnSlot, Constraints, ResultRegTypes, ResultTruncRegTypes,
   ResultRegDests, AsmString, S.getNumOutputs());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109981: [Diagnostics] Don't drop a statically set NoWarningAsError flag during option processing

2021-12-13 Thread Wolfgang Pieb via Phabricator via cfe-commits
wolfgangp added a comment.

ping ...


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

https://reviews.llvm.org/D109981

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


[PATCH] D115320: Avoid setting tbaa information on store of return type of call to inline assember

2021-12-13 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir updated this revision to Diff 393948.
schittir added a comment.

Fix test format


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

https://reviews.llvm.org/D115320

Files:
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/avoidTBAAonASMstore.cpp


Index: clang/test/CodeGen/avoidTBAAonASMstore.cpp
===
--- /dev/null
+++ clang/test/CodeGen/avoidTBAAonASMstore.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -O2 -disable-llvm-passes 
-fasm-blocks %s -emit-llvm -o - | FileCheck --check-prefix=STORE-LINE %s
+double foo(double z) {
+  // CHECK-LABEL: define{{.*}} double @_Z3food
+  unsigned short ControlWord;
+  __asm { fnstcw word ptr[ControlWord]}
+  ;
+  // STORE-LINE: store i64 %{{.*}}, i64* %{{.*}},
+  // STORE-LINE-NOT: align 4, !tbaa
+  // STORE-LINE-SAME: align 4
+  return z;
+}
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -2504,6 +2504,13 @@
 BaseInfo, TBAAInfo);
   }
 
+  LValue
+  MakeAddrLValueWithoutTBAA(Address Addr, QualType T,
+AlignmentSource Source = AlignmentSource::Type) {
+return LValue::MakeAddr(Addr, T, getContext(), LValueBaseInfo(Source),
+TBAAAccessInfo());
+  }
+
   LValue MakeNaturalAlignPointeeAddrLValue(llvm::Value *V, QualType T);
   LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T);
 
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -2454,7 +2454,7 @@
 const ABIArgInfo &RetAI = CurFnInfo->getReturnInfo();
 if (RetAI.isDirect() || RetAI.isExtend()) {
   // Make a fake lvalue for the return value slot.
-  LValue ReturnSlot = MakeAddrLValue(ReturnValue, FnRetTy);
+  LValue ReturnSlot = MakeAddrLValueWithoutTBAA(ReturnValue, FnRetTy);
   CGM.getTargetCodeGenInfo().addReturnRegisterOutputs(
   *this, ReturnSlot, Constraints, ResultRegTypes, ResultTruncRegTypes,
   ResultRegDests, AsmString, S.getNumOutputs());


Index: clang/test/CodeGen/avoidTBAAonASMstore.cpp
===
--- /dev/null
+++ clang/test/CodeGen/avoidTBAAonASMstore.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -O2 -disable-llvm-passes -fasm-blocks %s -emit-llvm -o - | FileCheck --check-prefix=STORE-LINE %s
+double foo(double z) {
+  // CHECK-LABEL: define{{.*}} double @_Z3food
+  unsigned short ControlWord;
+  __asm { fnstcw word ptr[ControlWord]}
+  ;
+  // STORE-LINE: store i64 %{{.*}}, i64* %{{.*}},
+  // STORE-LINE-NOT: align 4, !tbaa
+  // STORE-LINE-SAME: align 4
+  return z;
+}
Index: clang/lib/CodeGen/CodeGenFunction.h
===
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -2504,6 +2504,13 @@
 BaseInfo, TBAAInfo);
   }
 
+  LValue
+  MakeAddrLValueWithoutTBAA(Address Addr, QualType T,
+AlignmentSource Source = AlignmentSource::Type) {
+return LValue::MakeAddr(Addr, T, getContext(), LValueBaseInfo(Source),
+TBAAAccessInfo());
+  }
+
   LValue MakeNaturalAlignPointeeAddrLValue(llvm::Value *V, QualType T);
   LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T);
 
Index: clang/lib/CodeGen/CGStmt.cpp
===
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -2454,7 +2454,7 @@
 const ABIArgInfo &RetAI = CurFnInfo->getReturnInfo();
 if (RetAI.isDirect() || RetAI.isExtend()) {
   // Make a fake lvalue for the return value slot.
-  LValue ReturnSlot = MakeAddrLValue(ReturnValue, FnRetTy);
+  LValue ReturnSlot = MakeAddrLValueWithoutTBAA(ReturnValue, FnRetTy);
   CGM.getTargetCodeGenInfo().addReturnRegisterOutputs(
   *this, ReturnSlot, Constraints, ResultRegTypes, ResultTruncRegTypes,
   ResultRegDests, AsmString, S.getNumOutputs());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115441: [X86][MS] Add 80bit long double support for Windows

2021-12-13 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D115441#3188526 , @mstorsjo wrote:

> In D115441#3188172 , @pengfei wrote:
>
>>> In GCC on Windows (and clang in mingw mode), long double is always 80 bit 
>>> on x86. (On i386, sizeof(long double) == 12, while on x86_64 it's 16.)
>>
>> How about the alignment? I can see on the i386 Linux case, the alignment is 
>> 4, I assume it is also 4 for GCC on Windows, right?
>
> Yes, it's 4 for i386 in GCC on Windows too (and Clang in mingw mode). For 
> x86_64, both sizeof and alignof are 16.

Yeah, the alignment is the key thing which is generating a lot of the 
MSVC-specific complexity.

I have a thought. Why do you need to change the LLVM data layout at all? 
Clang's record layout is distinct from LLVM's data layout. This is similar to 
how `-malign-double` works, which does not affect LLVM's data layout, it is 
entirely a frontend change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115441

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


[PATCH] D114095: [clang][lex] Include tracking: simplify and move to preprocessor

2021-12-13 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

In D114095#3188557 , @jansvoboda11 
wrote:

> Given that, I think we should commit this patch with ID vectors, even though 
> in isolation (without D112915 ) it's the 
> worse solution. WDYT?

I have to admit that I think ID vector code is easier to understand and the 
format is easier to understand. And if bitvector approach is more complicated 
but doesn't gain us much in efficiency, then I think it's not worth pursuing. 
Though I'm glad and grateful that you've tried bitvector approach, that's very 
helpful.

My preference is to use ID vectors but I'm open to other opinions as I might be 
missing other trade-offs besides complexity and .pcm file size.

And I want to thank you for checking the sparseness of submodules and how with 
the bigger modules the impact of the sparseness becomes more pronounced.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114095

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


[PATCH] D115441: [X86][MS] Add 80bit long double support for Windows

2021-12-13 Thread John Reagan via Phabricator via cfe-commits
JohnReagan added a comment.

Does any of this impact the -f128 support?  We use f128 x-float on OpenVMS.  
We've historically only aligned on 8-byte boundaries for legacy reasons (I'm 
not opposed to having my own mods to control the record layout and/or data 
layout)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115441

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


[PATCH] D115650: [clangd] Disable support for clang-tidy suppression blocks (NOLINTBEGIN)

2021-12-13 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

The implementation is very inefficient and we pay the cost even when the 
feature is not used


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115650

Files:
  clang-tools-extra/clangd/ParsedAST.cpp


Index: clang-tools-extra/clangd/ParsedAST.cpp
===
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -395,7 +395,8 @@
   if (IsInsideMainFile &&
   tidy::shouldSuppressDiagnostic(DiagLevel, Info, *CTContext,
  TidySuppressedErrors,
- /*AllowIO=*/false)) {
+ /*AllowIO=*/false,
+ /*EnableNolintBlocks=*/false)) {
 // FIXME: should we expose the suppression error (invalid use of
 // NOLINT comments)?
 return DiagnosticsEngine::Ignored;


Index: clang-tools-extra/clangd/ParsedAST.cpp
===
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -395,7 +395,8 @@
   if (IsInsideMainFile &&
   tidy::shouldSuppressDiagnostic(DiagLevel, Info, *CTContext,
  TidySuppressedErrors,
- /*AllowIO=*/false)) {
+ /*AllowIO=*/false,
+ /*EnableNolintBlocks=*/false)) {
 // FIXME: should we expose the suppression error (invalid use of
 // NOLINT comments)?
 return DiagnosticsEngine::Ignored;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115611: [X86][BF16] delete `typedef unsigned short __bfloat16`

2021-12-13 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/lib/Headers/avx512vlbf16intrin.h:416
 ///and fraction field is truncated to 7 bits.
-static __inline__ __bfloat16 __DEFAULT_FN_ATTRS128 _mm_cvtness_sbh(float __A) {
+static __inline__ short __DEFAULT_FN_ATTRS128 _mm_cvtness_sbh(float __A) {
   __v4sf __V = {__A, 0, 0, 0};

I'm not sure if this change is a good idea this late. Users could have been 
dependent on it being an unsigned value before. I believe this changes the 
behavior of this code

```
int result = _mm_cvtness_sbh(X)
```

Previously it would have zero extended, but now it will sign extend.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115611

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


[PATCH] D115647: [clang-format] FixNamespaceComments does not understand namespace aliases

2021-12-13 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added inline comments.



Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:27
 // Returns "" for anonymous namespace.
-std::string computeName(const FormatToken *NamespaceTok) {
+bool computeName(const FormatToken *NamespaceTok, std::string &name) {
   assert(NamespaceTok &&

It seems to be a good place for optional, nope?



Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:183
   const FormatToken *NamespaceTok = AnnotatedLines[StartLineIndex]->First;
   if (NamespaceTok->is(tok::l_brace)) {
 // "namespace" keyword can be on the line preceding '{', e.g. in styles

Maybe just checking previous (non-comment) token to be not a semicolon would be 
enough?



Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:250
+std::string NamespaceName;
+if (!computeName(NamespaceTok, NamespaceName)) {
+  // Its likely a namespace alias.

As an alternative, couldn't we avoid computing the name for namespace aliases 
by searching the next semicolon (don't compute) or l_brace (compute)?



Comment at: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp:1189
+
+TEST_F(ShortNamespaceLinesTest, NameSpaceAlias) {
+  auto Style = getLLVMStyle();

Nit: `NamespaceAlias` with small 's'.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115647

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


[PATCH] D115248: [clang] Fix PR28101

2021-12-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/Parse/ParseDecl.cpp:6485-6488
+if (getLangOpts().CPlusPlus && !D.getIdentifier() &&
+D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId &&
+D.getContext() == DeclaratorContext::Member)
+  D.SetIdentifier(D.getName().TemplateId->Name, D.getName().getBeginLoc());

This fix looks incredibly specific to the bug report, how does it handle other 
situations, like:
```
template  typename U>
class PR28101 {
public:
  PR28101(void *) {}
  T(PR28101>) {} // Do we err here?
};

template 
struct S {};

PR28101 foo() { return PR28101(nullptr); }
```



Comment at: clang/test/CXX/temp/temp.decls/temp.mem/p3.cpp:12-13
+  PR28101(void *) {}
+  T(PR28101){}; // expected-error{{member 'PR28101' has the same name as 
its class}} \
+  // expected-error{{member 'PR28101' has the same name as its class}}
+};

It seems incorrect that we're issuing the same diagnostic twice. Is this 
because of template instantiation, or some other reason?



Comment at: clang/test/CXX/temp/temp.decls/temp.mem/p3.cpp:16
+
+PR28101 foo() { return new int; } // expected-note{{in instantiation of 
template class 'PR28101' requested here}}

The test location is a bit novel -- [temp.mem]p3 is "A member function template 
shall not be declared virtual." and I don't see anything related to p3 in this 
test. I think the test case is reasonable enough, but it should probably live 
in SemaCXX instead of here.


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

https://reviews.llvm.org/D115248

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


[PATCH] D115049: Fall back on Android triple w/o API level for runtimes search

2021-12-13 Thread Collin Baker via Phabricator via cfe-commits
collinbaker updated this revision to Diff 393978.
collinbaker added a comment.

- Address comments
- Fix VEToolchain build error
- Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115049

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/VEToolchain.cpp
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-linux-android/.keep
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-linux-android/libclang_rt.builtins.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-linux-android21/.keep
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-linux-android21/libclang_rt.builtins.a
  clang/test/Driver/linux-per-target-runtime-dir.c

Index: clang/test/Driver/linux-per-target-runtime-dir.c
===
--- clang/test/Driver/linux-per-target-runtime-dir.c
+++ clang/test/Driver/linux-per-target-runtime-dir.c
@@ -25,3 +25,21 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-X8664 %s
 // CHECK-FILE-NAME-X8664: lib{{/|\\}}x86_64-unknown-linux-gnu{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 \
+// RUN: --target=aarch64-unknown-linux-android21 \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-ANDROID21 %s
+// CHECK-FILE-NAME-ANDROID21: lib{{/|\\}}aarch64-unknown-linux-android21{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 \
+// RUN: --target=aarch64-unknown-linux-android23 \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-ANDROID23 %s
+// CHECK-FILE-NAME-ANDROID23: lib{{/|\\}}aarch64-unknown-linux-android{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 \
+// RUN: --target=aarch64-unknown-linux-android \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-ANDROID %s
+// CHECK-FILE-NAME-ANDROID: lib{{/|\\}}aarch64-unknown-linux-android{{/|\\}}libclang_rt.builtins.a
Index: clang/lib/Driver/ToolChains/VEToolchain.cpp
===
--- clang/lib/Driver/ToolChains/VEToolchain.cpp
+++ clang/lib/Driver/ToolChains/VEToolchain.cpp
@@ -48,7 +48,8 @@
   //   ${BINPATH}/../lib/ve-unknown-linux-gnu, (== getStdlibPath)
   //   ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPath)
   //   ${SYSROOT}/opt/nec/ve/lib,
-  getFilePaths().push_back(getStdlibPath());
+  for (auto &Path : getStdlibPaths())
+getFilePaths().push_back(std::move(Path));
   getFilePaths().push_back(getArchSpecificLibPath());
   getFilePaths().push_back(computeSysRoot() + "/opt/nec/ve/lib");
 }
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -191,9 +191,11 @@
 
   auto FilePaths = [&](const Multilib &M) -> std::vector {
 std::vector FP;
-SmallString<128> P(getStdlibPath());
-llvm::sys::path::append(P, M.gccSuffix());
-FP.push_back(std::string(P.str()));
+for (const std::string &Path : getStdlibPaths()) {
+  SmallString<128> P(Path);
+  llvm::sys::path::append(P, M.gccSuffix());
+  FP.push_back(std::string(P.str()));
+}
 return FP;
   };
 
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -75,17 +75,16 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  std::string RuntimePath = getRuntimePath();
-  if (getVFS().exists(RuntimePath))
-getLibraryPaths().push_back(RuntimePath);
-
-  std::string StdlibPath = getStdlibPath();
-  if (getVFS().exists(StdlibPath))
-getFilePaths().push_back(StdlibPath);
+  auto addIfExists = [this](path_list &List, const std::string &Path) {
+if (getVFS().exists(Path))
+  List.push_back(Path);
+  };
 
-  std::string CandidateLibPath = getArchSpecificLibPath();
-  if (getVFS().exists(CandidateLibPath))
-getFilePaths().push_back(CandidateLibPath);
+  for (const auto &Path : getRuntimePaths())
+addIfExists(getLibraryPaths(), Path);
+  for (const auto &Path : getStdlibPaths())
+add

[PATCH] D115049: Fall back on Android triple w/o API level for runtimes search

2021-12-13 Thread Collin Baker via Phabricator via cfe-commits
collinbaker marked 2 inline comments as done.
collinbaker added inline comments.



Comment at: clang/lib/Driver/ToolChain.cpp:500
+  if (getTriple().isAndroid() &&
+  getTriple().getEnvironmentName() != "android") {
+llvm::outs() << getTriple().getEnvironmentName() << "\n";

thakis wrote:
> Why do you need the environment check?
This skips adding an extra path if the triple doesn't have an Android API level.

E.g. for the target triple aarch64-unknown-linux-android23, the environment 
name will be "android23". The condition will be true since "android23" != 
"android", and the extra path will be appended. If it had just been "android" 
it'll skip this step.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115049

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


[PATCH] D115648: [LTO] Ignore unreachable virtual functions in WPD in hybrid LTO

2021-12-13 Thread Mingming Liu via Phabricator via cfe-commits
luna updated this revision to Diff 393994.
luna added a comment.

Add unit test for thinlto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115648

Files:
  clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
  clang/test/CodeGen/thinlto-distributed-cfi.ll
  clang/test/CodeGen/thinlto-funcattr-prop.ll
  llvm/include/llvm/AsmParser/LLToken.h
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/AsmParser/LLLexer.cpp
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/test/Assembler/thinlto-summary.ll
  llvm/test/Bitcode/thinlto-function-summary-refgraph.ll
  llvm/test/Bitcode/thinlto-type-vcalls.ll
  llvm/test/ThinLTO/X86/Inputs/devirt_after_filtering_unreachable_lib.ll
  llvm/test/ThinLTO/X86/devirt_after_filtering_unreachable.ll
  llvm/test/ThinLTO/X86/dot-dumper.ll
  llvm/test/ThinLTO/X86/dot-dumper2.ll
  llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
  llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll

Index: llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
===
--- llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
+++ llvm/test/ThinLTO/X86/funcimport_alwaysinline.ll
@@ -23,4 +23,4 @@
 }
 
 attributes #0 = { alwaysinline nounwind uwtable }
-; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0
+; CHECK2: ^2 = gv: (guid: {{.*}}, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 1, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0
Index: llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
===
--- llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
+++ llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
@@ -48,9 +48,9 @@
 ; CHECK-DAG: attributes [[ATTR_NOUNWIND]] = { norecurse nounwind }
 ; CHECK-DAG: attributes [[ATTR_MAYTHROW]] = { norecurse }
 
-; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
-; SUMMARY-DAG: = gv: (name: "catchret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "cleanupret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "resume", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^{{.*}})), refs: (^{{.*}}
+; SUMMARY-DAG: = gv: (name: "catchret", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 1, hasUnknownCall: 0, mustBeUnreachable: 0), c

[PATCH] D115661: [clang][amdgpu] - Choose when to promote VarDecl to address space 4.

2021-12-13 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 created this revision.
estewart08 added a reviewer: JonChesterfield.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, kzhuravl.
estewart08 requested review of this revision.
Herald added subscribers: cfe-commits, wdng.
Herald added a project: clang.

There are instances where clang codegen creates stores to
address space 4 in ctors, which causes a crash in llc.
This store was being optimized out at opt levels > 0.

For example:

pragma omp declare target
static  const double log_smallx = log2(smallx);
pragma omp end declare target

This patch ensures that any global const that does not
have constant initialization stays in address space 1.

Note - a second patch is in the works where all global
constants are placed in address space 1 during
codegen and then the opt pass InferAdressSpaces
will promote to address space 4 where necessary.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115661

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
  clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp


Index: clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
===
--- clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
+++ clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
@@ -7,7 +7,7 @@
   static const int Foo = 123;
 };
 // X86: @_ZN1A3FooE ={{.*}} constant i32 123, align 4
-// AMD: @_ZN1A3FooE ={{.*}} addrspace(4) constant i32 123, align 4
+// AMD: @_ZN1A3FooE ={{.*}} addrspace(1) constant i32 123, align 4
 const int *p = &A::Foo; // emit available_externally
 const int A::Foo;   // convert to full definition
 
@@ -37,7 +37,7 @@
   // CXX11X86: @_ZN3Foo21ConstexprStaticMemberE = available_externally 
constant i32 42,
   // CXX17X86: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr constant i32 42,
   // CXX11AMD: @_ZN3Foo21ConstexprStaticMemberE = available_externally 
addrspace(4) constant i32 42,
-  // CXX17AMD: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr addrspace(4) 
constant i32 42,
+  // CXX17AMD: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr addrspace(4) 
constant i32 42, comdat, align 4
   static constexpr int ConstexprStaticMember = 42;
   // X86: @_ZN3Foo17ConstStaticMemberE = available_externally constant i32 43,
   // AMD: @_ZN3Foo17ConstStaticMemberE = available_externally addrspace(4) 
constant i32 43,
Index: clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
===
--- clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -78,12 +78,12 @@
 // X86: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal 
global [2 x i32] zeroinitializer, align 4
 // X86: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal 
constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
 // AMDGCN: @_ZN15partly_constant1kE ={{.*}} addrspace(1) global i32 0, align 4
-// AMDGCN: @_ZN15partly_constant2ilE ={{.*}} addrspace(4) global {{.*}} null, 
align 8
-// AMDGCN: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE_]] = internal 
addrspace(4) global {{.*}} zeroinitializer, align 8
-// AMDGCN: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE0_]] = internal 
addrspace(4) global [3 x {{.*}}] zeroinitializer, align 8
-// AMDGCN: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE1_]] = internal 
addrspace(4) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
-// AMDGCN: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal 
addrspace(4) global [2 x i32] zeroinitializer, align 4
-// AMDGCN: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal 
addrspace(4) constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
+// AMDGCN: @_ZN15partly_constant2ilE ={{.*}} addrspace(1) global {{.*}} null, 
align 8
+// AMDGCN: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE_]] = internal 
addrspace(1) global {{.*}} zeroinitializer, align 8
+// AMDGCN: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE0_]] = internal 
addrspace(1) global [3 x {{.*}}] zeroinitializer, align 8
+// AMDGCN: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE1_]] = internal 
addrspace(1) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
+// AMDGCN: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal 
addrspace(1) global [2 x i32] zeroinitializer, align 4
+// AMDGCN: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal 
addrspace(1) constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
 
 // X86: @[[REFTMP1:.*]] = private constant [2 x i32] [i32 42, i32 43], align 4
 // X86: @[[REFTMP2:.*]] = private constant [3 x %{{.*}}] [%{{.*}} { i32 1 }, 
%{{.*}} { i32 2 }, %{{.*}} { i32 3 }], align 4
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@

[PATCH] D115661: [clang][amdgpu] - Choose when to promote VarDecl to address space 4.

2021-12-13 Thread Ethan Stewart via Phabricator via cfe-commits
estewart08 updated this revision to Diff 394002.
estewart08 added a comment.

Resubmit patch with lint.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115661

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
  clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp


Index: clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
===
--- clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
+++ clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
@@ -7,7 +7,7 @@
   static const int Foo = 123;
 };
 // X86: @_ZN1A3FooE ={{.*}} constant i32 123, align 4
-// AMD: @_ZN1A3FooE ={{.*}} addrspace(4) constant i32 123, align 4
+// AMD: @_ZN1A3FooE ={{.*}} addrspace(1) constant i32 123, align 4
 const int *p = &A::Foo; // emit available_externally
 const int A::Foo;   // convert to full definition
 
@@ -37,7 +37,7 @@
   // CXX11X86: @_ZN3Foo21ConstexprStaticMemberE = available_externally 
constant i32 42,
   // CXX17X86: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr constant i32 42,
   // CXX11AMD: @_ZN3Foo21ConstexprStaticMemberE = available_externally 
addrspace(4) constant i32 42,
-  // CXX17AMD: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr addrspace(4) 
constant i32 42,
+  // CXX17AMD: @_ZN3Foo21ConstexprStaticMemberE = linkonce_odr addrspace(4) 
constant i32 42, comdat, align 4
   static constexpr int ConstexprStaticMember = 42;
   // X86: @_ZN3Foo17ConstStaticMemberE = available_externally constant i32 43,
   // AMD: @_ZN3Foo17ConstStaticMemberE = available_externally addrspace(4) 
constant i32 43,
Index: clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
===
--- clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -78,12 +78,12 @@
 // X86: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal 
global [2 x i32] zeroinitializer, align 4
 // X86: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal 
constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
 // AMDGCN: @_ZN15partly_constant1kE ={{.*}} addrspace(1) global i32 0, align 4
-// AMDGCN: @_ZN15partly_constant2ilE ={{.*}} addrspace(4) global {{.*}} null, 
align 8
-// AMDGCN: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE_]] = internal 
addrspace(4) global {{.*}} zeroinitializer, align 8
-// AMDGCN: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE0_]] = internal 
addrspace(4) global [3 x {{.*}}] zeroinitializer, align 8
-// AMDGCN: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE1_]] = internal 
addrspace(4) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
-// AMDGCN: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal 
addrspace(4) global [2 x i32] zeroinitializer, align 4
-// AMDGCN: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal 
addrspace(4) constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
+// AMDGCN: @_ZN15partly_constant2ilE ={{.*}} addrspace(1) global {{.*}} null, 
align 8
+// AMDGCN: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE_]] = internal 
addrspace(1) global {{.*}} zeroinitializer, align 8
+// AMDGCN: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE0_]] = internal 
addrspace(1) global [3 x {{.*}}] zeroinitializer, align 8
+// AMDGCN: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE1_]] = internal 
addrspace(1) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
+// AMDGCN: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal 
addrspace(1) global [2 x i32] zeroinitializer, align 4
+// AMDGCN: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal 
addrspace(1) constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
 
 // X86: @[[REFTMP1:.*]] = private constant [2 x i32] [i32 42, i32 43], align 4
 // X86: @[[REFTMP2:.*]] = private constant [3 x %{{.*}}] [%{{.*}} { i32 1 }, 
%{{.*}} { i32 2 }, %{{.*}} { i32 3 }], align 4
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -9362,7 +9362,9 @@
   if (AddrSpace != LangAS::Default)
 return AddrSpace;
 
-  if (CGM.isTypeConstant(D->getType(), false)) {
+  // Only promote to address space 4 if VarDecl has constant initialization.
+  if (CGM.isTypeConstant(D->getType(), false) &&
+  D->hasConstantInitialization()) {
 if (auto ConstAS = CGM.getTarget().getConstantAddressSpace())
   return ConstAS.getValue();
   }


Index: clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
===
--- clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
+++ clang/test/CodeGenCXX/cxx11-extern-constexpr.cpp
@@ -7,7 +7,7 @@
   static const int Foo = 123;
 };
 // X8

[PATCH] D108694: [RISCV] Add the zvl extension according to the v1.0 spec

2021-12-13 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/lib/Support/RISCVISAInfo.cpp:714
 void RISCVISAInfo::updateImplication() {
+  const StringMap> Implications = {
+  {"v", {"zvlsseg", "zvl128b"}},

I think I'd like to see this as a static data structure rather than building a 
StringMap on the fly.

Maybe like

```
static const char *zvl64bimplied[] = { "zvl32b" };
static const char *zvl128bimplied[] = { "zvl64b" };
...

struct ImpliedEntry = {
  StringLiteral Name;
  ArrayRef ImpliedExtensions;
};

static constexpr ImpliedEntry ImpliedTable[] = {
  { "zvl64b", zvl64bimplied },
  { "zvl128b", zvl128implied },
  ...
};
```

You can then use std::lower_bound to search the ImpliedTable to find the 
correct row of ImpliedTable. I haven't tested this. Maybe I'll put up a patch 
on the existing V implications as a proof of concept.



Comment at: llvm/lib/Support/RISCVISAInfo.cpp:782
+if (IsZvlExt) {
+  ExtName.consume_back("b");
+  unsigned ZvlLen;

I think we should check the return value from consume_back and getAsInteger to 
make sure we really parsed what we think we parsed. That will prevent surprises 
if a new extension comes along that also starts with "zvl"



Comment at: llvm/lib/Target/RISCV/RISCVSubtarget.cpp:136
   assert((RVVVectorBitsMin == 0 ||
-  (RVVVectorBitsMin >= 128 && RVVVectorBitsMax <= 65536 &&
+  (RVVVectorBitsMin >= 64 && RVVVectorBitsMax <= 65536 &&
isPowerOf2_32(RVVVectorBitsMin))) &&

This needs the same FIXME as above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108694

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


[PATCH] D115661: [clang][amdgpu] - Choose when to promote VarDecl to address space 4.

2021-12-13 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

There's no real advantage to using addrspace(4) at all


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115661

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


[PATCH] D115661: [clang][amdgpu] - Choose when to promote VarDecl to address space 4.

2021-12-13 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

In D115661#3190041 , @arsenm wrote:

> There's no real advantage to using addrspace(4) at all

There are a few places where it's used as an optimization hint / as a crutch 
where we don't have a proper analysis. Fundamentally I would like to eliminate 
addrspace(4) eventually


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115661

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


[PATCH] D115647: [clang-format] FixNamespaceComments does not understand namespace aliases

2021-12-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments.



Comment at: clang/lib/Format/NamespaceEndCommentsFixer.cpp:59
+  // Namespace alias
+  if (Tok->isOneOf(tok::equal, tok::semi))
+return false;

Should only be equal, right?
Otherwise please add a test for semi.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115647

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


[PATCH] D115647: [clang-format] FixNamespaceComments does not understand namespace aliases

2021-12-13 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 394010.
MyDeveloperDay added a comment.

Look backwards from the { rather than scanning the namespace


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

https://reviews.llvm.org/D115647

Files:
  clang/lib/Format/NamespaceEndCommentsFixer.cpp
  clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp

Index: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -1185,6 +1185,82 @@
 "}\n",
 Style));
 }
+
+TEST_F(ShortNamespaceLinesTest, NamespaceAlias) {
+  auto Style = getLLVMStyle();
+
+  EXPECT_EQ("namespace n = nn;\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+fixNamespaceEndComments("namespace n = nn;\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+Style));
+
+  EXPECT_EQ("namespace n = nn; // comment\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+fixNamespaceEndComments("namespace n = nn; // comment\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+Style));
+
+  EXPECT_EQ("namespace n = nn; /* comment */\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+fixNamespaceEndComments("namespace n = nn; /* comment */\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+Style));
+
+  EXPECT_EQ(
+  "namespace n = nn; /* comment */ /* comment2 */\n"
+  "{\n"
+  "  int i;\n"
+  "  int j;\n"
+  "}\n",
+  fixNamespaceEndComments("namespace n = nn; /* comment */ /* comment2 */\n"
+  "{\n"
+  "  int i;\n"
+  "  int j;\n"
+  "}\n",
+  Style));
+
+  EXPECT_EQ("namespace n = nn; {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+fixNamespaceEndComments("namespace n = nn; {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+Style));
+  EXPECT_EQ("int foo;\n"
+"namespace n\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace n\n",
+fixNamespaceEndComments("int foo;\n"
+"namespace n\n"
+"{\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+Style));
+}
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/NamespaceEndCommentsFixer.cpp
===
--- clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -180,9 +180,17 @@
   if (NamespaceTok->is(tok::l_brace)) {
 // "namespace" keyword can be on the line preceding '{', e.g. in styles
 // where BraceWrapping.AfterNamespace is true.
-if (StartLineIndex > 0)
+if (StartLineIndex > 0) {
   NamespaceTok = AnnotatedLines[StartLineIndex - 1]->First;
+  const FormatToken *Previous = AnnotatedLines[StartLineIndex - 1]->Last;
+  while (Previous && Previous->is(tok::comment)) {
+Previous = Previous->Previous;
+  }
+  if (Previous && Previous->is(tok::semi))
+return nullptr;
+}
   }
+
   return NamespaceTok->getNamespaceToken();
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D113372: [Driver] Add CLANG_DEFAULT_PIE_ON_LINUX to emulate GCC --enable-default-pie

2021-12-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D113372#3188178 , @joerg wrote:

> Last update introduced a lot of unrelated changes? But the actual intended 
> change seems fine now.

The last update just did a renaming. I have checked that changes are all 
intended.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113372

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


[PATCH] D115647: [clang-format] FixNamespaceComments does not understand namespace aliases

2021-12-13 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius accepted this revision.
curdeius added a comment.
This revision is now accepted and ready to land.

LGTM!


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

https://reviews.llvm.org/D115647

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


[PATCH] D113372: [Driver] Add CLANG_DEFAULT_PIE_ON_LINUX to emulate GCC --enable-default-pie

2021-12-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay updated this revision to Diff 394015.
MaskRay added a comment.

Rename test/Driver/default-pie.c to linux-default-pie.c

clang-format a region.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113372

Files:
  clang/CMakeLists.txt
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Config/config.h.cmake
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/test/Driver/fsanitize.c
  clang/test/Driver/linux-default-pie.c
  clang/test/Driver/linux-ld.c
  clang/test/lit.cfg.py
  clang/test/lit.site.cfg.py.in
  llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
  utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h

Index: utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
===
--- utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
+++ utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
@@ -22,6 +22,9 @@
 /* Bug report URL. */
 #define BUG_REPORT_URL "https://bugs.llvm.org/";
 
+/* Default to -fPIE and -pie. */
+#define CLANG_DEFAULT_PIE_ON_LINUX 0
+
 /* Default linker to use. */
 #define CLANG_DEFAULT_LINKER ""
 
Index: llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
+++ llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
@@ -9,6 +9,7 @@
   output = "$target_gen_dir/config.h"
   values = [
 "BUG_REPORT_URL=https://bugs.llvm.org/";,
+"CLANG_DEFAULT_PIE_ON_LINUX=0",
 "CLANG_DEFAULT_LINKER=",
 "CLANG_DEFAULT_STD_C=",
 "CLANG_DEFAULT_STD_CXX=",
Index: clang/test/lit.site.cfg.py.in
===
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -22,6 +22,7 @@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.clang_arcmt = @CLANG_ENABLE_ARCMT@
+config.clang_default_pie_on_linux = "@CLANG_DEFAULT_PIE_ON_LINUX@"
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
 config.clang_staticanalyzer_z3 = "@LLVM_WITH_Z3@"
Index: clang/test/lit.cfg.py
===
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -121,6 +121,9 @@
 if config.has_plugins and config.llvm_plugin_ext:
 config.available_features.add('plugins')
 
+if config.clang_default_pie_on_linux == '1':
+config.available_features.add('default-pie-on-linux')
+
 # Set available features we allow tests to conditionalize on.
 #
 if config.clang_default_cxx_stdlib != '':
Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -1,4 +1,4 @@
-// UNSUPPORTED: system-windows
+// UNSUPPORTED: system-windows, default-pie-on-linux
 // General tests that ld invocations on Linux targets sane. Note that we use
 // sysroot to make these tests independent of the host system.
 //
Index: clang/test/Driver/linux-default-pie.c
===
--- /dev/null
+++ clang/test/Driver/linux-default-pie.c
@@ -0,0 +1,7 @@
+// REQUIRES: default-pie-on-linux
+/// Test -DCLANG_DEFAULT_PIE_ON_LINUX=on.
+
+// RUN: %clang -### --target=aarch64-linux-gnu %s 2>&1 | FileCheck %s --check-prefix=PIE2
+
+// PIE2: "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"
+// PIE2: "-pie"
Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ -1,3 +1,4 @@
+// UNSUPPORTED: default-pie-on-linux
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-trap=signed-integer-overflow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP2
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP
Index: clang/lib/Driver/ToolChains/Linux.cpp
===
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -663,8 +663,8 @@
 }
 
 bool Linux::isPIEDefault(const llvm::opt::ArgList &Args) const {
-  return getTriple().isAndroid() || getTriple().isMusl() ||
- getSanitizerArgs(Args).requiresPIE();
+  return CLANG_DEFAULT_PIE_ON_LINUX || getTriple().isAndroid() ||
+ getTriple().isMusl() || getSanitizerArgs(Args).requiresPIE();
 }
 
 bool Linux::IsAArch64OutlineAtomicsDefault(cons

[PATCH] D115580: [clang] [unitttests] Fix linking Basic test to LLVMTestingSupport

2021-12-13 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

> in order to fix linking when building clang against libclang

I am confused by building `clang against libclang`. libclang is the C library 
(`libclang.so` on ELF platforms). Do you mean `CLANG_LINK_CLANG_DYLIB` 
`libclang-cpp.so`? What's your cmake command line to trigger a linker error?


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

https://reviews.llvm.org/D115580

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


[PATCH] D113622: [wip] [analyzer] support ignoring use-after-free checking with reference_counted attribute

2021-12-13 Thread Chris D'Angelo via Phabricator via cfe-commits
chrisdangelo updated this revision to Diff 394017.
chrisdangelo added a comment.

These changes allow the analyzer to silence an issue discovered by 
MallocChecker if the SymRef or Statement in question is of a struct that has 
been declared with the compiler attribute annotation "reference_counted".

In the previous iteration of this diff, SymRef alone was used to determine the 
declared type, and if it was "reference_counted". Previously, if the SymRef was 
found to be "reference_counted" an analyzer warning would not be issued.

In the current changes, the static analyzer is more lenient and robust. Now, 
when a MallocChecker issue is discovered, each node in the bug path is visited, 
and any use of the pointer in question is checked for its type. If the type is 
found to be "reference_counted" the bug is marked invalid and ultimately not 
delivered to the developer. In the current changes, a pointer in question is 
checked for its type both by using the SymRef and using the type information in 
the AST.


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

https://reviews.llvm.org/D113622

Files:
  clang/include/clang/Basic/Attr.td
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/test/Analysis/malloc-annotations.c

Index: clang/test/Analysis/malloc-annotations.c
===
--- clang/test/Analysis/malloc-annotations.c
+++ clang/test/Analysis/malloc-annotations.c
@@ -30,6 +30,44 @@
 };
 struct stuff myglobalstuff;
 
+struct BMockStruct {
+  int number;
+};
+
+struct AMockStruct {
+  struct BMockStruct bMockStruct;
+};
+
+struct __attribute__((reference_counted)) AnnotatedRefCountedStruct {
+  int mockRefCount;
+  struct AnnotatedRefCountedStruct *mockNext;
+  struct StructContainingAnnotatedRefCountedStruct *unannotatedStructPtr;
+  struct AMockStruct aMockStruct;
+};
+
+struct StructContainingAnnotatedRefCountedStruct {
+  struct AnnotatedRefCountedStruct *refCountedStructPtr;
+  void *opaquePtr;
+  struct AMockStruct aMockStruct;
+};
+
+void my_use_after_free_internal(void *p);
+
+void my_use_after_free_external(void *p) {
+  my_use_after_free_internal(p);
+}
+
+typedef struct AnnotatedRefCountedStruct TypeDefAnnotatedRefCountedStruct;
+struct AnnotatedRefCountedStruct *CreateAnnotatedRefCountedStruct(void);
+TypeDefAnnotatedRefCountedStruct *CreateTypeDefAnnotatedRefCountedStruct(void);
+struct StructContainingAnnotatedRefCountedStruct *CreateStructContainingAnnotatedRefCountedStruct(void);
+typedef struct __attribute__((reference_counted)) UnknownStruct TypeDefUnknownStruct;
+TypeDefUnknownStruct *CreateTypeDefUnknownStruct(void);
+typedef struct __attribute__((reference_counted)) UnknownStruct *TypeDefUnknownStructRef;
+TypeDefUnknownStructRef CreateTypeDefUnknownStructRef(void);
+void *CreateUntypedPointer(void);
+void __attribute__((ownership_takes(malloc, 1))) my_typed_free(struct AnnotatedRefCountedStruct *);
+
 void f1() {
   int *p = malloc(12);
   return; // expected-warning{{Potential leak of memory pointed to by}}
@@ -273,3 +311,179 @@
   my_freeBoth(p, q);
 }
 
+struct AnnotatedRefCountedStruct *testAnnotatedRefCountedStructIgnoresUseAfterFree() {
+  struct AnnotatedRefCountedStruct *p = CreateAnnotatedRefCountedStruct();
+  my_free(p);
+
+  return p;
+}
+
+TypeDefAnnotatedRefCountedStruct *testTypeDefAnnotatedRefCountedStructIgnoresUseAfterFree() {
+  TypeDefAnnotatedRefCountedStruct *p = CreateTypeDefAnnotatedRefCountedStruct();
+  my_free(p);
+
+  return p;
+}
+
+void testTypeDefAnnotatedRefCountedStructIgnoresDoubleFree() {
+  TypeDefAnnotatedRefCountedStruct *p = CreateTypeDefAnnotatedRefCountedStruct();
+
+  my_free(p);
+  my_free(p);
+}
+
+void testCompileTimeAnnotatedTypeIsSufficientToIgnoreDoubleFree() {
+  TypeDefAnnotatedRefCountedStruct *p = CreateUntypedPointer();
+
+  my_free(p);
+  my_free(p);
+}
+
+void testCompileTimeAnnotatedTypeAtUseSiteIsSufficientToIgnoreDoubleFree() {
+  void *p = CreateUntypedPointer();
+
+  my_free(p);
+  my_typed_free(p);
+}
+
+void testCompileTimeDoubleCastTypeCheckingIgnoresUseAfterFree() {
+  TypeDefAnnotatedRefCountedStruct *p = CreateUntypedPointer();
+
+  my_free(p);
+  my_use_after_free_external(p);
+}
+
+TypeDefUnknownStruct *testTypeDefUnkownStructIgnoresUseAfterFree() {
+  TypeDefUnknownStruct *p = CreateTypeDefUnknownStruct();
+
+  my_free(p);
+  return p;
+}
+
+TypeDefUnknownStructRef testTypeDefUnkownStructRefIgnoresUseAfterFree() {
+  TypeDefUnknownStructRef ref = CreateTypeDefUnknownStructRef();
+
+  my_free(ref);
+  return ref;
+}
+
+TypeDefUnknownStruct *testTypeDefUnkownStructFromArrayIgnoresUseAfterFree() {
+  TypeDefUnknownStruct *p[1] = {};
+  p[0] = CreateTypeDefUnknownStruct();
+
+  my_free(p[0]);
+  return p[0];
+}
+
+struct AnnotatedRefCountedStruct *testCreateUntypedPointerWhereCallsiteKnowsIgnoreUseAfterFree() {
+  struct AnnotatedRefCountedStruct *p = CreateUntypedPointer();
+  my_free(p);
+
+  return p;
+}
+
+struct AnnotatedRefCountedS

[PATCH] D115561: [Clang][OpenMP] Add the support for atomic compare in parser

2021-12-13 Thread Mike Rice via Phabricator via cfe-commits
mikerice added a comment.

Note you'll want to add a line to flang/lib/Semantics/check-omp-structure.cpp 
for the new clause or the flang build will fail.

CHECK_SIMPLE_CLAUSE(Compare, OMPC_compare)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115561

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


[PATCH] D115580: [clang] [unitttests] Fix linking Basic test to LLVMTestingSupport

2021-12-13 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Yes, I'm sorry, I meant libclang-cpp.

  FAILED: unittests/Basic/BasicTests 
  : && /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -m32 -march=znver2 --param 
l1-cache-size=32 --param l1-cache-line-size=64 -O2 -pipe -frecord-gcc-switches 
-fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
-Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
-Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-class-memaccess 
-Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
-Wmisleading-indentation -fdiagnostics-color -ffunction-sections 
-fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -pedantic 
-Wno-long-long -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu
-Wl,--gc-sections unittests/Basic/CMakeFiles/BasicTests.dir/CharInfoTest.cpp.o 
unittests/Basic/CMakeFiles/BasicTests.dir/DarwinSDKInfoTest.cpp.o 
unittests/Basic/CMakeFiles/BasicTests.dir/DiagnosticTest.cpp.o 
unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o 
unittests/Basic/CMakeFiles/BasicTests.dir/FileManagerTest.cpp.o 
unittests/Basic/CMakeFiles/BasicTests.dir/LineOffsetMappingTest.cpp.o 
unittests/Basic/CMakeFiles/BasicTests.dir/SanitizersTest.cpp.o 
unittests/Basic/CMakeFiles/BasicTests.dir/SourceManagerTest.cpp.o -o 
unittests/Basic/BasicTests -L/usr/lib/llvm/14/lib 
-Wl,-rpath,/usr/lib/llvm/14/lib:/var/tmp/portage/sys-devel/clang-14.0.0./work/x/y/clang-abi_x86_32.x86/lib
  lib/libgtest_main.a  lib/libgtest.a  lib/libclang-cpp.so.14git  -lpthread  
/usr/lib/llvm/14/lib/libLLVM-14git.so && :
  
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: 
unittests/Basic/CMakeFiles/BasicTests.dir/FileManagerTest.cpp.o: in function 
`(anonymous namespace)::FileManagerTest_getBypassFile_Test::TestBody()':
  
FileManagerTest.cpp:(.text._ZN12_GLOBAL__N_134FileManagerTest_getBypassFile_Test8TestBodyEv+0x321):
 undefined reference to `llvm::detail::TakeError(llvm::Error)'
  
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: 
FileManagerTest.cpp:(.text._ZN12_GLOBAL__N_134FileManagerTest_getBypassFile_Test8TestBodyEv+0x797):
 undefined reference to `llvm::detail::TakeError(llvm::Error)'
  collect2: error: ld returned 1 exit status


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

https://reviews.llvm.org/D115580

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


[clang] 5c23acb - [NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive

2021-12-13 Thread Shilei Tian via cfe-commits

Author: Shilei Tian
Date: 2021-12-13T16:20:10-05:00
New Revision: 5c23acbc023fbb9fdc6c56f4d2212ecb0432874e

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

LOG: [NFC][Clang][OpenMP] Use switch-case statement to process clauses of 
atomic directive

This patch makes the process of clauses of atomic directive more clear
and preparation for the support for `atomic compare capture`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D115586

Added: 


Modified: 
clang/lib/Sema/SemaOpenMP.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 9672b0ac60a84..3d2e04b7752c7 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -10934,9 +10934,11 @@ StmtResult 
Sema::ActOnOpenMPAtomicDirective(ArrayRef Clauses,
   OpenMPClauseKind MemOrderKind = OMPC_unknown;
   SourceLocation MemOrderLoc;
   for (const OMPClause *C : Clauses) {
-if (C->getClauseKind() == OMPC_read || C->getClauseKind() == OMPC_write ||
-C->getClauseKind() == OMPC_update ||
-C->getClauseKind() == OMPC_capture) {
+switch (C->getClauseKind()) {
+case OMPC_read:
+case OMPC_write:
+case OMPC_update:
+case OMPC_capture: {
   if (AtomicKind != OMPC_unknown) {
 Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses)
 << SourceRange(C->getBeginLoc(), C->getEndLoc());
@@ -10946,12 +10948,13 @@ StmtResult 
Sema::ActOnOpenMPAtomicDirective(ArrayRef Clauses,
 AtomicKind = C->getClauseKind();
 AtomicKindLoc = C->getBeginLoc();
   }
+  break;
 }
-if (C->getClauseKind() == OMPC_seq_cst ||
-C->getClauseKind() == OMPC_acq_rel ||
-C->getClauseKind() == OMPC_acquire ||
-C->getClauseKind() == OMPC_release ||
-C->getClauseKind() == OMPC_relaxed) {
+case OMPC_seq_cst:
+case OMPC_acq_rel:
+case OMPC_acquire:
+case OMPC_release:
+case OMPC_relaxed: {
   if (MemOrderKind != OMPC_unknown) {
 Diag(C->getBeginLoc(), diag::err_omp_several_mem_order_clauses)
 << getOpenMPDirectiveName(OMPD_atomic) << 0
@@ -10962,6 +10965,10 @@ StmtResult 
Sema::ActOnOpenMPAtomicDirective(ArrayRef Clauses,
 MemOrderKind = C->getClauseKind();
 MemOrderLoc = C->getBeginLoc();
   }
+  break;
+}
+default:
+  llvm_unreachable("unknown clause is encountered");
 }
   }
   // OpenMP 5.0, 2.17.7 atomic Construct, Restrictions



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


[PATCH] D115586: [NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive

2021-12-13 Thread Shilei Tian via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c23acbc023f: [NFC][Clang][OpenMP] Use switch-case statement 
to process clauses of atomic… (authored by tianshilei1992).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115586

Files:
  clang/lib/Sema/SemaOpenMP.cpp


Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -10934,9 +10934,11 @@
   OpenMPClauseKind MemOrderKind = OMPC_unknown;
   SourceLocation MemOrderLoc;
   for (const OMPClause *C : Clauses) {
-if (C->getClauseKind() == OMPC_read || C->getClauseKind() == OMPC_write ||
-C->getClauseKind() == OMPC_update ||
-C->getClauseKind() == OMPC_capture) {
+switch (C->getClauseKind()) {
+case OMPC_read:
+case OMPC_write:
+case OMPC_update:
+case OMPC_capture: {
   if (AtomicKind != OMPC_unknown) {
 Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses)
 << SourceRange(C->getBeginLoc(), C->getEndLoc());
@@ -10946,12 +10948,13 @@
 AtomicKind = C->getClauseKind();
 AtomicKindLoc = C->getBeginLoc();
   }
+  break;
 }
-if (C->getClauseKind() == OMPC_seq_cst ||
-C->getClauseKind() == OMPC_acq_rel ||
-C->getClauseKind() == OMPC_acquire ||
-C->getClauseKind() == OMPC_release ||
-C->getClauseKind() == OMPC_relaxed) {
+case OMPC_seq_cst:
+case OMPC_acq_rel:
+case OMPC_acquire:
+case OMPC_release:
+case OMPC_relaxed: {
   if (MemOrderKind != OMPC_unknown) {
 Diag(C->getBeginLoc(), diag::err_omp_several_mem_order_clauses)
 << getOpenMPDirectiveName(OMPD_atomic) << 0
@@ -10962,6 +10965,10 @@
 MemOrderKind = C->getClauseKind();
 MemOrderLoc = C->getBeginLoc();
   }
+  break;
+}
+default:
+  llvm_unreachable("unknown clause is encountered");
 }
   }
   // OpenMP 5.0, 2.17.7 atomic Construct, Restrictions


Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -10934,9 +10934,11 @@
   OpenMPClauseKind MemOrderKind = OMPC_unknown;
   SourceLocation MemOrderLoc;
   for (const OMPClause *C : Clauses) {
-if (C->getClauseKind() == OMPC_read || C->getClauseKind() == OMPC_write ||
-C->getClauseKind() == OMPC_update ||
-C->getClauseKind() == OMPC_capture) {
+switch (C->getClauseKind()) {
+case OMPC_read:
+case OMPC_write:
+case OMPC_update:
+case OMPC_capture: {
   if (AtomicKind != OMPC_unknown) {
 Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses)
 << SourceRange(C->getBeginLoc(), C->getEndLoc());
@@ -10946,12 +10948,13 @@
 AtomicKind = C->getClauseKind();
 AtomicKindLoc = C->getBeginLoc();
   }
+  break;
 }
-if (C->getClauseKind() == OMPC_seq_cst ||
-C->getClauseKind() == OMPC_acq_rel ||
-C->getClauseKind() == OMPC_acquire ||
-C->getClauseKind() == OMPC_release ||
-C->getClauseKind() == OMPC_relaxed) {
+case OMPC_seq_cst:
+case OMPC_acq_rel:
+case OMPC_acquire:
+case OMPC_release:
+case OMPC_relaxed: {
   if (MemOrderKind != OMPC_unknown) {
 Diag(C->getBeginLoc(), diag::err_omp_several_mem_order_clauses)
 << getOpenMPDirectiveName(OMPD_atomic) << 0
@@ -10962,6 +10965,10 @@
 MemOrderKind = C->getClauseKind();
 MemOrderLoc = C->getBeginLoc();
   }
+  break;
+}
+default:
+  llvm_unreachable("unknown clause is encountered");
 }
   }
   // OpenMP 5.0, 2.17.7 atomic Construct, Restrictions
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D115670: Correct behavior of Vector boolean-operations, implement vector operator-

2021-12-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane created this revision.
erichkeane added reviewers: RKSimon, aaron.ballman, void, efriedma.
erichkeane requested review of this revision.

All of our boolean operations on vector types should be using something
like vcmpeqd, which results in a mask of '-1' for the 'truth' type. We are
currently instead using '1', which results in some incorrect
calculations when used later (note that it does NOT result in a boolean
vector, as that is not really a thing).

This patch corrects that 1 to be a -1, and updates the affected tests.
Additionally, in order to simplify changing of the tests, this ALSo
implements operator-, which simply negates all values of the vector
type.


https://reviews.llvm.org/D115670

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/constexpr-vectors.cpp

Index: clang/test/SemaCXX/constexpr-vectors.cpp
===
--- clang/test/SemaCXX/constexpr-vectors.cpp
+++ clang/test/SemaCXX/constexpr-vectors.cpp
@@ -204,35 +204,35 @@
 
   constexpr auto w = FourCharsVecSize{1, 2, 3, 4} <
  FourCharsVecSize{4, 3, 2, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto x = FourCharsVecSize{1, 2, 3, 4} >
  FourCharsVecSize{4, 3, 2, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto y = FourCharsVecSize{1, 2, 3, 4} <=
  FourCharsVecSize{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto z = FourCharsVecSize{1, 2, 3, 4} >=
  FourCharsVecSize{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto A = FourCharsVecSize{1, 2, 3, 4} ==
  FourCharsVecSize{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto B = FourCharsVecSize{1, 2, 3, 4} !=
  FourCharsVecSize{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
 
   constexpr auto C = FourCharsVecSize{1, 2, 3, 4} < 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto D = FourCharsVecSize{1, 2, 3, 4} > 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto E = FourCharsVecSize{1, 2, 3, 4} <= 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto F = FourCharsVecSize{1, 2, 3, 4} >= 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto G = FourCharsVecSize{1, 2, 3, 4} == 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto H = FourCharsVecSize{1, 2, 3, 4} != 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
 
   constexpr auto I = FourCharsVecSize{1, 2, 3, 4} &
  FourCharsVecSize{4, 3, 2, 1};
@@ -277,10 +277,12 @@
   constexpr auto Y = CmpSub(a, b);
   // CHECK: store <4 x i8> 
 
-  constexpr auto Z = CmpLSH(a, H);
+  constexpr auto InvH = -H;
+  // CHECK: store <4 x i8> 
+  constexpr auto Z = CmpLSH(a, InvH);
   // CHECK: store <4 x i8> 
 
-  constexpr auto aa = CmpRSH(a, H);
+  constexpr auto aa = CmpRSH(a, InvH);
   // CHECK: store <4 x i8> 
 
   constexpr auto ab = CmpBinAnd(a, b);
@@ -348,35 +350,35 @@
 
   constexpr auto w = FourCharsExtVec{1, 2, 3, 4} <
  FourCharsExtVec{4, 3, 2, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto x = FourCharsExtVec{1, 2, 3, 4} >
  FourCharsExtVec{4, 3, 2, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto y = FourCharsExtVec{1, 2, 3, 4} <=
  FourCharsExtVec{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto z = FourCharsExtVec{1, 2, 3, 4} >=
  FourCharsExtVec{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto A = FourCharsExtVec{1, 2, 3, 4} ==
  FourCharsExtVec{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto B = FourCharsExtVec{1, 2, 3, 4} !=
  FourCharsExtVec{4, 3, 3, 1};
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
 
   constexpr auto C = FourCharsExtVec{1, 2, 3, 4} < 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto D = FourCharsExtVec{1, 2, 3, 4} > 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto E = FourCharsExtVec{1, 2, 3, 4} <= 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto F = FourCharsExtVec{1, 2, 3, 4} >= 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto G = FourCharsExtVec{1, 2, 3, 4} == 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
   constexpr auto H = FourCharsExtVec{1, 2, 3, 4} != 3;
-  // CHECK: store <4 x i8> 
+  // CHECK: store <4 x i8> 
 
   constexpr auto I = FourCharsExtVec{1, 2, 3, 4} &
  FourCharsExtVec{4, 3, 2, 1};
@@ 

[PATCH] D115670: Correct behavior of Vector boolean-operations, implement vector operator-

2021-12-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

Note I am adding the folks who were added as reviewers the last time I did 
vector constexpr work: https://reviews.llvm.org/D79755

I again looked into operator[] to simplify things, but the 'LValueBase' stuff 
(seemingly required to do something like: VecTy[3] = 1;) is a little 
convoluted/tough to figure out and might be a fairly sizable 'touch'.


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

https://reviews.llvm.org/D115670

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


[PATCH] D115661: [clang][amdgpu] - Choose when to promote VarDecl to address space 4.

2021-12-13 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Patch looks ok to me. This will fix the miscompile (we end up with a store to 
addrspace(4) at present) without upsetting whatever hacks rely on addrspace(4). 
@arsenm reasonable as a point fix?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115661

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


  1   2   >