Re: [cfe-users] .deb package for LibC++

2017-02-13 Thread Duncan P. N. Exon Smith via cfe-users
+Eric

Eric, do you know?

> On 2017-Feb-12, at 13:43, Michal Jaszczyk via cfe-users 
>  wrote:
> 
> Hey,
> 
> I'm trying to set up my Ubuntu Yakkety dev environment to use Clang and 
> LibC++.
> 
> I'm trying to use Clang 4.0. It is not available in Yakkety by default, but 
> http://apt.llvm.org/  conveniently offers an Apt 
> repository to get the right package. I was able to use that and get Clang 4.0 
> pretty smoothly.
> 
> Similarly, I'd like to use LibC++ 4.0. Yakkety offers 3.7 by default, and it 
> is actually broken. However, it seems that apt.llvm.org 
>  does not provide .deb packages for LibC++. Is there 
> anywhere I could find them?
> 
> If none exist, how hard would it be to add them? I'd be willing to spend some 
> time trying to make this happen.
> 
> Cheers,
> 
> M.
> 
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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


Re: [cfe-users] Getting variable names in LLVM IR

2017-02-14 Thread Duncan P. N. Exon Smith via cfe-users

> On 2017-Feb-13, at 23:10, Subhendu Malakar via cfe-users 
>  wrote:
> 
> Hi,
> I'm a newbie in LLVM environment.
> 
> I'm trying to generate the LLVM IR of a c file using clang. The command line 
> argument I'm passing is as :
> "clang -O0 -S -emit-llvm test.c -c -o test.ll"

If you add "-###" to the end of the command-line you can see the raw -cc1 
command for the compilation.  Depending on your version of clang, you should 
see "-discard-value-names" in there.  If you repeat the -cc1 command yourself, 
skipping that option, you'll get variable names.

If you're compiling clang yourself (it doesn't sound like you are, but just in 
case), this -discard-value-names option is *not* passed by default in asserts 
builds.

> 
> It is generating the LLVM IR properly but I'm not getting the variable names. 
> e.g,
> 
> for the c file :
> #include 
> 
> int main()
> {
>int x;
>int y;
>x = 2;
>y =4;
>int z = x*y;
> 
>if(x==y)
>{
>z = x*y;
>return z;
>} else
>{
>z = x+y;
>}
>printf("z = %d", z);
>return 0;
> }
> 
> 
> the corresponding llvm IR is :
> 
> ; Function Attrs: nounwind uwtable
> define i32 @main() #0 {
>  %1 = alloca i32, align 4
>  %2 = alloca i32, align 4
>  %3 = alloca i32, align 4
>  %4 = alloca i32, align 4
>  store i32 0, i32* %1, align 4
>  store i32 2, i32* %2, align 4
>  store i32 4, i32* %3, align 4
>  %5 = load i32, i32* %2, align 4
>  %6 = load i32, i32* %3, align 4
>  %7 = mul nsw i32 %5, %6
>  store i32 %7, i32* %4, align 4
>  %8 = load i32, i32* %2, align 4
>  %9 = load i32, i32* %3, align 4
>  %10 = icmp eq i32 %8, %9
>  br i1 %10, label %11, label %16
> 
> ; :11: ; preds = %0
>  %12 = load i32, i32* %2, align 4
>  %13 = load i32, i32* %3, align 4
>  %14 = mul nsw i32 %12, %13
>  store i32 %14, i32* %4, align 4
>  %15 = load i32, i32* %4, align 4
>  store i32 %15, i32* %1, align 4
>  br label %21
> 
> ; :16: ; preds = %0
>  %17 = load i32, i32* %2, align 4
>  %18 = load i32, i32* %3, align 4
>  %19 = add nsw i32 %17, %18
>  store i32 %19, i32* %4, align 4
>  br label %20
> 
> ; :20: ; preds = %16
>  store i32 0, i32* %1, align 4
>  br label %21
> 
> ; :21: ; preds = %20, %11
>  %22 = load i32, i32* %1, align 4
>  ret i32 %22
> }
> 
> 
> I wanted to get the variables in their original name i.e, x,y,z instead of 
> %1,%2,%3, etc.
> Is it possible to do so?
> 
> Thanks.
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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


Re: [cfe-users] complie clang with clang

2017-03-21 Thread Duncan P. N. Exon Smith via cfe-users

> On 2017-Mar-21, at 06:51, Masaru Tsuchiyama via cfe-users 
>  wrote:
> 
> Hi.
> 
> I'm trying to complie clang with clang.

This should be fairly well documented.  Try these:
  http://clang.llvm.org/get_started.html
  http://llvm.org/docs/CMake.html
  http://llvm.org/docs/AdvancedBuilds.html

It sounds like you're looking for "bootstrap" builds, which is the first thing 
in the third link.

> Then I found the site.
> http://stackoverflow.com/questions/12479458/how-to-build-clang-with-clang
> 
> I want to know whether clang is surely used when compiling clang.
> I want it to display command line of clang compilation.
> 
> Is there any method to show the exact command line when compiling it.

This depends on your build system.  If you're using Ninja, you can add "-v" to 
the command-line to see what commands are being called.

> Best Regards.
> 
> -- 
> Masaru Tsuchiyama 
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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


Re: [cfe-users] question about building

2017-04-24 Thread Duncan P. N. Exon Smith via cfe-users
+cfe-dev; bcc:cfe-users (this is more of a development question than a user 
question, AFAICT)

> On Apr 17, 2017, at 08:18, Michael Mitchell via cfe-users 
>  wrote:
> 
> I'm new to LLVM and also new to Cmake. I've checked out multiple LLVM 
> projects including clang  (see below for list of projects checked out).  I 
> made the build directory. 
> 
> My question has three possible answers - A,B, or C, but if the answer is 
> neither of those 3 can you please describe in detail what the correct answer 
> is. 
> 
> My question is this,  "Can I run cmake (A) with the path ONLY to the root of 
> the LLVM project to build ALL of the projects I checked out,

This should work, since you checked everything out inside of the LLVM checkout.

> or (B) do I have to supply the path to the root of all the projects I checked 
> out to cmake at once, or (C) do I run cmake multiple times in succession with 
> a new path each time to the respective project I am building"
> 
> Thank you in advance
> 
> 
> 
> #. Checkout LLVM:
> 
>* ``cd where-you-want-llvm-to-live``
>* ``svn co http://llvm.org/svn/llvm-project/llvm/trunk 
>  llvm``
> 
> #. Checkout Clang:
> 
>* ``cd where-you-want-llvm-to-live``
>* ``cd llvm/tools``
>* ``svn co http://llvm.org/svn/llvm-project/cfe/trunk 
>  clang``
> 
> #. Checkout LLD linker **[Optional]**:
> 
>* ``cd where-you-want-llvm-to-live``
>* ``cd llvm/tools``
>* ``svn co http://llvm.org/svn/llvm-project/lld/trunk 
>  lld``
> 
> #. Checkout Polly Loop Optimizer **[Optional]**:
> 
>* ``cd where-you-want-llvm-to-live``
>* ``cd llvm/tools``
>* ``svn co http://llvm.org/svn/llvm-project/polly/trunk 
>  polly``
> 
> #. Checkout Compiler-RT (required to build the sanitizers) **[Optional]**:
> 
>* ``cd where-you-want-llvm-to-live``
>* ``cd llvm/projects``
>* ``svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk 
>  compiler-rt``
> 
> #. Checkout Libomp (required for OpenMP support) **[Optional]**:
> 
>* ``cd where-you-want-llvm-to-live``
>* ``cd llvm/projects``
>* ``svn co http://llvm.org/svn/llvm-project/openmp/trunk 
>  openmp``
> 
> #. Checkout libcxx and libcxxabi **[Optional]**:
> 
>* ``cd where-you-want-llvm-to-live``
>* ``cd llvm/projects``
>* ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk 
>  libcxx``
>* ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk 
>  libcxxabi``
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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


Re: [cfe-users] Crash reporting for inline functions

2018-03-30 Thread Duncan P. N. Exon Smith via cfe-users
+Adrian

I suspect the crash reporters are giving you results based solely on the symbol 
table.  The dSYM has extra information from the debug info so it can fill in 
the gaps.  Perhaps the crash reporters aren't using the dSYMs, but Xcode is?

Any ideas Adrian?

> On Mar 30, 2018, at 16:28, Michael Eisel via cfe-users 
>  wrote:
> 
> Hi,
> 
> I've been playing around with a stack trace of inlined functions, e.g.:
> 
> void __attribute__((always_inline)) f1() {
> f2();
> }
> 
> void __attribute__((noinline)) f2() {
> f3();
> }
> 
> void __attribute__((always_inline)) f3() {
> abort();
> }
> 
> When I use various crash reporters, like PLCrashReporter and Crashlytics, I 
> don't see f1 or f3 in the stack trace, implying that inline functions aren't 
> included. However, when I cause the crash in the Xcode debugger, I see the 
> inline functions in the stack trace. Is there additional context that Xcode 
> would have, e.g. with symbols in the binary, that the crash reporters with 
> their dSYM files don't?
> 
> Thanks,
> Michael
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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


Re: [cfe-users] App security and the __FILE__ macro

2018-04-12 Thread Duncan P. N. Exon Smith via cfe-users
`strrchr(__FILE__, '/')+1` should get resolved at compile-time whenever you 
have optimizations on.

> On Apr 12, 2018, at 15:38, Rick Mann via cfe-users  
> wrote:
> 
> The higher-ups decided we needed penetration testing of our app. One of their 
> concerns was that if you run the macOS strings tool on our binary and grep 
> for /Users, you get a ton of absolute paths for source files in the project. 
> This is because (I think) we use the __FILE__ macro as part of our logging, 
> to log file:line information. I find this info a boon, and we log that even 
> in release builds to help track down issues reported by customers. At run 
> time, we trim off all of the path except for the filename and extension.
> 
> It would be great if there were a __FILENAME__ macro that did this for me. Is 
> there any such thing?
> 
> Thanks!
> 
> -- 
> Rick Mann
> rm...@latencyzero.com
> 
> 
> ___
> cfe-users mailing list
> cfe-users@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

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